简体   繁体   中英

Position a block on product page below tabs - Magento

I am working on Magento CE 1.6.2 and have an extension installed which display 'Other Customers also Bought' which displays fine exactly below the tabs.

Now I would like to position 'Recently viewed products' on Product page right at the bottom, just before the footer.

So I want some thing like this

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

But for some reason my 'Other Customers also bought' is getting over lapped with 'Recently Viewed Products'

I tried changing the layout files but to no success

Layout file for other customers also bought 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>

Layout for Recently Viewed Products reports.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>

And for tabs i'm using EasyTabs extension, 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>

I guess a before or after element can be used but its not working. Or If there is any way to directly show 'Recently Viewed Products' right at the bottom of product page just before the footer ?

Thanks

The position in the content area is not controlled using the before and after tags, but is determined by where they are positioned in view.phtml or the files that control the blocks in that such as tabs.phtml .

Try looking for things of this form:

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

Which indicate a block defined in a layout with name addtocart is being called.

If you want to know which template file controls which part you can try turning on Template Path Hints in the System->Configuration->Developer (admin panel), and then visit the page. Obviously not on a live site! Note you can't do this for the default configuration, so you need to choose a store view.

I commented reports.xml and took the line from that file putting it into 'othersbought.xml'. So now my othersbought.xml file looks like this :

   <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>

This makes the 'Recently Viewed products' block to appear exactly below 'Other also bought' block which is what I had wanted.

May be not the most right way to do it, but works for me for now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM