When I use this below code for my view.phtml page, when price is 0 then it shows a message, (Price on request). This works. When price is not 0 then it shows the price.

VIEW WORKS /app/design/frontend/default/modern/template/catalog/product/view.phtml

<?php if($_product->price==0): ?>
     <?php  echo 'Price on request'; ?>
<?php else: ?>
     <span class="price-yo">Price</span>
     <?php echo $this->getChildHtml('product_type_data') ?>
<?php endif; ?>

When I use the code for my upsell.phtml I always get the message, (Price on request) while it needs to show a price when its not 0.

UPSELL DOESN'T WORK /app/design/frontend/default/modern/template/catalog/product/list/upsell.phtml

<?php if($_product->price==0): ?>
        <div class="price-req-list">Price on request</div>
<?php else: ?>
    <div id="priceholder-list-upsell"><?php echo $this->getPriceHtml($_link, true, '-upsell') ?></div>
<?php endif; ?>

Does anyone knows how to solve this?

// extra info I use special price allot, maybe something is wrong in the price.phtml ?

  • Have you tried $_product->getPrice()==0? Jul 19, 2013 at 17:18
  • When I use that there is no price or message at all. <?php if($_product->getPrice()==0): ?>
    – magmarc
    Jul 24, 2013 at 15:38

2 Answers 2


The following is only my thinking, hopefully I didn't overlook some important part in the code

If Price on request is shown, then $_product->price==0 is true.

There is no $this->price in Mage_Catalog_Model_Product, therefore I think Varien_Object::__set is called which returns:

public function __get($var)
    $var = $this->_underscore($var);
    return $this->getData($var);

Which should be the same as $_product->getPrice():

public function getPrice()
    if ($this->_calculatePrice || !$this->getData('price')) {
        return $this->getPriceModel()->getPrice($this);
    } else {
        return $this->getData('price');

Something is broken in your upsell collection or price calculation. Whatever it is:

  1. you want to use $_price->getPrice() if this doesn't return anything, you need to fix THIS :-)
  2. check (hopefully with xdebug) which attributes are selected by the mysql query, somehow the prices aren't fetched...

you can try exstension Call for Price it allows you set custom text instead of price and also set it shown or not depend of customer group. http://www.magentocommerce.com/magento-connect/call-for-price-hide-price-3163.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.