我正在尝试使用以下代码访问上次查看的项目列表:
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$model = Mage::getModel('reports/product_index_viewed');
//
$_collection = $model->getCollection()->addAttributeToSelect($attributes)
->excludeProductIds($model->getExcludeProductIds())
->addUrlRewrite()
->setPageSize($columnCount)
->setCurPage(1);
//
$_collection->addPriceData();
$_collection->addIndexFilter();
$_collection->setAddedAtOrder();
//
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($_collection);
我从 Mage_Reports_Block_Product_Abstract 复制了这个,但这是在创建顺序中提供产品。