Jump to content

[RESOLU] Ajouter le nom de catégorie dans product-list


Recommended Posts

Bonjour

 

j'ai finalement avancé en créant une fonction getNameById dans la un fichier d'override de Category.php.

 

Ainsi dans product-list.tpl, je peux afficher le nom de ma catégorie par le code

{Category::getNameById($product.id_category_default)}

 

Mon fichier /override/classes/Category.php:

 

<?php
class Category extends CategoryCore
{
       public function getNameById($id_categorie, $id_lang=NULL)
	{
		 if (!(int)$id_lang)
					$id_lang = _USER_ID_LANG_;
			return Db::getInstance()->getValue('
					SELECT name
					FROM `'._DB_PREFIX_.'category_lang`
					WHERE `id_lang` = '.(int)($id_lang).'
					AND `id_category` = '.(int)($id_categorie));
	}
}

 

Matt

Link to comment
Share on other sites

  • 1 year later...

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...