2
我想在.../template/catalog/product/view.phtml模板上添加随机产品的3个链接。Magento - 将一个随机产品添加到.../template/catalog/product/view.phtml
基于list.phtml,我尝试添加:
<?php
$_productCollection=$this->getLoadedProductCollection();
foreach ($_productCollection as $_randomProduct) {
echo $_randomProduct->getProductUrl();
}
?>
但我没有得到一个列表后面的URL的。我怎样才能得到一系列其他产品的链接和图像?
magento数据对象支持语法'RAND()'。 $ productCollection-> getSelect() - > order('rand()); – mivec 2011-04-09 11:53:20