1

Including every special price, tier price, costumer group price, catalog discount, cart discount and what ever else might have changed the price. Just what the customer is actually paying and printed on the bill. Right now I got

$product->getFinalPrice()

But that does not include the coupons. This supposed to include coupons but is empty for me:

Mage::getModel('catalogrule/rule')->calcProductPriceRule($product,$product->getPrice());

BTW: I am in an observer attached to the sales_order_save_after event.

My current workaround is to read discount_description and apply the discount manually:

if (strcasecmp($order['discount_description'], 'WELCOME') == 0)
{
     $item->price = round($product->getFinalPrice() * 0.9, 2);
}

But this is ugly and you need to implement this for each discount.

Update

I couldn't find the correct price or any product information in $order->debug() so I am calling $quote->getItemsCollection()->getItems().

  • 1
    Can you add some (shortend) dump of the order object you receive in the event? All the information which Magento has should be there. Be aware that in some cases you can not really specify a price which is actually paid for an item by the customer when there are complex / multiple rules. The discount is for the cart, not for specific products. – Alex Oct 13 '13 at 20:10
1

Following Alex comment I created a dumped of the products

$items = $quote->getItemsCollection()->getItems();
foreach ($items as $order_item)
{
    Mage::Log($order_item->debug());
}

There I found many fields with the prices but none of them was correct. Finally I calculated the price from here like this: $order_item['row_total_incl_tax'] - $order_item['discount_amount'].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.