Don’t show price if 0.00 – How Magento

About-Our-Agency-Banner-Background-Image

This is for the product page only

If you need to add products to your store but you show the price as 0.00  it can look bad so here’s how to display the product but show a different message instead of the price.

It only shows the alternative message if the price is set to 0.00 otherwise the price will be shown as normal.

first open

/app/design/frontend/base/default/template/catalog/product/view/type/default.phtml

it should look like this
BEFORE


<?php /* @var $this Mage_Catalog_Block_Product_View_Abstract */?>
<?php $_product = $this->getProduct() ?>

<?php if ($_product->isAvailable()): ?>
<p class=”availability in-stock”><?php echo $this->__(‘Availability:’) ?> <span><?php echo $this->__(‘In stock’) ?></span></p>
<?php else: ?>
<p class=”availability out-of-stock”><?php echo $this->__(‘Availability:’) ?> <span><?php echo $this->__(‘Out of stock’) ?></span></p>
<?php endif; ?>
<?php echo $this->getChildHtml(‘product_type_data_extra’) ?>
<?php echo $this->getPriceHtml($_product) ?>

AND THIS AFTER


<?php /* @var $this Mage_Catalog_Block_Product_View_Abstract */?>
<?php $_product = $this->getProduct() ?>

<?php if ($_product->isAvailable()): ?>
<p class=”availability in-stock”><?php echo $this->__(‘Availability:’) ?> <span><?php echo $this->__(‘4 to 5 days’) ?></span></p>
<?php else: ?>
<p class=”availability out-of-stock”><?php echo $this->__(‘Availability:’) ?> <span><?php echo $this->__(‘4 to 5 days’) ?></span></p>
<?php endif; ?>
<?php echo $this->getChildHtml(‘product_type_data_extra’) ?>
<?php if($_product->price==0): ?>
<?php echo ‘Please call 01223 1111111’; ?>
<?php else: ?>
<?php echo $this->getPriceHtml($_product) ?>
<?php endif; ?>

We also changed the availability message at the same time for this client as they didn’t want to show stock levels.

You may find that the price is pulled using a different file depending on your installation. If you need help please let us know.

We hope you find this useful.