Jump to content

Get combination-image Prestashop 1.6

Recommended Posts


Im trying to show the correct combination image on my Prestashop for which color you want your product: My test is here: https://testfiskpaakrogen.dk/433-savage-gear-3d-line-thru-sandeel.html

For now i can only show the "main" image for the product, and not the correct combination image, besides that the big picture is changing when choosing another color (farve)

Right now this is the code generating the list of images to choose from.

<ul id="color_to_pick_list" class="p5 clearfix"> {assign var="default_colorpicker" value=""} {foreach from=$group.attributes key=id_attribute item=group_attribute} {assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')} <li{if $group.default == $id_attribute} class="selected"{/if}> <a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" {if $img_color_exists}style="background: url({$img_col_dir}{$id_attribute|intval}.jpg) repeat;"{/if}> {if $group.name == 'Størrelse'}<option value="{$id_attribute|intval}" title= "{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option>{else}<div class="atrimg"><img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'large_default')|escape:'html':'UTF-8'}" style="height: 110px;"><div class="colorspan">{$group_attribute|escape:'html':'UTF-8'}</div></div>{/if}</a> </li> {if ($group.default == $id_attribute)} {$default_colorpicker = $id_attribute} {/if} {/foreach} </ul>

If you open the url, there is a smarty variable debug popup.

Best, Lasse

Edited by Niller (see edit history)

Share this post

Link to post
Share on other sites

  • 2 months 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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More