更新时间:2023-11-30 11:32:52
不确定为什么不起作用,但是如果您想尝试其他解决方案
Not sure why that isn't working, but if you want you try some other solutions
用以下内容替换前15行:
Replace the first ~15 lines with:
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
$collection = Mage::getResourceModel('catalog/product_collection');
Mage::getModel('catalog/layer')->prepareProductCollection($collection);
$collection->getSelect()->Limit($this->getNumProducts())->order('rand()');
$collection->addStoreFilter();
$collection->addCategoryFilter($category);
//print_r($collection);
替换:
<?php for ($i=0; $i < $number_of_products; $i++): ?>
与:
<?php foreach($collection as $product) : ?> //need to end foreach with <?php endforeach; ?>
替换这样的东西:
$displayed_products[$random_products[$i]]->getName();
使用:
$product->getName();
((将"$ displayed_products [$ random_products [$ i]]"替换为"$ product")
(find and replace "$displayed_products[$random_products[$i]]" with "$product")