Jump to content
AdaminCA

Variable to Display Attribute Price

Recommended Posts

Hi,

Does anyone know what variable I would use in the product.tpl template to display the price impact of an attribute?

Thank you!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.00
Medium - +$3.00
Large - +$5.00
--------------------------------------

Drop down box 2
--------------------------------------
Green- +$0.00
Red - +$3.00
Blue - +$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

Share this post


Link to post
Share on other sites

I've sent you a private message with code. Let me know if it is what you want.

Share this post


Link to post
Share on other sites

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}

  • Like 2

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

12673_JWr2s40rR2NP4ONXjcha_t

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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"?

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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}

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.html

it 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 :(

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 B) it actually shows up properly for the products that have been creating by clicking 'duplicate' in the back office?

Share this post


Link to post
Share on other sites

Is there some way I can use the product_attribute and product_attribute_combination tables instead? Please help! :(

Share this post


Link to post
Share on other sites

No-one has any ideas? I'd really like to get this working and we seem tantilisingly close!

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

It would be a great feature to use. Is there any solution available?

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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 by jorgeferpas (see edit history)

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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 by kychd (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites
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 refereadg6dt.pngnce.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by Abhishek Gupta (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by Kevto (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by Kevto (see edit history)

Share this post


Link to post
Share on other sites

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?

 

post-815380-0-00332300-1405097598_thumb.jpg

Perhaps if you do have a product.tpl file that I can try?

 

 

No errors though at least.... So so close... :)

 

 

 

 

 

Edited by cswett (see edit history)

Share this post


Link to post
Share on other sites

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 by Kevto (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

All right. I will be working on it right now. I will most likely reply back within an hour or maybe two.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

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

post-827741-0-36464100-1407779730_thumb.jpg

Share this post


Link to post
Share on other sites

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.. ?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 

post-1146962-0-46736900-1478267214_thumb.jpg

 

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 by hakeryk2 (see edit history)

Share this post


Link to post
Share on other sites

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 by FoodAssets (see edit history)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 - Changeshttps://www.diffchecker.com/OqyIJUUQ

File 2: /controllers/front/ProductController.php  - Changeshttps://www.diffchecker.com/m1DtIhfo

File 3: /classes/Product.php  - Changeshttps://www.diffchecker.com/UwrgJ3fn

I hope that anyone can help me to resolve the problem.

image (3).png

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites


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 ?

 

Screenshot_1.png

Share this post


Link to post
Share on other sites
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 ?

 

Screenshot_1.png

you need to modificate code in OrderController.php and shopping-cart-product-line.tpl

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

Nope, I just gave up. I made different things like these:
 

or this 

 

  • Like 1

Share this post


Link to post
Share on other sites
13 minutes ago, hakeryk2 said:

Nope, I just gave up. I made different things like these:
 

or this 

 

Ok. Thanks anyway 👍

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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