This question has sort-of been asked over here: https://stackoverflow.com/questions/8254682/magento-getting-discounted-price
I need to get the price of a product AFTER Shopping Cart Price Rules have been applied. I need the price on the checkout confirmation (success) page.
For example, product A costs 9.90. I apply a discount code discount of 50%. The price is now 4.95. I pay and checkout. On the order confirmation page, I need to retrieve the price.
I've tried:
Mage::getModel('catalogrule/rule')->calcProductPriceRule($prod, $prod->getPrice());
And...
Mage::getModel('catalogrule/rule')->calcProductPriceRule($prod
->setStoreId($this->getCurrentStoreId())
->setCustomerGroupId($this->getCurrentCustomerGroupId()),
$prod->getPrice()
);
But it always returns null. Can I achieve this without rewriting the whole logic of the rules?
I'm developing a local module for this and using Magento 1.7.0.2 CE. Thank you.
~ edit ~
The meat and potatoes of my code looks as follows:
public function getLatestOrder()
{
$order = Mage::getModel('sales/order')->getCollection()
->addAttributeToSelect('*')
->setOrder('entity_id', Varien_Data_Collection::SORT_ORDER_DESC)
->getFirstItem();
return $order;
}
// iterate as follows:
$items = $this->getLatestOrder()->getAllVisibleItems();
foreach ($items as $item) {
echo $item->getPrice();
}
The value for $item->getPrice();
is the full price for each item, even though a 99.9% discount voucher was applied.