koubin Posted July 7, 2021 Share Posted July 7, 2021 (edited) Hello, for Prestashop 1.7 I would like to know, if there is an easy way to display the variant additional price (price impact for the standalone product). Lets say I sell cups. It would look like this: Cup $20 Variants: - cup with color +$5 - cup with image +$10 I have found the place where to add it. It is product-variants.tpl and the code there: {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name} ...HERE ADD VARIANT PRICE...</option> {/foreach} but I can't figure out how to find and use the correct variable for that (I also have no idea how to find available variables in the TPL. The {debug} is not sufficient for that) I guess it should be something like this: {$combinations.price} and the $combinations should be somehow referenced in TPL and PHP, but don't know how and where. Could someone give me a little insight on how this works? Thanks Edited June 2, 2022 by koubin gramatic (see edit history) Link to comment Share on other sites More sharing options...
koubin Posted July 7, 2021 Author Share Posted July 7, 2021 I might found the solution. {$combinations[$id_attribute].price} so the final code is: {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name} +{$combinations[$id_attribute].price}{$currency.sign}</option> {/foreach} Link to comment Share on other sites More sharing options...
JBW Posted November 2, 2021 Share Posted November 2, 2021 If you are looking for an out-of-the-box working module (no overrides, no template changes) please check out my module: Attribute Price and Availability Display Module Link to comment Share on other sites More sharing options...
Nexus85 Posted February 23, 2022 Share Posted February 23, 2022 On 7/7/2021 at 6:40 PM, koubin said: I might found the solution. {$combinations[$id_attribute].price} so the final code is: {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name} +{$combinations[$id_attribute].price}{$currency.sign}</option> {/foreach} I tried this but I only get +€ and not the price? Is there a solution? 1 Link to comment Share on other sites More sharing options...
Mohammad Oveissi Posted March 7, 2022 Share Posted March 7, 2022 (edited) Hello, does anyone know how to solve this problem? It shows exactly the same for me tnx ps 1.7.8.4 Edited March 7, 2022 by Mohammad Oveissi (see edit history) Link to comment Share on other sites More sharing options...
koubin Posted June 2, 2022 Author Share Posted June 2, 2022 On 3/7/2022 at 4:42 PM, Mohammad Oveissi said: Hello, does anyone know how to solve this problem? It shows exactly the same for me tnx ps 1.7.8.4 seems like the combinations (attributes) ids can be whatever number, so when I try to go through them with a key (where $id_attribute is key and its value goes from 0, 1, 2...), it can give me empty results, as the ids of the attributes might be like 70, 72, 73... for example. I did not find the way to find out those attributes ids, but it was not necessary feature in the end for me. If anybody find the solution, please share. Link to comment Share on other sites More sharing options...
cycloholic Posted January 11, 2023 Share Posted January 11, 2023 Trying also to resolve this issue with attributes for myself. But where should i put this code? Link to comment Share on other sites More sharing options...
koubin Posted January 11, 2023 Author Share Posted January 11, 2023 12 minutes ago, cycloholic said: Trying also to resolve this issue with attributes for myself. But where should i put this code? it was in this file, but if I remember well it did not work as intended: \<your shop>\themes\<your theme>\templates\catalog\_partials\product-variants.tpl Link to comment Share on other sites More sharing options...
cycloholic Posted January 11, 2023 Share Posted January 11, 2023 Completely beginner here, should i have access to those with ftp or? Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted January 11, 2023 Share Posted January 11, 2023 (edited) it's very complex to solve this problem, we have modified the code for ps1.6x and 1.7 early versions we also developed this feature in our website too , you can click some color ,the price/weight will change, https://www.irder.com/item/17/solid-color-formal-business-work-man-shirt-tshirt-work-uniform.html Edited January 11, 2023 by irder shopping (see edit history) Link to comment Share on other sites More sharing options...
DorianS Posted June 5, 2023 Share Posted June 5, 2023 Anyone finally found the solution? Variable name or something to add in .tpl or/and .php to display attribute price? Link to comment Share on other sites More sharing options...
lipo999 Posted February 16, 2024 Share Posted February 16, 2024 I have similar problem. Do anybode know what function causes product price update when variant is selected? Price in product-prices.tpl works fine (its original code), but I would like "copy/paste" to product-additional-info.tpl, but here code for display price not works (its not change when variant is change). Thank you 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