Jump to content

categorie et nombre article


Recommended Posts

bonjour voila il ya une contrib pour ce que je cherche mes voila il indique le nombre de sous categorie et pas le nombre de produit voici le code si quelqun pourrer me dire ce que je doit chgt pour que ca marche merci.
fichier category-tree-branch. tpl

// exclude home category
if($row['id_category'] != 1)
{
$result_product_count = Db::getInstance()->ExecuteS('
SELECT COUNT(ac.`id_product`) as totalProducts
FROM `'._DB_PREFIX_.'category_product` ac
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ac.`id_product`
WHERE ac.`id_category` = '.$row['id_category'].' AND p.`active` = 1');
$row['product_count'] = $result_product_count[0]['totalProducts'];
}

et pour le fichier blockcategories.php

// exclude home category
if($row['id_category'] != 1)
{
$result_product_count = Db::getInstance()->ExecuteS('
SELECT COUNT(ac.`id_product`) as totalProducts
FROM `'._DB_PREFIX_.'category_product` ac
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ac.`id_product`
WHERE ac.`id_category` = '.$row['id_category'].' AND p.`active` = 1');
$row['product_count'] = $result_product_count[0]['totalProducts'];
}

12980_kYX7wzsbJBTX2UExzOkt_t

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...