View Single Post
  #2  
Old 01-10-2011, 07:50 AM
 
frgsBC frgsBC is offline
 

Member
  
Join Date: Apr 2010
Posts: 22
 

Default Re: Percentage Price Modifier to discount other price modifiers?

I seem to have worked it out, below is the necessary modifictaion if anybody else needs to do this.

File : include/func/func.cart.php around line 2700

Change from
Code:
foreach($product_options as $o) { $products_array['options_surcharge'] += ( $o['modifier_type'] == '%' ? ($products_array['price'] * $o['price_modifier'] / 100) : $o['price_modifier'] ); }

To this
Code:
foreach($products_array['product_options'] as $o) { if($o['modifier_type'] != '%') $products_array['options_surcharge'] +=$o['price_modifier']; } foreach($products_array['product_options'] as $o) { if($o['modifier_type'] == '%') { $products_array['options_surcharge'] += ($products_array['options_surcharge'] * $o['price_modifier']) / 100; $products_array['options_surcharge'] += ($products_array['price'] * $o['price_modifier']) / 100; } }

The change I have made is instead of doing all the modifiers at once, it now does the absolute modifiers first, followed by price modifiers.
__________________
X-Cart version 4.3.0 <-- some sites I look after
X-Cart Version 4.4.0 < -- some other sites i look after
Reply With Quote