Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
Haider
Haider
formanufacturer.png (2Kb)  
I want to help solve a configuration: When choosing a manufacturer, show all categories and below the manufacturer's products. For those who surf the web, this is not convenient, because it annoys and exit the website.
 
I want to set that selecting the manufacturer showing the manufacturer's products only.
 
Second: There are manufacturers with 2 or 3 categories and would be excluded.
 
How to solve these 2 items?
 
Thanks in advance
 
=========
 
I googled and found following but this is actually for opencart - but I wish to do same like or better than if somebody can help ... Thanks in advance...
 
"
 
Open ROOT/catalog/controller/product/product.php
 
$results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
 
Directly AFTER that, add:
 
if(count($results)<1 && (int)$this->data['product_info']['manufacturer_id'] > 0){){
$results = $this->model_catalog_product->getProductRelatedByManufacturer($this->data['product_info']['manufacturer_id'],$this->request- >get['product_id']);
}
 
Next, open ROOT/catalog/model/catalog/product.php
 
public function getProductRelated($product_id) {
$product_data = array();
$product_related_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int)$product_id . "'");
foreach ($product_related_query->rows as $result) {
$product_query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.product_id = '" . (int)$result['related_id'] . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'");
if ($product_query->num_rows) {
$product_data[$result['related_id']] = $product_query->row;
 
}
 
} return $product_data;
 
}
 
 
Directly AFTER that, add:
 
 
public function getProductRelatedByManufacturer($manufacturer_id,$product_id) {
$product_data = array();
$product_related_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product WHERE manufacturer_id = '" . (int)$manufacturer_id . "' LIMIT 0,9");
foreach ($product_related_query->rows as $result) {
$product_query = $this->db->query("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, ss.name AS stock, (SELECT AVG(r.rating) FROM " . DB_PREFIX . "review r WHERE p.product_id = r.product_id GROUP BY r.product_id) AS rating FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) LEFT JOIN " . DB_PREFIX . "stock_status ss ON (p.stock_status_id = ss.stock_status_id) WHERE p.product_id = '" . (int)$result['product_id'] . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.date_available <= NOW() AND p.status = '1'");
if ($product_query->num_rows && $result['product_id'] != $product_id) { $product_data[$result['product_id']] = $product_query->row;
}
 
}
 
return $product_data;
 
}
 
"
 
 
Last modified: 31 Jul 2012 3:54 PM