简体   繁体   中英

random products in list.phtml template in magento

Below is the code to get list of products on a category page in list.phtml.

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

I want another section below this list where I can list random products of any category. can I do something to tweek this same function and reuse it?

It would be really easy if I could use the same helper.

I wanted a section for " you might be intrested in these " and I show random products there.

Thanks Ab

I can't imagine something in Magento being as simple as:

shuffle($_productCollection);

In XML where you should define your block, something like this:

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

and in the category view page simply make call to your template like

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM