Jump to content
Tomas LT

Show Combination Price Impact On Product Page

Recommended Posts

I'd like to show the price impact right beside the combination selector (a radio button or dropdown list) so the user can quickly make decisions.

 

Can anyone help me? Thanks

Share this post


Link to post
Share on other sites

One way to do this is to change the name of the attribute accordingly. This works well as long as you don't have thousands of products that require this approach.

 

Say, for example, you want to offer 4 variations of the movie "The Matrix".

 

You could create an attribute group called: The Matrix Options. Within that group, create 4 attributes named:

- Blueray - $19.99

- DVD - $14.99

- VHS - $4.99

- Betamax - $0.99

 

Then, in the product for "The Matrix", create your combination products using this attribute group. That will give you 4 combination products and the select list will contain the text (AND price) spelled out in the name of each attribute. You then change the price impact aspect of each combination product to yield the price shown in the select list. The downside is that if you change prices, you also have to change the attributes' names to match the new prices.

 

Worst case scenario, you could create an attribute for every product SKU you have. More likely, some products may require this approach and can be grouped to use a shared attribute group while others will require dedicated attributes.

 

I use explicit attributes like this when I have a family of products with a range of prices that I want to lump into one product page. Then, insert a table within the product description outlining the specific characteristics of each product within the family.

Share this post


Link to post
Share on other sites

I found solution.

 

1)/controllers/front/ProductController.php

at line 439 add:

 

 $groups[$row['id_attribute_group']]['name_price'][$row['id_attribute']] = array('name' => $row['attribute_name'],'price' => $row['price']);

 

 

 

2)/themes/YOUR_THEME/product.tpl

 

at ~345 line find : {if ($group.group_type == 'select')}

 

and replace code with this:

 

<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print">
                                                            
{foreach from=$group.name_price 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.name|escape:'html':'UTF-8'}">{$group_attribute.name|escape:'html':'UTF-8'} {if $group_attribute.price>0}+{/if}{if $group_attribute.price!=0}
 {$price_with_tax = $group_attribute.price + ($group_attribute.price*($tax_rate/100))}
 {if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}
{$price_with_tax = $price_with_tax - ($price_with_tax*$product->specificPrice.reduction)}
{/if}
{convertPrice price=$price_with_tax}
 {/if}
 </option>
{/foreach}
</select>

 

 

Price showing with tax and discount.

Edited by Tomas LT (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

I found solution.

 

1)/controllers/front/ProductController.php

at line 439 add:

 

 $groups[$row['id_attribute_group']]['name_price'][$row['id_attribute']] = array('name' => $row['attribute_name'],'price' => $row['price']);

 

 

 

2)/themes/YOUR_THEME/product.tpl

 

at ~345 line find : {if ($group.group_type == 'select')}

 

and replace code with this:

 

<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print">

                                                            

{foreach from=$group.name_price 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.name|escape:'html':'UTF-8'}">{$group_attribute.name|escape:'html':'UTF-8'} {if $group_attribute.price>0}+{/if}{if $group_attribute.price!=0}

 {$price_with_tax = $group_attribute.price + ($group_attribute.price*($tax_rate/100))}

 {if $product->specificPrice && $product->specificPrice.reduction_type == 'percentage'}

{$price_with_tax = $price_with_tax - ($price_with_tax*$product->specificPrice.reduction)}

{/if}

{convertPrice price=$price_with_tax}

 {/if}

 </option>

{/foreach}

</select>

 

 

Price showing with tax and discount.

your code is logique ;)

Share this post


Link to post
Share on other sites

It will won't work if there is more then 1 group of attributes. Does anyone know how to achieve this using product.js?

It is for the moment probably the best option to do this.

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.

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