$product->sell_price when there is a Dafault price attribute option

2 replies [Last post]
Joined: 09/26/2007
Juice: 167

hallo,
I have enabled an option that adds 2,00 euro to the product sell_price.
Now I have to calculate the shipping costs. I do this calculation simply with:

$total += $product->sell_price * $product->qty;

but I've noticed that $product->sell_price is not the total I see into the cart but is the product sell price without the "Default price" increment of the option, so the shipping cost is not well calculated.

how can I know the real price (sell price plus the option value that I've indicated into "Default price" field)?

thanks
nicola

Joined: 08/07/2007
Juice: 6673

You need to get the item as it exists in the cart, which you can do with something like this:

<?php
$items
= uc_cart_get_contents(); // Current user's cart.

foreach ($items as $item) {
 
$total += $item->price + $item->qty;
}
?>

The attribute module adds the chosen option price to the product's sell price when it is added to the cart.

Joined: 09/26/2007
Juice: 167

tahnks! now it works!
nicola