Jump to content
thirty bees forum
  • 0

Attribute Name on product list


Question

Posted

Hi,

I want to display the attribute name of the combination on product list.

So, in config.inc.php, i created this function :

function name_combination($id_product_attribute){
    $combination = new Combination($id_product_attribute);
     $nomcombination = $combination->getAttributesName(Context::getContext()->langage->id);
    
     return $nomcombination;
}

And in product-list.tpl :

<span>
{name_combination($product.id_product_attribute)}
</span>

But it always return an empty array....:/

Thank for your help

2 answers to this question

Recommended Posts

  • 0
Posted

Hi,

Your approach is wrong....to place a function inside config.inc.php file is bad idea.

But even if you want to go that way product-list.tpl has $products variable and inside there a foreach loop that include `product-list-item.tpl` each time with $product variable.

So you should put your code inside product-list-item.tpl

A better approach will be to create a simple module with a unique hook and exec that hook inside the tpl file.

{hook h="my_unique_hook" mod="my_module_name" product=$product}

 

  • 0
Posted

Hi,

Thank you, you are right.
I just modified and created all that.
In addition, I solved my problem, it was the id of the language that I did not get.

regards

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