I'm looking to have a pricing table (on the frontpage) for one specific product, but 3 different (predefined) quantities.
Showing the product and having the correct add to cart links on the page was relatively easy:
$_productId = '498';
$_product = Mage::getModel('catalog/product')->load($_productId);
$_url = Mage::helper('checkout/cart')->getAddUrl($_product);
Getting the Qty 1 price including tax, currency and some formatting was easy as well:
$_price = Mage::helper('core')->currency(Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice()));
This results in <span class="price">€15,00</span>
However, my goal is to have a pricing table like:
┌───────────┬───────────┬───────────┐
│ Single │ ValuePack │ FamilyPack│
├───────────┼───────────┼───────────┤
│ €15 │ €10 │ €7.50 │
├───────────┼───────────┼───────────┤
│ Qty 1 │ Qty 5 │ Qty 10 │
└───────────┴───────────┴───────────┘
Getting the Qty * X price wasn't hard either:
$_qty = 5;
$_price = Mage::helper('core')->currency(Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice($_qty)));
As expected, this results in <span class="price">€10,00</span>
However, even though I change $_qty, the output of the other 2 prices is always the same as the first.
Illustration:
$_price_1 = Mage::helper('core .... $_product->getFinalPrice(1)));
results in €15
$_price_2 = Mage::helper('core .... $_product->getFinalPrice(5)));
results in €15
as well
$_price_3 = Mage::helper('core .... $_product->getFinalPrice(10));
results in €15
as well
I'm assuming this has something to do with Magento caching the product price after the first lookup.
Anybody got a clue on how to create this table the correct way?