码迷,mamicode.com
首页 > 其他好文 > 详细

静态block/static block添加至产品描述页的tab方法

时间:2014-10-18 18:12:28      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   strong   sp   文件   div   on   

magento 产品描述页新增一个tab,调用静态block/static block 内容的方法:

1. 在管理后台的 cms-->static block 新增一个 静态block, 注意创建的 identifier 名称, 这里我假设创建了一个identifier为 shipping 的静态block

2. 创建模型文件:在自己的模版目录的template文件夹里面,新创建一个文件夹为 myblock,在里面新建一个phtml类型的文件,比如 shipping.phtml

3. 打开shipping.html, 录入此代码:

<?php echo $this->getLayout()->createBlock(‘cms/block‘)->setBlockId(‘shipping‘)->toHtml() ?>

 

4. 在自己的模版目录的layout文件夹里面,编辑local.xml 或 review.xml, 新增

<catalog_product_view> 
  <reference name="product.info.tabs"> 
   <block type="myblock/shipping" name="shipping" as="shipping" /> 
    <action method="addTab" translate="title" module="review">
      <alias>shipping</alias>
      <title>Shipping</title>
      <block>review/product_view_list</block>
      <template>myblock/shipping.phtml</template>
    </action>         
   </reference>
</catalog_product_view>

刷新前台产品页面,就会看到新增的shipping tab这个标签。

 

静态block/static block添加至产品描述页的tab方法

标签:style   blog   color   io   strong   sp   文件   div   on   

原文地址:http://www.cnblogs.com/qq9915072/p/4033433.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!