How to show relatated product when view detail a product

Hi,

i dont know how to add related products for view detail product, pls help me

TksAttachment 35037

7 answers

Profile photo of Sherlock 0.00 $tone March 21, 2014
Public

The related products you mentioned actually are up-sells products
When editting or creating products in back-end, at the up-sells tab please make sure that you select some products there.

#1
Profile photo of nickydg 0.00 $tone April 2, 2014
Public

To show related products, please open file ..\app\design\frontend\default\jm_megamalltemplat e\catalog\product\view.phtml

At line 267, before this code:

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

Add this code:

Code:

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

Hope this help.

#3
Profile photo of nickydg 0.00 $tone April 10, 2014
Public

If you want to add CMS Static Block, you add this code:

PHP Code:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_static_block_id')->toHtml() ?>


to the product view file:
..\app\design\frontend\default\jm_megamalltemplat e\catalog\product\view.phtml

To learn more on how to create static block, you can follow this guide:
http://www.magentocommerce.com/knowl…-static-blocks

#5
Profile photo of Vinicius Silva 0.00 $tone April 13, 2014
Public

Hi Nicky,
I tried this solution with the Jm Crafts Theme but it changes nothing to the page. I can only show upsell products as related products.

Do you have any idea?

Thanks,
Vinny

#6
Profile photo of Seoki Lee 1510.00 $tone April 15, 2014
Public

To add a new block on product detail, please follow steps below:

1. Go to your admin, create a static block.

2. Open the file …\app\design\frontend\default\jm_megamalltempla te\catalog\product\view.phtml

After this code:

Code:

<div id="ja-tab-products" class="product-collateral">

Add this code:

Code:

<div class="block-product">
	<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_block_identifier')->toHtml() ?>
</div>

Note: your_block_identifier is your block’s identifier which you created in your admin

3. Add style for this via this file ..\skin\frontend\default\jm_megamall\css\styles.cs s
After this code:

Code:

.product-collateral {
	margin: 0 0 40px 0;
	position: relative
}

Add this code:

Code:

.block-product {
    float: left;
    margin: 130px 0 0;
    top: 130px;
    width: 265px;
}

Hope this helps.

#7

Please login or Register to Submit Answer

Written By

Comments