I had a custom template done but the didn't put the price on the product page for some reason. How can i edit the template to show the price.
I have looked at the addtocart.phtml file but I cant figure out how to add the price variable for the product.
Solved! Go to Solution.
It cannot show just from itself. You need to print in to the screen. In the last example, use:
Price: <?php echo Mage::helper('core')->currency($_product->getFinalPrice(),true,false); ?>
Template used for rendering prices can be located on few places, and it depends a lot on configured fallback scheme. This is one example how it could look:
- app/design/frontend/{package}/{theme}/template/catalog/product/price.phtml
- app/design/frontend/{package}/default/template/catalog/product/price.phtml
- app/design/frontend/rwd/default/template/catalog/product/price.phtml
- app/design/frontend/base/default/template/catalog/product/price.phtml
{package} - represents your active package where theme belongs
{theme} - represents your active theme
You'll probably easily figure out this once you enter app/design/frontend directory.
Also, those price templates are usually included from:
- app/design/frontend/{package}/{theme}/template/catalog/product/view/type/default.phtml
or
- app/design/frontend/{package}/{theme}/template/catalog/product/view/type/grouped.phtml
(for grouped product only).
The same rule exists here, too: If template file is not found, it goes further down the fallback scheme.
// Get product ID
$_productId = 52;
$_product = Mage::getModel('catalog/product')->load($_productId);
Get Actual Price
// without currency sign
$_actualPrice = $_product->getPrice();
// with currency sign
$_formattedActualPrice = Mage::helper('core')->currency($_product->getPrice(),true,false);
Get Special Price
// without currency sign
$_specialPrice = $_product->getFinalPrice();
// with currency sign
$_formattedSpecialPrice = Mage::helper('core')->currency($_product->getFinalPrice(),true,false);
Thanks , I have tried this
When i use actual price it works but doesnt show as currency. it shows as 20.000
When i try to use the one you showed as currency
$_formattedActualPrice = Mage::helper('core')->currency($_product->getPrice(),true,false);
e);
it doesnt work.
HI
Did you tried following code
$_formattedSpecialPrice = Mage::helper('core')->currency($_product->getFinalPrice(),true,false);
When I do that nothing shows up in the page.
I have
Price: <?php $_formattedSpecialPrice = Mage::helper('core')->currency($_product->getFinalPrice(),true,false); ?>
And all you can see is Price:
It cannot show just from itself. You need to print in to the screen. In the last example, use:
Price: <?php echo Mage::helper('core')->currency($_product->getFinalPrice(),true,false); ?>
Yes, that solved the problem. Sorry, I forgot that this is on a html page and needed an echo to output the code. (not a programmer)