我正在使用默认的Magento 1.9.x最近在CMS页面上查看了产品块
{{block type="reports/product_viewed" template="reports/product_viewed.phtml"}}
但默认的Magento最近查看了产品块仅支持登录用户,因此只有在我登录
时才显示我检查了文件
/public_html/app/code/core/Mage/Reports/Block/Product/Abstract.php
和行号138 函数设置了用于过滤结果的产品集合的客户ID。
,但我认为普通的网站访问者没有这种ID。
if ($this->getCustomerId()) {
$this->_collection->setCustomerId($this->getCustomerId());
}
任何人都知道如何通过将ID设置为上述或使用其他方式来获取最近查看的产品。
我也尝试了这个答案,但根本没有起作用
如何获得Magento中的客人用户最近查看产品
步骤1:转到admin-> cms-> pages-> anycmspage
步骤2:转到 -> anycmspage->设计
步骤3:在布局更新xml
中复制和pase以下代码<reference name="content">
<block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new">
<action method="addPriceBlockType">
<type>bundle</type>
<block>bundle/catalog_product_price</block>
<template>bundle/catalog/product/price.phtml</template>
</action>
</block>
</reference>