Tüm ürünleri tek bir sayfada ve kendi kategorisi altında göstermek istediğim bir sayfa yaptım. Buradan da bir kaç arkadaş yardımcı oldu geliştirerek istediğim hale de getirdim. Şimdi istediğim şey ise ben ilk xxx kategori birinci sırada yyy ikicinci sırada olsun bunu nasıl ayarlayabilirim.
Kod şu şekilde
newcategory.php
<?php
class ControllerExtensionModuleFskcatproducts extends Controller {
public function index() {
$this->load->model('tool/image');
$this->load->model('catalog/product');
$this->document->setTitle("Tüm Kategoriler"); // baslik
$category_list = array(117,240,166,241,242); // Buraya hangi kategoriler gelecekse onların adlarını yazıyoruz.
$category_products = $this->db->query(
"SELECT cd.name as category_name, ptc.product_id
FROM
".DB_PREFIX."product_to_category ptc LEFT JOIN
".DB_PREFIX."product p ON (ptc.product_id = p.product_id)
LEFT JOIN ".DB_PREFIX."category_description cd ON (ptc.category_id = cd.category_id)
WHERE
ptc.category_id IN(".implode(',',$category_list).") AND
p.status = 1 AND
cd.language_id = '".(int)$this->config->get('config_language_id')."'
GROUP BY ptc.product_id")->rows;
$data['products'] = array();
foreach($category_products as $category_product){
$result = $this->model_catalog_product->getProduct($category_product['product_id']);
$image = ($result['image'] ? $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')) : $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')));
$price = ($this->customer->isLogged() || !$this->config->get('config_customer_price') ? $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']) : false);
$special = ((float)$result['special'] ? $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']) : false);
$tax = ($this->config->get('config_tax') ? $this->currency->format((float)$result['special'] ? $result['special'] : $result['price'], $this->session->data['currency']) : false);
$rating = ($this->config->get('config_review_status') ? (int)$result['rating'] : false);
$data['products'][$category_product['category_name']][] = array(
'product_id' => $result['product_id'],
'stock_control' => $stock_control,
'thumb' => $image,
'name' => $result['name'],
'description' => utf8_substr(trim(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'))), 0, $this->config->get('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating' => $result['rating'],
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);
}
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$this->response->setOutput($this->load->view('extension/module/fskcatproduct', $data));
}
}
[COLOR=#D9DAE9][FONT=Open Sans][SIZE=2][/SIZE][/FONT][/COLOR]Örnek kulaklık olan kategori ilk sırada çıksın gibi