Hello,

This looks like a great module. I'd really like to use it but I haven't gotten very far with my php lessons yet. :)

What I want to do is to set it up so that the product price is $6.50 and each additional is $5.00. So if you're buying two, the total price is going to be be $6.50+5.00=$11.50.

Does this code look like it would work?

$item->price = $item->price+[[quantity]-1]*5;

In case my php is more horrible than I think, it's supposed to subtract 1 from the quantity, multiply that by 5, then add it to the price. So a quantity of 3 would be: price + (3-1)*5.

Thanks!

Comments

freelock’s picture

Hi,

Quantity is $item->qty . If you have the devel module enabled, you can learn a lot by adding this to your custom price: dpm($item);

So I would rewrite your code to:

$item->price = 1.50 + ($item->qty * 5);

Cheers,
John

amysragbag’s picture

Thanks John!

tr’s picture

Status: Active » Fixed

This question was answered.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.