- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
add weight column to items ordered admin magento 2.3
Hello
I am going nuts here so please help clever people!
This is what I have done:
1. app/code/Dottie/Admin/view/adminhtml/templates/weight.phtml<span>Item Weight: <?php /* @escapeNotVerified */ echo number_format($_item->getWeight(), 2); ?>gm</span>
2. app/code/Dottie/Admin/view/adminhtml/layout/sales_order_view.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="order_items">
<arguments>
<argument name="columns" xsi:type="array">
<item name="weight_column" xsi:type="string" translate="true">Weight Column</item>
</argument>
</arguments>
<referenceBlock name="default_order_items_renderer">
<arguments>
<argument name="columns" xsi:type="array">
<item name="weight_column" xsi:type="string" translate="true">col-weight_column</item>
</argument>
</arguments>
</referenceBlock>
<block class="Magento\Sales\Block\Adminhtml\Order\View\Items" name="order_items"
template="Dottie_Admin::weight.phtml" group="column" />
</referenceBlock>
</body>
3. upgraded/decomp/cleared
Result....nothing
What on earth have i done wrong or not enough? Please help
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: add weight column to items ordered admin magento 2.3
You have an issue with `app/code/Dottie/Admin/view/adminhtml/layout/sales_order_view.xml`
and the file code should be like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="order_items">
<arguments>
<argument name="columns" xsi:type="array">
<item name="weight" xsi:type="string" translate="true">weight</item>
</argument>
</arguments>
<block class="Magento\Sales\Block\Adminhtml\Items\Column\DefaultColumn"
name="column_weight" template="Dottie_Admin::.phtml" group="column"/>
</referenceBlock>
<referenceBlock name="default_order_items_renderer">
<arguments>
<argument name="columns" xsi:type="array">
<item name="weight" xsi:type="string" translate="false">col-weight</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
As Column name is `weight` name="weight" that block name is `column_weight`
that why
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: add weight column to items ordered admin magento 2.3
I'm also figuring out the same issue upsers
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: add weight column to items ordered admin magento 2.3
Hello
Thank You for your time and reply.
Unfortunately it is not working
I can add the weight modifying core files...but this is not the way
Why is the column not being added
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: add weight column to items ordered admin magento 2.3
Edit on core file is not right way. Your code will remove when you update magento version.