Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Show Price in Price Variant As Price

 
Reply
   X-Cart forums > X-Cart 4 > Changing design
 
Thread Tools Search this Thread
  #11  
Old 07-07-2014, 09:53 PM
 
Ben G Ben G is offline
 

Advanced Member
  
Join Date: Nov 2006
Posts: 100
 

Default Re: Show Price in Price Variant As Price

Awesome code Mike - Thanks! Works great in 4.6.3

Quote:
Originally Posted by Mike SSI
{math equation="price_modifier+current_price" price_modifier=$o.price_modifier current_price=$product.taxed_price format="%.2f" assign=total_variant_price}
{currency value=$total_variant_price plain_text_message=1}[/code]

The code above by totaltec works great but it doesn't show the cost of the first option in the list.

This code will show the cost of first option in list also:

{if $v.is_modifier eq 'Y' and $o.price_modifier ne 0}
 (
{if $o.modifier_type ne '%'}
{math equation="price_modifier+current_price" price_modifier=$o.price_modifier current_price=$product.taxed_price format="%.2f" assign=total_variant_price}
{currency value=$total_variant_price plain_text_message=1}
{*** disable orig code currency value=$o.price_modifier display_sign=1 plain_text_message=1***}
{else}
{$o.price_modifier}%
{/if}

{else}
 ({currency value=$product.taxed_price plain_text_message=1}
{/if}
)

Building on your code
  • to show actual calculated price instead of % modifier
  • to stop the incorrect prices showing in the variant drop downs (the last else statement made the base price show next to all variants [as opposed to product options])
you can use this :
Quote:
{* {if $v.is_modifier eq 'Y' && $o.price_modifier ne 0} *}
{if $v.is_modifier eq 'Y'}
 (
{if $o.modifier_type ne '%'}
{math equation="price_modifier+current_price" price_modifier=$o.price_modifier current_price=$product.taxed_price format="%.2f" assign=total_variant_price}
{currency value=$total_variant_price plain_text_message=1}
{* {include file="currency.tpl" value=$o.price_modifier display_sign=1 plain_text_message=1} *}
{else}
{* {$o.price_modifier}% *}
{math equation="price_modifier*current_price/100+current_price" price_modifier=$o.price_modifier current_price=$product.taxed_price format="%.2f" assign=total_variant_price}
{currency value=$total_variant_price plain_text_message=1}
{/if}
)
{/if}

Works in 4.6.3

Further if using Variants aswell as basic Product Options, Cheries Code works a treat :

Quote:
{foreach from=$variants item=vv}
{foreach from=$vv.options key=vvk item=vvo}
{if $o.optionid eq $vvk}
{include file="currency.tpl" value=$vv.taxed_price plain_text_message=1}

{/if}
{/foreach}
{/foreach}

You can combine both Mikes & Cheries code as follows and calculated prices will show in each of the product options and product variants.

Quote:
{* {if $v.is_modifier eq 'Y' && $o.price_modifier ne 0} *}
{if $v.is_modifier eq 'Y'}
 (
{if $o.modifier_type ne '%'}
{math equation="price_modifier+current_price" price_modifier=$o.price_modifier current_price=$product.taxed_price format="%.2f" assign=total_variant_price}
{currency value=$total_variant_price plain_text_message=1}
{* {include file="currency.tpl" value=$o.price_modifier display_sign=1 plain_text_message=1} *}
{else}
{* {$o.price_modifier}% *}
{math equation="price_modifier*current_price/100+current_price" price_modifier=$o.price_modifier current_price=$product.taxed_price format="%.2f" assign=total_variant_price}
{currency value=$total_variant_price plain_text_message=1}
{/if}
)
{/if}
{/strip}
{* Added to show calculated price in variants *}
{if $logged_userid gt 0 or $config.Appearance.hide_prices_if_no_login ne 'Y'}
{foreach from=$variants item=vv}
{foreach from=$vv.options key=vvk item=vvo}
{if $o.optionid eq $vvk}
(
{include file="currency.tpl" value=$vv.taxed_price plain_text_message=1}
)
{/if}
{/foreach}
{/foreach}
{/if}
{* Added to show calculated price in variants *}
</option>

I've got the code working now in 4.6.3 and it is also be working with BSCE Checkbox Radio Mod for Product Options (a little patching needed) and you can also put the same code into X-Cart Mobile Skin.

Now drop downs for product options and product variants look almost identical and each line has the final price rather than the modifier. Thanks to all for helping
__________________
Ben
X-Cart 4.6.6 Gold Plus - lots of modules
X-Cart 4.7.9 Gold Plus - lots of modules
Reply With Quote

The following user thanks Ben G for this useful post:
mcanitano (07-15-2014)
  #12  
Old 07-15-2014, 11:33 AM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default Re: Show Price in Price Variant As Price

Does the code from the above post work if you have multiple product option sets of variants?

i.e. Color and Size are two product option sets (both variant types).

We're having trouble implementing it into our v4.5.5 store

The "finish" set changes what color you would like the product to be, this actually has a price change. The "door style" set does not change price. [See attached image]
Attached Thumbnails
Click image for larger version

Name:	variants.png
Views:	31
Size:	3.3 KB
ID:	3830  
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote
  #13  
Old 07-19-2014, 08:41 PM
 
Ben G Ben G is offline
 

Advanced Member
  
Join Date: Nov 2006
Posts: 100
 

Default Re: Show Price in Price Variant As Price

Looks like it might need some more work.

I enabled multiple variants on a product and got similar result. Calculated price works but it shows the price of Variant Option 1 for both Variant Option 2a or 2b (all possible combinations).

I'll have a crack at it and see if we can solve.

Comment out this ;

Quote:
{*
{if $logged_userid gt 0 or $config.Appearance.hide_prices_if_no_login ne 'Y'}
{foreach from=$variants item=vv}
{foreach from=$vv.options key=vvk item=vvo}
{if $o.optionid eq $vvk}
(
{include file="currency.tpl" value=$vv.taxed_price plain_text_message=1}
)
{/if}
{/foreach}
{/foreach}
{/if}
*}

And it will hide the variant modifiers completely and only show the variant name.

Something to do with this code.
__________________
Ben
X-Cart 4.6.6 Gold Plus - lots of modules
X-Cart 4.7.9 Gold Plus - lots of modules
Reply With Quote

The following user thanks Ben G for this useful post:
mcanitano (07-21-2014)
  #14  
Old 07-21-2014, 10:37 AM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default Re: Show Price in Price Variant As Price

Quote:
Originally Posted by Ben G
Looks like it might need some more work.

I enabled multiple variants on a product and got similar result. Calculated price works but it shows the price of Variant Option 1 for both Variant Option 2a or 2b (all possible combinations).

I'll have a crack at it and see if we can solve.

Comment out this ;



And it will hide the variant modifiers completely and only show the variant name.

Something to do with this code.

Thinking of it from a coding stand point it seems this may become a little difficult/ugly with multiple variants. Keep us updated if you figure it out!
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote
  #15  
Old 08-15-2014, 06:23 AM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default Re: Show Price in Price Variant As Price

Any news on getting this to work?
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote
  #16  
Old 08-21-2014, 06:40 PM
 
Ben G Ben G is offline
 

Advanced Member
  
Join Date: Nov 2006
Posts: 100
 

Default Re: Show Price in Price Variant As Price

Not yet - still only works for one set of variants.
__________________
Ben
X-Cart 4.6.6 Gold Plus - lots of modules
X-Cart 4.7.9 Gold Plus - lots of modules
Reply With Quote
  #17  
Old 09-04-2014, 02:55 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default Re: Show Price in Price Variant As Price

I want to add Market Price and Our price options in variant.How to do that?
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
  #18  
Old 03-03-2015, 07:11 AM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default Re: Show Price in Price Variant As Price

Any updates on this?

Price Modifiers work way better for customers, but not keeping inventory/having specific Sku's is not helpful for us.
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:17 PM.

   

 
X-Cart forums © 2001-2020