【问题标题】:Position a block on product page below tabs - Magento在标签下方的产品页面上放置一个块 - Magento
【发布时间】:2012-05-02 14:18:55
【问题描述】:

我正在使用 Magento CE 1.6.2 并安装了一个扩展程序,该扩展程序显示“其他客户也购买了”,该扩展程序正好显示在选项卡下方。

现在我想将“最近浏览的产品”定位在产品页面的底部,就在页脚之前。

所以我想要这样的东西

      Tabs
      'other customers also bought'
      'Recently Viewed products'
  Footer Starts here...

但由于某种原因,我的“其他客户也购买了”与“最近浏览的产品”重叠

我尝试更改布局文件但没有成功

其他客户的布局文件也购买了otherbought.xml

   <catalog_product_view>
    <reference name="content">
        <block type="relatedproducts/relatedproducts" name="catalog.product.awrelated.community" as="othersbought_products" after="info_tabs" template="catalog/product/list/awrelated.phtml">
            <action method="setTarget">
                <alias>community</alias>
            </action>                   
        </block>    
    </reference>        
</catalog_product_view>

最近查看产品的布局报告.xml

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

对于标签,我使用的是 EasyTabs 扩展,easytabs.xml

  <reference name="product.info.additional">
            <action method="unsetChild" ifconfig="easy_tabs/general/tagstabbed"><name>product_tag_list</name></action>
            <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs">
                <action method="setTemplate" ifconfig="easy_tabs/general/enabled"><template>easytabs/tabs.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/descriptiontabbed"><alias>description_tabbed</alias><title>Description</title><block>catalog/product_view_description</block><template>easytabs/description.phtml</template></action>
                </block>
    </reference>

我猜beforeafter 元素可以使用,但它不起作用。或者如果有什么方法可以直接在产品页面底部的页脚之前显示“最近浏览的产品”?

谢谢

【问题讨论】:

    标签: php xml zend-framework magento


    【解决方案1】:

    我评论了reports.xml 并从该文件中取出一行并将其放入“othersbought.xml”。所以现在我的 othersbought.xml 文件看起来像这样:

       <catalog_product_view>
       <reference name="content">
        <block type="relatedproducts/relatedproducts" name="catalog.product.awrelated.community" as="othersbought_products" after="info_tabs" template="catalog/product/list/awrelated.phtml">
            <action method="setTarget">
                <alias>community</alias>
            </action>                   
        </block> 
       <!-- Added Recently viewed products here below 'Others Bought' block --->   
       <block type="reports/product_viewed" name="right.reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml" />
       <!-- ************ -->
       </reference>        
       </catalog_product_view>
    

    这使得“最近浏览的产品”块正好显示在“其他也购买”块的下方,这正是我想要的。

    可能不是最正确的方法,但目前对我有用。

    【讨论】:

      【解决方案2】:

      content 区域中的位置不受beforeafter 标签的控制,而是由它们在view.phtml 中的位置或控制其中块的文件(例如@987654325)确定@。

      尝试寻找这种形式的东西:

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

      这表示正在调用名为 addtocart 的布局中定义的块。

      如果您想知道哪个模板文件控制哪个部分,您可以尝试在System-&gt;Configuration-&gt;Developer(管理面板)中打开Template Path Hints,然后访问该页面。显然不在现场!请注意,您不能对默认配置执行此操作,因此您需要选择商店视图。

      【讨论】:

      • 我确实尝试通过在布局文件中使用 as 属性来命名,然后在 view.phtml 文件中将其声明为 getChildHtml('othersbought')getChildHtml('recently_viewed') 但它不能按该顺序工作。一旦在布局文件中声明,无论其顺序如何,它都会显示。
      • 布局文件中的顺序没有关系。您是否检查了生成的源以查看视觉顺序是否与基础顺序匹配?如果是 CSS 问题。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-23
      • 1970-01-01
      • 2011-08-04
      • 2020-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多