Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 11 characters in body; edited tags
Source Link

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Company_Module::order/view/items.phtml"> <block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" template="order/view/items/renderer/default.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/> </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

Many thanksHow could I target a block that is not using a name but an alias instead?

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Company_Module::order/view/items.phtml"> <block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" template="order/view/items/renderer/default.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/> </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

Many thanks

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Company_Module::order/view/items.phtml"> <block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" template="order/view/items/renderer/default.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/> </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

added 4 characters in body
Source Link

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> 
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Company_Module::order/view/items.phtml"> <block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" template="order/view/items/renderer/default.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/>  </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

Many thanks

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> 
  </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

Many thanks

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items" template="Company_Module::order/view/items.phtml"> <block class="Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer" as="default" template="order/view/items/renderer/default.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> <block class="Magento\Framework\View\Element\Text\ListText" name="order_item_extra_info"/>  </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

Many thanks

Source Link
Pablo
  • 11
  • 2

Can't override a core block using the referenceBlock method

I was wondering is someone has any idea of why my code is not working. I'm trying to override the sales order view to show an extra item on the "Items Ordered list". For this I created a module that is replacing the blocks on the sales_order_view.xml.

<?xml version="1.0"?> 
 </referenceBlock> </body> 

So far, the order_items template is overridden as expected but I can't not find a way to override the default.phtml one. I have tried with referenceBlock but it doesn't seem to be working. How could I target a block that is not using a name but an alias instead?

Many thanks