【问题标题】:Recently viewed products not showing最近浏览的产品未显示
【发布时间】:2014-09-03 01:28:52
【问题描述】:

我正在尝试让最近查看的产品显示在产品页面的追加销售下。

根据thisthis 我添加的问题:

 <reference name="content">
    <block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
 </reference>

app/design/frontend/base/default/layout/catalog.xml 文件,我添加了:

<?php echo $this->getChildHtml('product_recently_viewed') ?>

就在下面

<?php echo $this->getChildHtml('upsell_products') ?>   

app/design/frontend/base/default/template/catalog/product/view.phtml 文件中,但不会显示最近查看的产品。最近查看的产品不会显示我做错了什么?

【问题讨论】:

    标签: php magento magento-1.8


    【解决方案1】:

    将您的布局文件更改为:

    <catalog_product_view translate="label">
       <reference name="content">
           <block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
       </reference>
    </catalog_product_view>
    

    然后像现在一样将它添加到您的 view.phtml 文件中。

    <?php echo $this->getChildHtml('product_recently_viewed') ?>
    

    【讨论】:

    • 在布局文件中更改它
    【解决方案2】:

    除了用于所有页面的默认句柄之外,每个页面都有一个句柄。

    所以首先你需要在那个句柄中添加你的块(你在 local.xml 文件中这样做)

    如上评论所述:

    与块相关的 XML 节点

    这将导致您的块成为目录产品视图页面的内容块的子级。 现在 getChildHtml('product_recently_viewed') ?> 会为你做的。

    【讨论】:

    • 在local.xml文件中添加什么句柄块,local.xml文件在哪里?
    • 在 .xml 中搜索 ,您将了解要写什么以及在哪里写。标准是写在 local.xml 或布局 xml 文件中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-15
    • 2023-03-03
    • 2018-02-08
    相关资源
    最近更新 更多