Magento 1 Call For Price v1.x Developer Guide and API Reference

In this developer documentation for the Magento Call For Price Extension, you will find step-by-step instructions, sample code, and API references to fully customize your plugin.

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; ?>

Was this article helpful?