saracoratello Posted April 7, 2014 Share Posted April 7, 2014 Hi, i have prestashop 1.5.6.2. I want to display products attributes (color) in product listing of this module, but i see that it is not default. Anybody know how to do this ? Maybe some tips ? Thanks in advance. Link to comment Share on other sites More sharing options...
NemoPS Posted April 7, 2014 Share Posted April 7, 2014 You might try out this module: http://www.presto-changeo.com/it/attribute-modules/59-product-list-attributes.html although you might also have to modify it slightly to add the same code to the module, other than product list Link to comment Share on other sites More sharing options...
saracoratello Posted April 7, 2014 Author Share Posted April 7, 2014 (edited) OK i made it wirh a little help od this forum posts history! add to blockspecials.php this code: public function getProductAttributeCombinations($products) { $combinations = array(); foreach($products as $product) { // load product object $product = new Product ($product['id_product'], $this->context->language->id); // get the product combinations data // create array combinations with key = id_product $combinations[$product->id] = $product->getAttributeCombinations($this->context->language->id); } return $combinations; } public function hookRightColumn($params) { if (Configuration::get('PS_CATALOG_MODE')) return; // We need to create multiple caches because the products are sorted randomly $random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1))); if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random))) { if (!($specials = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, 5)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $produkty = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, 5); $combinations = $this->getProductAttributeCombinations($produkty); $this->smarty->assign(array( 'specials' => $specials, 'combinations' => $combinations, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); } and in theme {foreach from=$combinations key=k item=comb} {if $k == $special.id_product} {$attr.attribute_name} {/if} {/foreach} Edited April 7, 2014 by saracoratello (see edit history) Link to comment Share on other sites More sharing options...
saracoratello Posted April 8, 2014 Author Share Posted April 8, 2014 My problem is that this attributes are hidden when im using search engine ( i modified controller) and layered block navigation. Any ideas why ? Link to comment Share on other sites More sharing options...
NemoPS Posted April 9, 2014 Share Posted April 9, 2014 For layered navigation, you need to add your custom code to ajaxCall as well (blocklayered,php) for the search engine, edit the SearchController again, and modify Search::Find() too Link to comment Share on other sites More sharing options...
Recommended Posts