Magento 1.9- If product $0 instead of showing price show 'Contact Us For Price'

If product $0 instead of showing price show 'Contact Us For Price'.

Not sure but it might be due to ===. In this case == should be more than enough.

Instead of comparing a string try and use the finalPrice value which is numeric. It would also prevent any issues if the format of your price HTML ever changes.

1
2
3
4
5
if ($_product->getFinalPrice() == 0) {
    echo '<h2>Contact Us For Price</h2>';
 }else{
    echo $this->getPriceHtml($_product);
}

No comments:

Post a Comment