Knowledge Base/Setup & Customization/Manual Theme Integration

Display points in the catalog product listing pages

Lynn Aque Penaloza
posted this on March 14, 2012 13:42

Where is the configuration setting for this block?

If you were to set this in Rewards > Configuration > Other Configuration in the Integrated Content section, it would be this setting:

Screen_Shot_2012-06-27_at_4.29.15_PM.png

What does this block do?

This block allows our Point Optimizer to be displayed when the customer is looking through the catalog in grid mode and list mode.

Modified_Catalog_view.jpg

How do I integrate this block manually?

If your theme is too customized to use the configuration setting or you simply would rather implement the code manually, please follow these directions to integrate this block into your catalog product list page.

Note: You will need to set this for both List Mode and Grid Mode in your code.

List Mode

1. Open /design/frontend/[your package]/[your theme]/template/catalog/product/list.phtml

2. Copy this code:

<?php /*WDCA CODE BEGINS*/ ?>
    <?php if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/TBT_Rewards') 
               && Mage::getConfig()->getModuleConfig('TBT_Rewards')->is('active', 'true')) : ?>
        <?php $predict_points_block = Mage::getBlockSingleton('rewards/product_predictpoints')?>
        <?php $predict_points_block->setProduct($_product);?> 
        <?php echo $predict_points_block->toHtml()?>
 <?php endif; ?>
<?php /*WDCA CODE ENDS*/ ?> 

 

3. Look for line 55 and place the copied code in lines 62-69 as shown here: 

<?php if($_product->isSaleable()): ?>
    <button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
<?php else: ?>
    <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
<?php endif; ?>
 
 
<?php /*WDCA CODE BEGINS*/ ?>
    <?php if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/TBT_Rewards') 
               && Mage::getConfig()->getModuleConfig('TBT_Rewards')->is('active', 'true')) : ?>
        <?php $predict_points_block = Mage::getBlockSingleton('rewards/product_predictpoints')?>
        <?php $predict_points_block->setProduct($_product);?> 
        <?php echo $predict_points_block->toHtml()?>
 <?php endif; ?>
<?php /*WDCA CODE ENDS*/ ?> 
 
 
<div class="clear"></div>
<div class="description">
    <?php echo nl2br($_product->getShortDescription()) ?>
    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><small><?php echo $this->__('Learn More') ?></small></a>
</div>
<p class="add-to">

 

Grid Mode 

The same operation is required for Grid mode. Grid mode is located right under List mode in the same file.

1. Open /design/frontend/[your package]/[your theme]/template/catalog/product/list.phtml

2. Copy this code:

<?php /*WDCA CODE BEGINS*/ ?>
    <?php if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/TBT_Rewards') 
               && Mage::getConfig()->getModuleConfig('TBT_Rewards')->is('active', 'true')) : ?>
        <?php $predict_points_block = Mage::getBlockSingleton('rewards/product_predictpoints')?>
        <?php $predict_points_block->setProduct($_product);?> 
        <?php echo $predict_points_block->toHtml()?>
 <?php endif; ?>
<?php /*WDCA CODE ENDS*/ ?> 

3. Look for line 118 and place the copied code in lines 125-132 as shown here: 

<?php if($_product->isSaleable()): ?>
    <button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button>
<?php else: ?>
    <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
<?php endif; ?>
 
 
<?php /*WDCA CODE BEGINS*/ ?>
    <?php if(!Mage::getStoreConfigFlag('advanced/modules_disable_output/TBT_Rewards') 
               && Mage::getConfig()->getModuleConfig('TBT_Rewards')->is('active', 'true')) : ?>
        <?php $predict_points_block = Mage::getBlockSingleton('rewards/product_predictpoints')?>
        <?php $predict_points_block->setProduct($_product);?> 
        <?php echo $predict_points_block->toHtml()?>
 <?php endif; ?>
<?php /*WDCA CODE ENDS*/ ?> 
 
 
<p class="add-to">
                    <?php if ($this->helper('wishlist')->isAllow()) : ?>
                    <a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-cart"><?php echo $this->__('Add to Wishlist') ?></a>
                    <?php endif; ?>
                    <?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?><br/>
                    <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>
                    <?php endif; ?>
                </p>