Magento admin:添加布局后没有显示新块

时间:2016-03-08 08:08:30

标签: magento magento-1.9

我在自定义模块下的管理页面中添加了几个自定义块。当我尝试通过在模块的布局文件中添加条目来添加另一个块时,不会显示新块。我错过了什么吗?

我现有的正在显示的块。

<block type="adminhtml/sales_order_create_shipping_method" template="sales/order/create/abstract.phtml" name="shipping_method">
     <block type="adminhtml/sales_order_create_shipping_method_form" template="xxxx/xxxx/quote/create/shipping/form.phtml" name="form" />
 </block> 

我试图在它下面添加的块,它没有显示

<block type="adminhtml/sales_order_create_billing_method" template="sales/order/create/abstract.phtml" name="billing_method">
                            <block type="adminhtml/sales_order_create_billing_method_form" template="xxx/xxx/quote/create/billing/form.phtml" name="form" />
                        </block> 

顺便说一句,如果我把它保存在已经存在的块中,则该块正在加载。想知道如何将它显示在现有的外部,作为一个独立的块。

<block type="adminhtml/sales_order_create_shipping_method" template="sales/order/create/abstract.phtml" name="shipping_method">
                            <block type="adminhtml/sales_order_create_shipping_method_form" template="xxxx/xxxxxx/quote/create/shipping/form.phtml" name="shipping_form" />   
  <block type="adminhtml/sales_order_create_billing_method" template="sales/order/create/abstract.phtml" name="billing_method">
   <block type="adminhtml/sales_order_create_billing_method_form" template="xxxxxx/xxxxxxxx/quote/create/billing/form.phtml" name="billing_form" />
   </block>  
</block>   

2 个答案:

答案 0 :(得分:2)

您可以更改名称属性吗? 例如

<block type="adminhtml/sales_order_create_shipping_method" template="sales/order/create/abstract.phtml" name="shipping_method">
     <block type="adminhtml/sales_order_create_shipping_method_form" template="xxxx/xxxx/quote/create/shipping/form.phtml" name="shipping_form" />
 </block> 

<block type="adminhtml/sales_order_create_billing_method" template="sales/order/create/abstract.phtml" name="billing_method">
                            <block type="adminhtml/sales_order_create_billing_method_form" template="xxx/xxx/quote/create/billing/form.phtml" name="billing_form" />
                        </block> 

之后,刷新缓存

答案 1 :(得分:0)

修正了问题。我在其他phtml文件所在的同一文件夹中有一个data.phtml模板文件,其中有以下代码。

    <div id="order-billing_method" style="display:none"><?php echo  $this->getChildHtml('billing_method') ?></div>

我更改了display:none to display:block并且新的billing-method块开始显示没有任何问题。谢谢你的回答。

相关问题