获取最近在Magento查看的产品阵列


Get recently viewed products array in Magento

我遇到了一个问题,我必须高度定制一个电子商务商店。因此,如果我能在中获得所需的数据,那就太好了

''app''design''frontend''alanche''default''template''reports''product_viewed_details.html

通过

$this->getRecentlyViewedProducts()




我已经试过通过获取

Mage::getBlockSingleton('report/product_view')->getRecentlyViewedProducts();

,但我得到的只是一个空数组。


有人能帮帮我吗?我在这里开车有点疯了。

您尝试过吗:

$collection = Mage::getSingleton('Mage_Reports_Block_Product_Viewed')->getItemsCollection();

您还可以使用别名来生成更友好的代码:

$collection = Mage::getBlockSingleton('reports/product_viewed')->getItemsCollection();