Jump to content

How to add Product attributes to product grid or list view in category


Recommended Posts

Hello,

I want to display attributes by v1.5x in product list view.

Has anyone done this before.

 

I've found a guide, but that does not work properly.

 

I thank you in advance....

 

 

For prestashop 1.5 blocklayered module overwrites the product list data so that's why the code is not working.

For demo purposes I left out getting the image of the color group attribute (the previous code is not displaying in product list anyway)

Also for simplicity I just modify core files

 

1. CategoryController.php

after:

 

$this->assignProductList();add:

 

foreach ($this->cat_products as $key => $product_item) {

$product = new Product($product_item['id_product'], false, self::$cookie->id_lang);

$colors = array();

$attributes = $product->getAttributeCombinations(self::$cookie->id_lang);

foreach ($attributes as $attribute_key => $attribute) {

if ($attribute['is_color_group'] > 0) {

$colors[$attribute['id_attribute']]['value'] = $attribute['attribute_name'];

}

}

$this->cat_products[$key]['colors'] = $colors;

}

2. modules/blocklayered/blocklayered.php

after:

 

$products = Product::getProductsProperties((int)$cookie->id_lang, $products);add:

 

foreach ($products as $key => $product_item) {

$product = new Product($product_item['id_product'], false, $cookie->id_lang);

$colors = array();

$attributes = $product->getAttributeCombinations($cookie->id_lang);

foreach ($attributes as $attribute_key => $attribute) {

if ($attribute['is_color_group'] > 0) {

$colors[$attribute['id_attribute']]['value'] = $attribute['attribute_name'];

}

}

$products[$key]['colors'] = $colors;

}

2. product-list.tpl:

inside:

 

<div class="center_block">add:

 

{if isset($product.colors)}{foreach from=$product.colors item=v}

<a style="background: {$v.value};" title="{$v.value}">&nbsp;&nbsp;&nbsp;&nbsp;</a>{/foreach}

{/if}

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

I have the same issue here,

I am trying to 'add all or some attributes' to the product-list.tpl, I have copied and pasted the attributes DIV in the product-list, thinking it will take the parameters from the global.css, but It did not work.

 

Is it really that hard? I should rebuild the .tpl and make a new .css?

 

If anyone has managed to put the attributes in the product-list view , please reply.

 

Kind regards,

Sven

Link to comment
Share on other sites

Hello!

 

I'm creating a module for this and it's very soon done where you will get this:

- Show attributes (eg. colors, disk space etc)

- Be able to choose attribute (dropdown menu or tick in) like colors or disk space.

- Image changes when you pick a color

- Choose color and add it to the cart

 

I will PM you all when its done.

 

I think i will sell it for 59euros :)

 

Intressted?

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Hello!

 

I'm creating a module for this and it's very soon done where you will get this:

- Show attributes (eg. colors, disk space etc)

- Be able to choose attribute (dropdown menu or tick in) like colors or disk space.

- Image changes when you pick a color

- Choose color and add it to the cart

 

I will PM you all when its done.

 

I think i will sell it for 59euros :)

 

Intressted?

 

IS IT DONE YET ?

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