When we use right now, modules like Featured,Bestsellers and latest in home the link of the product on image or button don`t have the category variable. I think is better if future realeases have this option.
I have done by my own.
In model catalog I write this function:
Code: Select all
public function getAllCategoriesfromProduct($product_id) {
$product_data = array();
$sql="SELECT category_id FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "'";
$product_query = $this->db->query($sql);
foreach ($product_query->rows as $product) {
$product_data[] = $product['category_id'];
$line_separated = implode("_", $product_data);
}
return $line_separated;
}
And in each module I write this code (example for module/latest.php):
Code: Select all
$categorias = $this->model_catalog_category->getAllCategoriesfromProduct($result['product_id']);
Code: Select all
'href' => $this->url->link('product/product', . $result['product_id']),
Code: Select all
'href' => $this->url->link('product/product', 'path=' .$categorias . '&product_id=' . $result['product_id'])