簡體   English   中英

list.phtml 模板中的隨機產品 magento

[英]random products in list.phtml template in magento

下面是在 list.phtml 中的類別頁面上獲取產品列表的代碼。

$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');

我想要此列表下方的另一個部分,我可以在其中列出任何類別的隨機產品。 我可以做些什么來改變這個相同的 function 並重新使用它嗎?

如果我可以使用相同的助手,那將非常容易。

我想要一個“你可能會對這些感興趣”的部分,我在那里展示了隨機產品。

謝謝抗體

我無法想象 Magento 中的東西會像這樣簡單:

shuffle($_productCollection);

在 XML 中你應該定義你的塊,是這樣的:

<block type="catalog/product_list_random" template="your random template" name="random" />

在類別視圖頁面中,只需調用您的模板即可

echo $this->getChildHtml('random');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM