TimTamTom Posted September 22, 2016 Share Posted September 22, 2016 (edited) Hey there guys and girls, I'm fighting with the product-list-colors.tpl.. The url on the product-list page does not link to the right product combination, the url it shows: (https://www.sunheroes.nl/)117-mr-blitz.html#/color-honing/combinatie-20728_honing_gradient However it should be: (https://www.sunheroes.nl/)117-mr-blitz.html#/202-color-honing/241-combinatie-20728_honing_gradient In the product-list-colors.tpl the code that creates the url is as follows: {assign var='img_color_exists' value=file_exists($col_img_dir|cat:$color.id_attribute|cat:'.jpg')} <li> <a href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute)|escape:'html':'UTF-8'}" data-productid="{$color.id_product}" data-productattribute="{$color.id_product_attribute}" id="color_{$color.id_product_attribute|intval}" class="swap_color color_pick"{if !$img_color_exists && isset($color.color) && $color.color} style="background:{$color.color};"{/if}> {if $img_color_exists} <img src="{$img_col_dir}{$color.id_attribute|intval}.jpg" alt="{$color.name|escape:'html':'UTF-8'}" title="{$color.name|escape:'html':'UTF-8'}" width="20" height="20" /> {/if} </a> </li> How to edit the above (or a Controller?) so it shows the color and attribute id number? Help is much appreciated!! Thanks, Tim Edited September 22, 2016 by TimTamTom (see edit history) Link to comment Share on other sites More sharing options...
TimTamTom Posted September 26, 2016 Author Share Posted September 26, 2016 Anyone? Please Link to comment Share on other sites More sharing options...
rocky Posted September 28, 2016 Share Posted September 28, 2016 Your code is missing a few parameters. It should be: <a href="{$link->getProductLink($color.id_product, null, null, null, null, null, $color.id_product_attribute, Configuration::get('PS_REWRITING_SETTINGS'), false, true)|escape:'html':'UTF-8'}" data-productid="{$color.id_product}" data-productattribute="{$color.id_product_attribute}" id="color_{$color.id_product_attribute|intval}" class="swap_color color_pick"{if !$img_color_exists && isset($color.color) && $color.color} style="background:{$color.color};"{/if}> Note the addition of Configuration::get('PS_REWRITING_SETTINGS'), false, true to the getProductLink function call. That will set the add_anchor parameter to true, which should cause the IDs to be added. Link to comment Share on other sites More sharing options...
TimTamTom Posted September 30, 2016 Author Share Posted September 30, 2016 Works like a charm! Thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now