X hide

Magento Call For Price v1.x Developers Guide and API Reference

From Plumrocket Documentation

You are viewing:  Call-for-price-32.png  Call For Price


Add "Call For Price" Button Code to Magento Templates

Code for displaying "Call For Price" button on Product List page

In order to have the "Call For Price" buttons display on your product list, please do the following minor code changes:
First, find the file that can be reached at this access path on your server:

 app/design/frontend/THEME_NAME/default/template/catalog/product/list.phtml

where THEME_NAME is the name of the theme you are using.

Find the following code:

<p class="action"><button type="button" title="<?php echo $this->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>


and replace it with this one:


<?php if ($rule = Mage::helper('plumrocket_callforprice')->getCallForPriceRule($_product)) : ?>
 <div>
 <?php if($label = Mage::helper('plumrocket_callforprice')->getCfpLabel($rule->getProductListText())) : ?>
 <div class="plumrocket-callforprice-text-label"><?php echo $label; ?></div><br>
 <?php endif; ?>
 <button class="plumrocket-callforprice-btn button" onclick="plumrocketCallForPrice.getForm(<?php echo $_product->getId(); ?>);"><?php echo Mage::helper('plumrocket_callforprice')->getButtonLabel(); ?></button>
 </div>
<?php else: ?>
 <p class="action"><button type="button" title="<?php echo $this->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
<?php endif; ?>



Navigation