| Magento 产品详细页里的相关产品需要在后台手动添加才能显示,而且也不知道产品是哪种属性的,管理起来也相当的麻烦。下面最模板就分享一下,这也是应客户要求所需。也许你不一定能用的上,但可以作为一个参考。 <div>      <div>Other Work <?php echo $_product->getResource()->getAttribute('art_author')->getFrontend()->getValue($_product);?></div>         <?php //echo $this->getChildHtml('otherproduct')?>         <?php   $art_author = $_product->getResource()->getAttribute('art_author')->getFrontend()->getValue($_product);   $_productCollection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->addAttributeToFilter('art_author',$art_author);      $_helper = $this->helper('catalog/output');   //print_r($_product);exit; ?> <?php if(!$_productCollection->count()): ?> <p><?php echo $this->__('There are no products matching the selection.') ?></p> <?php else: ?>  <div>     <?php $_collectionSize = $_productCollection->count() ?>     <?php $_columnCount = $this->getColumnCount();?>     <?php $i=0; foreach ($_productCollection as $_product1): ?>     <?php if ($i++%$_columnCount==0): ?>     <ul>     <?php endif ?>     <?php //if($i<=5):?>     <li><a href="<?php echo $_product1->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product1, 'small_image'), null, true) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product1, 'small_image')->resize(140); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product1, 'small_image'), null, true) ?>" /></a>     <div>     <p><a href="<?php echo $_product1->getProductUrl() ?>" title="<?php echo $this->stripTags($_product1->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product1, $_product1->getName(), 'name') ?></a></p>     <div>     <?php  echo $_product1->getResource()->getAttribute('art_author')->getFrontend()->getValue($_product1).'<br>';  echo $_product1->getResource()->getAttribute('art_width')->getFrontend()->getValue($_product1).' x '.$_product1->getResource()->getAttribute('art_height')->getFrontend()->getValue($_product1).' cm';  ?>     </div>     <div><span>$<?php echo number_format($_product1->getFinalPrice(),0);?> |</span><span><a href="<?php echo $this->getAddToCartUrl($_product1) ?>">Order Now</a></span></div>     </div>     </li>     <?php //endif;?>     <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>     </ul>     <?php endif ?>     <?php endforeach ?>     </div>     <?php endif; ?>     </div>  在产品详细页中放入上方代码,然后根据自己网站的网格修改对应的CSS样式。上面代码中,我是以产品作者来显示的。比如,某一个产品是hicoogle上传的,这个相关产品的功能就是显示hicoogle作者的产品,同时可设置显示数量等。(责任编辑:最模板) | 



 shopex绿色类凡客模板
							人气:546
							shopex绿色类凡客模板
							人气:546
						 ecshop仿缤购网上商城
							人气:1023
							ecshop仿缤购网上商城
							人气:1023
						 ecshop紫色综合商城模板|特
							人气:459
							ecshop紫色综合商城模板|特
							人气:459
						 家居用品商城系统|ecshop家
							人气:898
							家居用品商城系统|ecshop家
							人气:898
						 zencart鞋类模板
							人气:2895
							zencart鞋类模板
							人气:2895
						 蓝色中英繁三语全静态S
							人气:343
							蓝色中英繁三语全静态S
							人气:343