<?php $_productCollection=$this->getLoadedProductCollection(); $_helper = $this->helper('catalog/output'); if ($_productCollection->count()): $_productCollection = $_productCollection->getItems(); shuffle($_productCollection); $i = 0; foreach ($_productCollection as $_product): if ($i < 5): // Product Data In Here endif; $i++; endforeach; endif; ?> 代码主要依靠php的shuffle函数来“洗牌”,其余则是正常的magento 加载产品的代码!