sballi Posted April 16, 2012 Share Posted April 16, 2012 On poduct list page hovering on product it shows image of each color but when i use layered navigation to filter the product than all colors get disappear In Category Controller page /* colors */ foreach ( $this->cat_products as $key => $cat_product ) { $product = new Product ( intval ( $cat_product[ 'id_product' ] ), true , intval ( self::$cookie -> id_lang )); $colors = array(); $combinationImages = $product->getCombinationImages((int)(self::$cookie->id_lang)); $attributesGroups = $product->getAttributesGroups((int)(self::$cookie->id_lang)); if ( Db :: getInstance ()-> numRows ()) { foreach ( $attributesGroups AS $k => $row ) { /* Color management */ if (isset( $row[ 'attribute_color' ] ) AND $row[ 'attribute_color' ] AND $row[ 'id_attribute_group' ] == $product -> id_color_default ){ $colors[$row[ 'id_attribute' ]][ 'value' ] = $row[ 'attribute_color' ] ; $colors[$row[ 'id_attribute' ]][ 'name' ] = $row[ 'attribute_name' ] ; $colors[$row['id_attribute']]['id_image'] = isset($combinationImages[$row['id_product_attribute']][0]['id_image']) ? $combinationImages[$row['id_product_attribute']][0]['id_image'] : -1; } } } $this->cat_products[$key][ 'colors' ] = $colors; }[/size][/font][/color] [color=#343943][font=Arial, Helvetica, sans-serif][size=3]In product-list.tpl page {foreach from=$product.colors key=id_attribute item=color} <img src="{$link->getImageLink($product.link_rewrite, $color.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" id="colorImage" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /> {/foreach}[/size][/font][/color] [color=#343943][font=Arial, Helvetica, sans-serif][size=3] any helpful solution will be appriciated thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts