要在magento的页脚中显示最近查看的产品吗
我想在页脚中显示最近查看的产品。我如何才能做到这一点?因为我已将它们放在page.xml中要在magento的页脚中显示最近查看的产品吗,magento,Magento,我想在页脚中显示最近查看的产品。我如何才能做到这一点?因为我已将它们放在page.xml中 <reference name="footer"> <block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/> </reference>
<reference name="footer">
<block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
</reference>
这些在页脚
<?php echo $this->getChildHtml('product_recently_viewed') ?>
将下面的代码放在页脚中。不需要在xml中进行更改。粘贴任何你想显示的内容
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->toHtml(); ?>
我希望您已经配置了
admin > system > configuration > catalog > recently viewd/compared products
&您可以看到
admin > reports > products > most viewed
&尝试
admin > reports > refresh statistics
您需要在当前主题中创建
local.xml
,并添加以下代码:
<layout version="0.1.0">
<default>
<reference name="footer">
<block type="reports/product_viewed" name="reports.product.viewed" template="reports/product_viewed.phtml" />
</reference>
</default>
</layout>
要在页脚中调用最近查看的产品,您可以尝试以下操作: 在local.xml文件中添加代码
<reference name="footer">
<block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
</reference>
要在页脚中调用最近查看的产品,您可以尝试以下操作: 在local.xml文件中添加代码 并在footer.phtml中使用
<?php echo $this->getChildHtml('product_recently_viewed') ?>
您面临的问题是因为您使用了第三方主题。清理reports/product_viewed.phtml中的代码,并将其替换为基本文件夹中的默认文件
注意:如果在主题中遇到任何错误,请始终尝试默认的Magento代码,以检查错误来源问题已解决:
您必须转到Page.xml并将此代码粘贴到块中
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="reports/product_viewed" name="reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml">
<action method="setColumnCount"><columns>6</columns></action>
<action method="setItemLimit"><type>recently_viewed</type><limit>8</limit></action>
</block>
</block>
6.
最近看了8
然后转到footer.phtml并粘贴以下内容:
<?php echo $this->getChildHtml('recently_viewed') ?>
我希望这将有助于某人@ MaNeAK:如果这个或任何答案已经解决了你的问题,请考虑通过点击复选标记来接受它。这向更广泛的社区表明,你已经找到了一个解决方案,并给回答者和你自己带来了一些声誉。没有义务这么做。是的,这是代码,但当我研究出来时,我发现你必须把它放在page.xml而不是local.xml中……我投你一票,伙计
<?php echo $this->getChildHtml('recently_viewed') ?>