Add some block to product view page through module xml file Magento

前端 未结 2 1835
青春惊慌失措
青春惊慌失措 2021-01-16 03:14

Hi i am developing a simple extension in which

i need to insert a new block on product page through xml file. Below is the xml file of my module

&l         


        
相关标签:
2条回答
  • 2021-01-16 03:44

    I assume you have file and folder in your design like this

    /template/total/prototal.phtml
    

    In your local.xml you can add like below

    <catalog_product_view>
         <reference name="product.info">
               <block type="core/template" name="total_prototal" template="total/prototal.phtml" after="product.info.addtocart"/>
          </reference>
    </catalog_product_view>
    

    Now in your catalog/product/view.phtml, call your custom block

    Before

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

    Add

    <?php echo $this->getChildHtml('total_prototal') ?>
    
    0 讨论(0)
  • 2021-01-16 03:48

    try this:

    <catalog_product_view>
            <reference name="alert.urls"> 
                <block type="total/prototal"  name="total_prototal" template="total.phtml" />  
            </reference>
    </catalog_product_view>
    

    make sure this line must be exist in view.phtml file:

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

    Hope this helps!

    0 讨论(0)
提交回复
热议问题