AdaminCA Posted September 25, 2009 Share Posted September 25, 2009 Hi,Does anyone know what variable I would use in the product.tpl template to display the price impact of an attribute?Thank you! Link to comment Share on other sites More sharing options...
AdaminCA Posted September 26, 2009 Author Share Posted September 26, 2009 Maybe I phrased my last question incorretly.I would like to be able to show the price impact (increase) of an attribute (option) on the product detail (product.tpl) page.I know that I could hard code it into the description of the attribute being displayed in the drop down menu, but since I have different customer groups that receive different discounts, this would not work properly for all customers.Does anyone know how to display the price of the attribute (option) on the product page?I will deposit $15.00 into your paypal account immeditatly if you can just tell me how to do this.Thanks!Adam Link to comment Share on other sites More sharing options...
Iamcaptain Posted September 26, 2009 Share Posted September 26, 2009 Sent you a pm. Pm me back if you got it. Link to comment Share on other sites More sharing options...
AdaminCA Posted September 27, 2009 Author Share Posted September 27, 2009 Ok...I am increasing my "reward" for helping me figure this out to $30.00 to your Paypal acct.I need to be able to display the amount that an attribute will increase the price next to the attribute description in the drop down menu. I need to do this for multiple attributes for the same product:For example:Drop down box 1--------------------------------------Small - +$0.00Medium - +$3.00Large - +$5.00--------------------------------------Drop down box 2--------------------------------------Green- +$0.00Red - +$3.00Blue - +$5.00--------------------------------------I also need these amounts to change dynamically depending on which group of customer is logged in, wholesale or retail. That is why I just don't hard code the amount into the description.Is there a variable, or some coding that anyone can show me that will accomplish this?I will deposit $30.00 to your Paypal account if you can show me a solution that works.....Thank you!Adam Link to comment Share on other sites More sharing options...
rocky Posted September 28, 2009 Share Posted September 28, 2009 I've sent you a private message with code. Let me know if it is what you want. Link to comment Share on other sites More sharing options...
rocky Posted October 1, 2009 Share Posted October 1, 2009 For the benefit of others who also want price impacts displayed in the attribute dropdowns, here is the solution we came up with:In product.php, change: $smarty->assign(array( 'groups' => $groups, 'combinaisons' => $combinations, /* Kept for compatibility purpose only */ 'combinations' => $combinations, 'colors' => (sizeof($colors) AND $product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages)); to: $smarty->assign(array( 'groups' => $groups, 'combinaisons' => $combinations, /* Kept for compatibility purpose only */ 'combinations' => $combinations, 'colors' => (sizeof($colors) AND $product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages, 'attributeImpacts' => Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'attribute_impact`'))); and in product.tpl in your theme's directory, change: <!-- attributes --> {foreach from=$groups key=id_attribute_group item=group} {$group.name|escape:'htmlall':'UTF-8'} : {assign var='groupName' value='group_'|cat:$id_attribute_group} {foreach from=$group.attributes key=id_attribute item=group_attribute} {$group_attribute|escape:'htmlall':'UTF-8'} {/foreach} {/foreach} {/if} to: <!-- attributes --> {foreach from=$groups key=id_attribute_group item=group} {$group.name|escape:'htmlall':'UTF-8'} : {assign var='groupName' value='group_'|cat:$id_attribute_group} {foreach from=$group.attributes key=id_attribute item=group_attribute} {$group_attribute|escape:'htmlall':'UTF-8'} {foreach from=$attributeImpacts key=id_attributeImpact item=attributeImpact} {if $id_attribute == $attributeImpact.id_attribute} - {if $attributeImpact.price > 0}+{/if}{convertPrice price=$attributeImpact.price*$group_reduction} {/if} {/foreach} {/foreach} {/foreach} {/if} 2 Link to comment Share on other sites More sharing options...
Roarke80 Posted October 5, 2009 Share Posted October 5, 2009 Hi, This code doesn't work for me. Is it cos I have three different attributes per product? I get something like this: 'Blue - $0.00 -$0.00 - $0.00"thks Link to comment Share on other sites More sharing options...
rocky Posted October 6, 2009 Share Posted October 6, 2009 Hi Roarke80,I'm using this code on a product with two attributes on my site without any problem here. Did you use the Product Combinations Generator to generate your attributes? Can you give me a link to your site so I can investigate? Link to comment Share on other sites More sharing options...
Roarke80 Posted October 6, 2009 Share Posted October 6, 2009 Thanks for replying!Here is one of my products with three sets of attributes...thanks for your help!http://www.thevelvetred.com/product.php?id_product=12 Link to comment Share on other sites More sharing options...
jeckyl Posted October 7, 2009 Share Posted October 7, 2009 I've the same problem on my product when i've more of one attributes.In the first attribute, no problem, after you can see all combinations.i give you a pix to explane. Link to comment Share on other sites More sharing options...
Pilpot Posted June 14, 2010 Share Posted June 14, 2010 Maybe too late...If it could help someone, just use the following to avoid this problem {foreach from=$groups key=id_attribute_group item=group} {$group.name|escape:'htmlall':'UTF-8'} : {assign var='groupName' value='group_'|cat:$id_attribute_group} 0}$('#resetImages').show('slow');{/if}"> {foreach from=$group.attributes key=id_attribute item=group_attribute} {$group_attribute|escape:'htmlall':'UTF-8'} {foreach from=$attributeImpacts key=id_attributeImpact item=attributeImpact} {if $id_attribute == $attributeImpact.id_attribute} {if $product->id == $attributeImpact.id_product} {if $attributeImpact.price > 0}(+{convertPrice price=$attributeImpact.price*$group_reduction}){/if} {/if} {/if} {/foreach} {/foreach} {/foreach} The main modification is {if $product->id == $attributeImpact.id_product} Link to comment Share on other sites More sharing options...
CTDAN Posted August 19, 2010 Share Posted August 19, 2010 I've just tried this mod on Prestashop 1.3 and returned nothing, after checking my tables the 'ps_attribute_impact' table contains no data even though I have multiple products with price increases. Has the attribute price sotirng changed since 1.2.5? Link to comment Share on other sites More sharing options...
babyewok Posted August 24, 2010 Share Posted August 24, 2010 Hi - how can I change this to show the new price rather than the impact on the price? So that I get "1 - £13.00" instead of "1 - +£0.00"? Link to comment Share on other sites More sharing options...
rocky Posted August 25, 2010 Share Posted August 25, 2010 Try changing: {if $attributeImpact.price > 0}(+{convertPrice price=$attributeImpact.price*$group_reduction}){/if} to: {if $attributeImpact.price > 0}({convertPrice price=$product.price+$attributeImpact.price*$group_reduction}){/if} Link to comment Share on other sites More sharing options...
babyewok Posted August 31, 2010 Share Posted August 31, 2010 Hi,On some prosucts, the price at the top get changed accordingly when you select the attributre, but the drop down does not show the attribute price impact at all - it is workign for some, but not others. I have: {if $id_attribute == $attributeImpact.id_attribute} {if $product->id == $attributeImpact.id_product} {if $attributeImpact.price > 0}(+ {convertPrice price=$attributeImpact.price*$group_reduction}){/if} {/if} {/if} Link to comment Share on other sites More sharing options...
babyewok Posted September 1, 2010 Share Posted September 1, 2010 No-one else had this problem using this code? Link to comment Share on other sites More sharing options...
babyewok Posted September 1, 2010 Share Posted September 1, 2010 It is apparently adding this bit (to stop the repeating problem) that causes the price impact to not show at all on some products! {if $product->id == $attributeImpact.id_product} Link to comment Share on other sites More sharing options...
babyewok Posted September 6, 2010 Share Posted September 6, 2010 Please help me - why is the price impact not showing at all for some products? Link to comment Share on other sites More sharing options...
babyewok Posted September 9, 2010 Share Posted September 9, 2010 Well, can someone explain to me what this bit actually does: {if $product->id == $attributeImpact.id_product} Why does the price impact repeat itself in the first place? Link to comment Share on other sites More sharing options...
mel- Posted October 23, 2010 Share Posted October 23, 2010 hi rocky,even on your own site where you have this module offered for free it is not working right:http://www.nethercottconstructions.com/prestashop-modules/2-product-attributes.htmlit is doing the same on my site, does not show image, weight or prices, just title (exactly the same as your block, not your images).is this something to do with using the final version 1.3.2? any help appreciated. I haven't found another module I like the looks of as much as this one Link to comment Share on other sites More sharing options...
mel- Posted October 24, 2010 Share Posted October 24, 2010 by using the product attributes generator I have this mostly working. still can't get images to show up. I wonder if there is a bug on the combinations page in 1.3.4 (or whatever the final is). if I use that page to try to modify contributions it doesn't take. have to go to the generator and there is no option on that page to add the image.also, does the development team know that the product creation page is now screwed up in firefox? it works in chrome and IE but on firefox there is no tabs, everything is listed in a single column. Link to comment Share on other sites More sharing options...
babyewok Posted April 26, 2011 Share Posted April 26, 2011 I am back on this again as I really want to get it working. I think I have figured out what the issue is - when I duplicate a product that has attribute with price impacts in the back office, there is no new entry made to the table attribute_impact for that product which is why the attribute price fails to show when I add this: {if $attributeImpact.id_product == $product->id} Can anyone suggest a way around this? so that a) the attribute impact price is not repeated and it actually shows up properly for the products that have been creating by clicking 'duplicate' in the back office? Link to comment Share on other sites More sharing options...
babyewok Posted April 26, 2011 Share Posted April 26, 2011 Is there some way I can use the product_attribute and product_attribute_combination tables instead? Please help! Link to comment Share on other sites More sharing options...
babyewok Posted May 3, 2011 Share Posted May 3, 2011 No-one has any ideas? I'd really like to get this working and we seem tantilisingly close! Link to comment Share on other sites More sharing options...
simberak Posted January 18, 2012 Share Posted January 18, 2012 Hi, I tried the rocky´s code, but I cant find that code in product.php so the first of the manual is obstacle for me I have 1.4.5.1 can somebody help please? Link to comment Share on other sites More sharing options...
bewaz Posted August 13, 2012 Share Posted August 13, 2012 Same problem for me Anyone have a solution ? Link to comment Share on other sites More sharing options...
bbsandro Posted April 13, 2013 Share Posted April 13, 2013 The same problem for me, is there a solution for presta 1.5 ? Link to comment Share on other sites More sharing options...
allar Posted May 1, 2013 Share Posted May 1, 2013 It would be a great feature to use. Is there any solution available? Link to comment Share on other sites More sharing options...
levvout Posted May 7, 2013 Share Posted May 7, 2013 Hi, I tried the rocky´s code, but I cant find that code in product.php so the first of the manual is obstacle for me I have 1.4.5.1 can somebody help please? In 1.5.3 is similar code in controllers/ProductController.php... Link to comment Share on other sites More sharing options...
jorgeferpas Posted June 5, 2013 Share Posted June 5, 2013 (edited) The same problem for me, is there a solution for presta 1.5 ? As far as I know, the solution posted in this topic works for presta 1.5 (I am using 1.5.3.1 and at the moment it works nice, but I have to say I just started adding the first row of products (10 products)). Is there some way I can use the product_attribute and product_attribute_combination tables instead? Please help! The only think I can suggest to you is re-generating the combinations with the combinations generator after duplicating a product. It will make your work a little slower but it will work. You have to think that every attribute value has a price impact for each product, which is generated at the moment you click on the "Generate these combinations" button. Checking if the price impacts of each attribute value corresponds to a certain product is mandatory, as it's the only way to avoid the repeated price impacts. Well, if someone knows how to modify the Duplicate product function and make it to check the attributes of the duplicated product and duplicate them with the new product ID, it will solve your problem, but until that person arrives and posts his/her solution, I'm afraid you will have to re-generate them manually. Edited June 5, 2013 by jorgeferpas (see edit history) Link to comment Share on other sites More sharing options...
Abhishek Gupta Posted June 26, 2013 Share Posted June 26, 2013 Hello people I am looking to print the final price (after including impact and specific discount rules) in front of every combination in PS 1.5.4.1 Please let me how is it possible ? Link to comment Share on other sites More sharing options...
kychd Posted July 4, 2013 Share Posted July 4, 2013 (edited) Hello people I am looking to print the final price (after including impact and specific discount rules) in front of every combination in PS 1.5.4.1 Please let me how is it possible ? In \controllers\front\ProductController.php - after $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name']; add $groups[$row['id_attribute_group']]['name_price'][$row['id_attribute']] = array('name' => $row['attribute_name'],'price' => $row['price']); in product.tpl - {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} {foreach from=$group.name_price key=id_attribute item=group_attribute} Name - {$group_attribute.name|escape:'htmlall':'UTF-8'} Price - {$price+$group_attribute.price} {/foreach} {/if} {/foreach} Edited July 4, 2013 by kychd (see edit history) 2 Link to comment Share on other sites More sharing options...
Abhishek Gupta Posted July 5, 2013 Share Posted July 5, 2013 In \controllers\front\ProductController.php - after $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name']; add $groups[$row['id_attribute_group']]['name_price'][$row['id_attribute']] = array('name' => $row['attribute_name'],'price' => $row['price']); in product.tpl - {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} {foreach from=$group.name_price key=id_attribute item=group_attribute} Name - {$group_attribute.name|escape:'htmlall':'UTF-8'} Price - {$price+$group_attribute.price} {/foreach} {/if} {/foreach} Hello Kychd I did the changes but its showing zero in front of all the combinations. here is the screenshot for the reference. Link to comment Share on other sites More sharing options...
kychd Posted July 5, 2013 Share Posted July 5, 2013 Hello Kychd I did the changes but its showing zero in front of all the combinations. here is the screenshot for the reference. For my PrestaShop 1.5.4.1 everything works fine. Check all. In \controllers\front\ProductController.php - after 418 line. Check the prices in the admin panel. Link to comment Share on other sites More sharing options...
Abhishek Gupta Posted July 17, 2013 Share Posted July 17, 2013 (edited) For my PrestaShop 1.5.4.1 everything works fine. Check all. In \controllers\front\ProductController.php - after 418 line. Check the prices in the admin panel. Hello I did so but its still not working Edited July 17, 2013 by Abhishek Gupta (see edit history) Link to comment Share on other sites More sharing options...
moy2010 Posted May 5, 2014 Share Posted May 5, 2014 Hi, Jigesh. I've followed your instructions in PS 1.6 (AFAIK it doesn't change that much from PS 1.5XX) but it didn't work :S. Have you already tried it in this PS version? Thanks in advance. Link to comment Share on other sites More sharing options...
Kevto Posted July 10, 2014 Share Posted July 10, 2014 (edited) Add an override class of Attribute and place it into /override/classes/ class Attribute extends AttributeCore { public static function getImpactPrice($id = null) { if(!$id) return ''; else { $sql = 'SELECT ai.price FROM '._DB_PREFIX_.'attribute_impact ai WHERE ai.id_attribute = '.(int)$id; $result = Db::getInstance()->getValue($sql); if($result) return $result; else return ''; } } public static function getImpactPrices() { $sql = 'SELECT ai.price, ai.id_attribute FROM '._DB_PREFIX_.'attribute_impact ai'; $result = Db::getInstance()->executeS($sql); return $result; } Add another override class of ProductController and place it into /override/controllers/front/ class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); $this->context->smarty->assign(array( 'attribute_impacts' => Attribute::getImpactPrices() )); } } After adding the override classes, make sure you delete: /cache/class_index.php so Prestashop recognizes that it should search for override classes in the override folders. Goto your theme folder and edit product.tpl and search for the following: {$group_attribute|escape:'htmlall':'UTF-8'} In certain cases it might be (such as in the default theme of prestashop 1.6.0.8): {$group_attribute|escape:'html':'UTF-8'} Replace it with: {$group_attribute|escape:'htmlall':'UTF-8'} {foreach from=$attribute_impacts key=idattribute item=ai} {if $ai.id_attribute == $id_attribute} - {convertPrice price=$ai.price} {/if} {/foreach} It should look like the following: http://i.imgur.com/iKb9Hby.png I hope it does help a few people out. It's made for PrestaShop 1.6.0.8. I don't know if it works for previous versions. I know it's an old post and that I'm bumping it to the max but it seems that people are struggling with it and this one will also allow you to update PrestaShop without losing this tiny feature. If anyone else runs into a problem with the same thing, feel free to contact me through private messages or this topic. I checked ''Follow this topic'' Edited July 11, 2014 by Kevto (see edit history) 2 Link to comment Share on other sites More sharing options...
cswett Posted July 10, 2014 Share Posted July 10, 2014 This is excellent! I'm close to implementing this change. Running a fresh install of 1.6.0.8 I created the two class files.... however, in the themes/default-bootstrap/product.tpl file, I can't find a line: {$group_attribute|escape:'htmlall':'UTF-8'} closest is: ="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option> found from the group here: <div class="attribute_list"> {if ($group.group_type == 'select')} <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option> {/foreach} Am I looking in the wrong place? Looking forward to getting this working. Thanks for the help! Thanks Casey Link to comment Share on other sites More sharing options...
cswett Posted July 10, 2014 Share Posted July 10, 2014 I also found this further towards the bottom on the product.tpl So the {$groupName|escape:'html':'UTF-8'} without "htmlall" is listed in three places within the file. What should I change? Unsure at this point as I couldn't find an exact match to the text posted. {foreach from=$group.attributes key=id_attribute item=group_attribute} <li> <input type="radio" class="attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} /> <span>{$group_attribute|escape:'html':'UTF-8'}</span> </li> {/foreach} Thanks,Casey Link to comment Share on other sites More sharing options...
Kevto Posted July 11, 2014 Share Posted July 11, 2014 (edited) I also found this further towards the bottom on the product.tpl So the {$groupName|escape:'html':'UTF-8'} without "htmlall" is listed in three places within the file. What should I change? Unsure at this point as I couldn't find an exact match to the text posted. {foreach from=$group.attributes key=id_attribute item=group_attribute} <li> <input type="radio" class="attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} /> <span>{$group_attribute|escape:'html':'UTF-8'}</span> </li> {/foreach} Thanks, Casey Hey Casey, I received your private messages and the file extensions should be .php Correct, there should be three times the following in your product.tpl which display the name of the attribute. However there could be more due the title HTML attribute. {$group_attribute|escape:'html':'UTF-8'} Below you will have a more precise piece that'd need to replace to prevent tiny accidents <span>{$group_attribute|escape:'html':'UTF-8'}</span> >{$group_attribute|escape:'html':'UTF-8'}</option> And you should only replace the following piece of those two from above: {$group_attribute|escape:'html':'UTF-8'} Make sure you delete the following file to make the override classes work: /cache/class_index.php Hope to hear feedback from you soon. As last resort I could modify product.tpl for you. Edited July 11, 2014 by Kevto (see edit history) Link to comment Share on other sites More sharing options...
cswett Posted July 11, 2014 Share Posted July 11, 2014 (edited) I made the changes. Made certain that I had the two class files created. Deleted the class_index.php. Upon refreshing the website page the class_index.php was recreated. Opening it, I could find where both the Attribute.php and ProductController.php were now referenced within.However, when navigating the cart and checking various products, I still don't see any difference yet. The dropdown lists of combinations are still just the options that are normally there for my combinations and no prices added next to them.I added both a couple dropdown combinations and radio buttons and neither appear to be reacting to this.I attached a picture of part of the product.tpl file. Maybe I have the indents wrong or something else? Perhaps if you do have a product.tpl file that I can try? No errors though at least.... So so close... Edited July 11, 2014 by cswett (see edit history) Link to comment Share on other sites More sharing options...
Kevto Posted July 14, 2014 Share Posted July 14, 2014 (edited) You're using the default theme aren't you? I'm using a different theme and if that's so, I will try it out on the default theme as well and if it works which I assume it does, I will send you my product.tpl okay? Sorry for the late response, had a fun weekend Edited July 14, 2014 by Kevto (see edit history) 1 Link to comment Share on other sites More sharing options...
cswett Posted July 14, 2014 Share Posted July 14, 2014 (edited) Yes, I'm using the default theme. That sounds great. I to had a fun weekend too lol Edited July 14, 2014 by cswett (see edit history) Link to comment Share on other sites More sharing options...
Kevto Posted July 15, 2014 Share Posted July 15, 2014 All right. I will be working on it right now. I will most likely reply back within an hour or maybe two. Link to comment Share on other sites More sharing options...
Kevto Posted July 15, 2014 Share Posted July 15, 2014 I couldn't test it myself. It seems that I keep screwing up my database if I reinstall the default prestashop theme. With the override classes and this file in the attachment, it should work. product.zip Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted August 4, 2014 Share Posted August 4, 2014 Hi to all, I need to show the unit price for product combination .. ? how can i do it help me.. ? If select the any attribute for the product ex : color , i need to show the price of the product as unit price impact how can i do it.. Link to comment Share on other sites More sharing options...
Reags Posted August 12, 2014 Share Posted August 12, 2014 hi i need to substrate rs 2000 form total amount displayed in cart. and i need to display the result value after subtracting. how to do that can any one help me to do this ?. Some thing like the screen shot which i have attached below Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted August 13, 2014 Share Posted August 13, 2014 Hi reags in which place you have substract rs 2000 , whether rs 2000 subtract is for all the product and how ar you going to substract for all the products.. ? Link to comment Share on other sites More sharing options...
chaitu Posted December 11, 2014 Share Posted December 11, 2014 Hi iam new to prestashop and iam developing the jewellery site.So in product page its showing cost of total but ia also want the sprcific attibute price to be shown on that page pls can any one help me Link to comment Share on other sites More sharing options...
Gush Posted October 19, 2015 Share Posted October 19, 2015 Add an override class of Attribute and place it into /override/classes/ class Attribute extends AttributeCore { public static function getImpactPrice($id = null) { if(!$id) return ''; else { $sql = 'SELECT ai.price FROM '._DB_PREFIX_.'attribute_impact ai WHERE ai.id_attribute = '.(int)$id; $result = Db::getInstance()->getValue($sql); if($result) return $result; else return ''; } } public static function getImpactPrices() { $sql = 'SELECT ai.price, ai.id_attribute FROM '._DB_PREFIX_.'attribute_impact ai'; $result = Db::getInstance()->executeS($sql); return $result; } Add another override class of ProductController and place it into /override/controllers/front/ class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); $this->context->smarty->assign(array( 'attribute_impacts' => Attribute::getImpactPrices() )); } } After adding the override classes, make sure you delete: /cache/class_index.php so Prestashop recognizes that it should search for override classes in the override folders. Goto your theme folder and edit product.tpl and search for the following: {$group_attribute|escape:'htmlall':'UTF-8'} In certain cases it might be (such as in the default theme of prestashop 1.6.0.8): {$group_attribute|escape:'html':'UTF-8'} Replace it with: {$group_attribute|escape:'htmlall':'UTF-8'} {foreach from=$attribute_impacts key=idattribute item=ai} {if $ai.id_attribute == $id_attribute} - {convertPrice price=$ai.price} {/if} {/foreach} It should look like the following: http://i.imgur.com/iKb9Hby.png I hope it does help a few people out. It's made for PrestaShop 1.6.0.8. I don't know if it works for previous versions. I know it's an old post and that I'm bumping it to the max but it seems that people are struggling with it and this one will also allow you to update PrestaShop without losing this tiny feature. If anyone else runs into a problem with the same thing, feel free to contact me through private messages or this topic. I checked ''Follow this topic'' Hi, thank you so much for your help. I tried this, I overrided the class and front controller but the array come void in the product.tpl, I check the array in product.tpl with {$attribute_impacts|@debug_print_var} and "null" value is printed. I´m using prestashop 1.6.1.1 Best regards. Link to comment Share on other sites More sharing options...
jmeca Posted November 21, 2015 Share Posted November 21, 2015 Don't work for me i'm using ps 1612. Don't urdenstand how a basically option in other ecoomerce here is too dificult. I have shops in Zencart for example since more than 10 years and this option was already included Link to comment Share on other sites More sharing options...
Nerloggz Posted August 30, 2016 Share Posted August 30, 2016 I found out the problem : there's a missing } at the end of the Attribute code, and don't forget to add <?php at the start and ?> at the end of both Attribute et ProductController files Link to comment Share on other sites More sharing options...
hakeryk2 Posted November 4, 2016 Share Posted November 4, 2016 (edited) I need to bump this thread because I think it will be easier to add this value via javascript. Let me explain what I mean - If You can click on attribute and then the price is changing so the javascript variable needs to know those values so I think they can be easly added by some jquery statement. Maybe someone can look up into this? I tried but I failed. When I tried to use Kevto solution I am getting this thing, like multiple items Edit: My solution for my error was this: Attritbute.php in override/classes <?php class Attribute extends AttributeCore { public static function getImpactPrices($id = null) { $sql = 'SELECT ai.price, ai.id_attribute FROM ' . _DB_PREFIX_ . 'attribute_impact ai WHERE ai.id_product = '.(int)$id; $result = Db::getInstance()->executeS($sql); return $result; } } ProductController.php in override/controlers/front class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); $this->context->smarty->assign(array( 'attribute_impacts' => Attribute::getImpactPrices($this->product->id) )); } } in product.tpl in the same place where kevto posted {foreach from=$attribute_impacts key=idattribute item=ai} {if $ai.id_attribute == $id_attribute && $ai.price != 0} + {convertPrice price=$ai.price} {/if} {/foreach} and now it is working properly on 1.6.1.4 but I have another question: how to show value if the attribute has impact with percent? EDIT: Note that those values are not showing price with tax so You can multiply the value by your contry tax value ie: + {convertPrice price=$ai.price*1.23} Edited December 28, 2016 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
FoodAssets Posted September 27, 2017 Share Posted September 27, 2017 (edited) Does not work for 1.6.1.2. This version of prestashop does not store the attribute prices in the attribute_impact table, there are no price values in there at all. Those appear to be stored in the product_attribute table. I've fiddled around with changing the sql query, but it's clear that several other changes are required to the classes, controllers and tpl. And that's where I got lost. This is a hugely critical function if anyone wants to use attributes that have different prices - and appears to be a deliberate by the developers so that you are forced to buy a module to handle this. Who would write code that does NOT show the prices in the selection when a customer is selecting an attribute? It's absolutely nuts. Edited September 28, 2017 by FoodAssets (see edit history) Link to comment Share on other sites More sharing options...
FoodAssets Posted September 28, 2017 Share Posted September 28, 2017 attribute_impact appears to be for storing the range of price or weight changes, it does not store the actual price or weight - it stores the value of how much it is supposed to change - as far as I can tell, but I'm no expert on this. We did some testing - there is no way to update the attribute_impact price after it has first been created. This cannot be done in back office or in Shop Manager. We used Shop Manager to create the groups, the attributes and the combination generator. This created a record in the attribute_impact table with the range of prices, but we were completely unable to update those prices in Shop Manager - or the back office - making this table utterly useless if you cannot change the values it holds. What we need is to have the select drop-down list show the attributes and the actual price of the attribute. Code samples in this thread do not do this for v1.6.1.2 Link to comment Share on other sites More sharing options...
tapukatata Posted May 22, 2018 Share Posted May 22, 2018 Does anyone know how I can display the Impact on price below radio buttons? As shown on the video: https://streamable.com/lolz9 I am using Prestashop 1.7.3.0 Link to comment Share on other sites More sharing options...
tapukatata Posted September 20, 2018 Share Posted September 20, 2018 I need help. I have changed the codes in few files but when there are more than 2 combinations with more than 2 impact on the price I have that nasty result: (please check the screenshot) Here are the files with what is removed or added: File 1: /themes/panda/templates/catalog/_partials/product-variants.tpl - Changes: https://www.diffchecker.com/OqyIJUUQ File 2: /controllers/front/ProductController.php - Changes: https://www.diffchecker.com/m1DtIhfo File 3: /classes/Product.php - Changes: https://www.diffchecker.com/UwrgJ3fn I hope that anyone can help me to resolve the problem. Link to comment Share on other sites More sharing options...
hakeryk2 Posted September 24, 2018 Share Posted September 24, 2018 @up I am trying to figure this out since long time ago and I think that the only way to achieve this is through js and combinations variable available in front. Link to comment Share on other sites More sharing options...
lipo999 Posted November 1, 2018 Share Posted November 1, 2018 Hello All, I try all here, nothing works. Presta 1.6. I need to show % amount on each attribute. (I have set up Special price (%) for some combinations) Could someone help? Thank you Link to comment Share on other sites More sharing options...
yagnik.ynj Posted March 7, 2019 Share Posted March 7, 2019 Hi Friends, Prestashop Version 1.7.5.1 As per my client's requirement, I need to display color(Attribute) code instead of value into shopping cart page. For that please see attached screenshot. Please suggest me, how can i implement into cart page ? Link to comment Share on other sites More sharing options...
Prestaweb.org Posted March 7, 2019 Share Posted March 7, 2019 5 hours ago, yagnik.ynj said: Hi Friends, Prestashop Version 1.7.5.1 As per my client's requirement, I need to display color(Attribute) code instead of value into shopping cart page. For that please see attached screenshot. Please suggest me, how can i implement into cart page ? you need to modificate code in OrderController.php and shopping-cart-product-line.tpl Link to comment Share on other sites More sharing options...
yagnik.ynj Posted March 8, 2019 Share Posted March 8, 2019 17 hours ago, Prestaweb.org said: you need to modificate code in OrderController.php and shopping-cart-product-line.tpl I already check into CartController.php and OrderController.php. In that, there is only we got attribute lable like "Color" and value like "Red/Black, etc". But instead of color value, i need to show it's color code. is there any way to get color value into "shopping-cart-product-line.tpl" this file ? Link to comment Share on other sites More sharing options...
Pedro73 Posted July 29, 2019 Share Posted July 29, 2019 On 9/24/2018 at 1:54 PM, hakeryk2 said: @up I am trying to figure this out since long time ago and I think that the only way to achieve this is through js and combinations variable available in front. Hi hakeryk2. Do you know how to do it already? Everything I'm trying, doesn't work. Prestashop 1.6.1.19 Thanks! Link to comment Share on other sites More sharing options...
hakeryk2 Posted July 29, 2019 Share Posted July 29, 2019 Nope, I just gave up. I made different things like these: or this 1 Link to comment Share on other sites More sharing options...
Pedro73 Posted July 29, 2019 Share Posted July 29, 2019 13 minutes ago, hakeryk2 said: Nope, I just gave up. I made different things like these: or this Ok. Thanks anyway 👍 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