Today we have been working on a Magento E-commerce website where the client wanted to display the word ‘FREE’ if the product was £0.00. Magento by default doesn’t support this, so some changes to the code needed to be made including the product and category files.
In Magento version 1.5.0.1 you’ll need to edit two files.
app/design/frontend/default/your_theme/template/catalog/product/price.phtml – Line 189
<span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php if( $_coreHelper->currency($_price,true,true) == '<span class="price">£0.00</span>'){ echo '<span class="price">FREE</span>'; }else{ echo $_coreHelper->currency($_price,true,true); } ?> </span>
app/design/frontend/default/your_theme/template/catalog/product/view/type/default.phtml – Line 36
<?php if($_product->price==0): ?> <?php echo '<div class="price-box"><span class="regular-price"><span class="price">FREE</span></span></div>'; ?> <?php else: ?> <?php echo $this->getPriceHtml($_product) ?> <?php endif; ?>
Remember, simple.phtml was deprecated after 1.4.1.0 in favour of default.phtml. Many people make the mistake of looking in this file.




Leave A Comment!