agah611 Posted May 4, 2013 Share Posted May 4, 2013 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.... i think about this module: list of attributes on product list view 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 files1. CategoryController.phpafter:$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.phpafter:$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}"> </a>{/foreach}{/if} Link to comment Share on other sites More sharing options...
hichamino Posted June 22, 2013 Share Posted June 22, 2013 Hello; I wonder if you could solve the problem of display attributes on the product list page, I have been looking for several days but I have not found anything that works on 1.5.4 thank you in advanceBonjour; je me demande si tu as pu résoudre le problème d'affichage des attributs sur la page liste des produits, je cherche depuis plusieurs jours mais je n'ai rien trouvé qui fonctionne sur la 1.5.4 merci d'avance Link to comment Share on other sites More sharing options...
Kerm Posted July 15, 2013 Share Posted July 15, 2013 I know how get product combinations for each product on list page...but i dont know how recive combination ID for each product for put combination in cart Link to comment Share on other sites More sharing options...
tomerg3 Posted July 15, 2013 Share Posted July 15, 2013 It's not a simple task, even if you display the attributes on the product list page, there is a lot of Javascript code that needs to be added in order to properly handle all the combinations/ price impact / availability etc... Check out the following module which makes it easy, and let you add attribute selection to any product on any page. http://www.prestashop.com/forums/topic/79758-module-product-list-attributes-allow-customers-to-select-product-attributes-on-the-category-manufacturer-supplier-and-search-pages/ Link to comment Share on other sites More sharing options...
Kerm Posted July 16, 2013 Share Posted July 16, 2013 Damn i dont want buy a module... I now have product combinations and default combination ID on product-list.tpl but dunno how to get and change combination ID on change product attribute... Link to comment Share on other sites More sharing options...
sadlyblue Posted July 16, 2013 Share Posted July 16, 2013 We use product list attributes. It works great. It may not be cheap, but it's not an easy module to code either. The main problem is not to show the attributes, but to correctly add them to the cart when the client clicks the button. Link to comment Share on other sites More sharing options...
tomerg3 Posted July 16, 2013 Share Posted July 16, 2013 Kerm: You can take a look at all the combination related Javascript code that is generated in product.tpl, and functions that are defined in product.js You would basically need to replicate the code from product.tpl for every product in the product-list.tpl file, and create a modified version of the code from product.js, that will know to handle multiple products and not just one. It is a pretty big job, which is not to say you should not have a go at it, just a friendly heads up about the complexity of the task. 1 Link to comment Share on other sites More sharing options...
Recommended Posts