Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Trying to add the price prefix '='


jtmace

Recommended Posts

Posted

Right now oscommerce is using only two price prefixes for product options, '+' and '-'.

 

I need my product options to not add to or subtract from the price, but to just totally reset the price all together. the line of code oscommerce uses to handle the product attributes is in the shopping cart class within /catalog/includes/classes/shopping_cart.php.

 

here it is:

if ($attribute_price['price_prefix'] == '+') {

             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

} else {

             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

}

 

my addition had added the '=' prefix. here it is:

if ($attribute_price['price_prefix'] == '+') {

             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

} 

if ($attribute_price['price_prefix'] == '-'){

             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

}

if ($attribute_price['price_prefix'] == '='){

             $this->total = $this->total + ($qty * tep_add_tax( $attribute_price['options_values_price'],$products_tax));

}

 

im getting some strange issues tho.. it says that the total is the price of the last item in the cart. I figured that i wasnt including the total the calculations the way that the += and -= operators were so i decided to add go with total = total + ($qty + tep_add_tax(...))..

 

if ($attribute_price['price_prefix'] == '='){

 $this->total = ($this->total + ($qty * tep_add_tax( $attribute_price['options_values_price'],$products_tax)));

}

 

but it still craps out... it just adds the first item in the cart X number of times, where X is the number of items in the cart..

 

I would be so greatful if someone could help me out on this..

 

Thanks in advance for any help you can provide.

Jason Mace

 

P.S. Its just the sub-total on the check out screen that is messed up. The actual order total is correct after you check out.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...