Product Page – Missing related products

Hello,

We’ve bought the JM Sportsgear theme, and we’re now in the proccess of configuring the shop.

Among other issues with the extensions, which I’ll cover on other threads, we noticed related products are not showing up on the product detail pages. After covering all possibilities (reindex, stock qty, visibility, categories, etc) we went into the template only to find out there isn’t a related products call on the template. The only similar call is for upsell products which, while its a similar feature, its not what we would like to use.

How could we enable related products block on the product detail page?

3 answers

Profile photo of Saguaros 0.00 $tone August 14, 2014
Public

Greetings In product detail page of this JM Sportsgear theme, it’s displaying Up-sell product due to the feature of JM Base Theme extension, it provides option so that you can display up-sell product in product detail page or not.

If you want to display related product, you can try with this tweak:
-- Go to file: /app/design/frontend/default/jm_sportsgear/template/catalog/product/view.phtml
At then end of this file, you will see the block of code which display up-sell product:

PHP Code:

<?php 

if($baseconfig['showupsell']):

    
$upsell_products $this->getChild('upsell_products');

    if(
$upsell_products) {

        
$upsell_products->setItemLimit("upsell",$baseconfig['upsellnumber']);

        if(
$upsell_products $this->getChildHtml('upsell_products')): ?>

           <?php echo $upsell_products?>

        <?php endif;

    }

endif;

?>


Underneath this, please add this line of code:

PHP Code:

<?php echo $this->getChildHtml('related_products'); ?>


-- This line of code will retrieve the template file for related product so in the next step, you will need to make some changes in this file: /app/design/frontend/default/jm_sportsgear/template/catalog/product/list/related.phtml

I attach both of these 2 files so that you can see the differences.

-- Once done, remember to clear magento cache

#
Profile photo of Pedro Guedes 140.00 $tone August 14, 2014
Public

Thank you I had already tried calling $this->getChildHtml(‘related_products’); but since there was already a tempate for related.phtml and it had a completely different markup, I assumed it was used elsewhere (where i didnt find out where it would be), the result was a broken up block display.

I replaced related.phtml with your sample and it worked! After all, its the same markup as upsell, but with different strings.

Thanks again.

#1

Please login or Register to Submit Answer

Written By

Comments