Help with PHP coding for a shopping cart?

j k

New member
I have a customer who has an Oscommerce store that wants to give someone who orders 2 or more items $2 off each item.

This is the code I'm using, and it works, except that it doesn't take the whole order into account. If I order 3 items, it gives me
a $4 discount instead of $6. It's 2 bucks off no matter what I do.

if ($cart->count_contents() > 0) { // cart contents
$cart_total = $cart->show_total();
if ($cart->count_contents() > 0) $easy_discount->set('CART','Order Quantity Discount',0.00);
if ($cart->count_contents() > 1) $easy_discount->set('CART','Order Quantity Discount',2.00);
if ($cart->count_contents() > 2) $easy_discount->set('CART','Order Quantity Discount',4.00);
if ($cart->count_contents() > 3) $easy_discount->set('CART','Order Quantity Discount',6.00);
if ($cart->count_contents() > 4) $easy_discount->set('CART','Order Quantity Discount',8.00);
if ($cart->count_contents() > 5) $easy_discount->set('CART','Order Quantity Discount',10.00);

I'm ready to throw my computer out of the window.

Any PHP guru's have an idea of what I need to do?

Thank you.
Thanks Shaun. I'm not a programmer at all. While I get what you're trying to say I have no clue how to implement it.
 
Do do not get your language but here is the psudo. if items = 1 then discount = 0 else if items >= 2 then discount = 4 + 2( items - 2) then create and output display line of code.
 
Back
Top