Magento: Show Visitor's Recently Viewed Product

孤街浪徒 提交于 2019-12-14 02:36:53

问题


This question is somehow related to my previous question. I want the "recently viewed" section to show the products which are recently viewed by my (as a visitor). So in that way, every visitor will see their recently viewed products in that section.
Does magento provide any default functionality for this feature or do I have to do it the way I referred in my previous question.


回答1:


Yes magento has its default functionality Goto app/design/frontend/default/(yourtheme)/tempalte/reports folder

If you cant see that folder in your theme, just copy it and save it to your theme folder

you can use the below code to display in layout files

<block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" />

To call in CMS pages (homepage)

{{block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml"}}

To call in phtml file

<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->tohtml(); ?>



回答2:


yes , you can by simply use this 
<cms_index_index>
    <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>
</cms_index_index>


来源:https://stackoverflow.com/questions/33493060/magento-show-visitors-recently-viewed-product

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!