Let’s initiate a discussion!!
Before following the below steps, you can create the order attribute and store it into the value.
Step 1: Create module.xml file under app/code/Vendor/Modulename/etc directory and registration.php file under app/code/Vendor/Modulename directory.
Step 2: Create sales_order_shipment_grid.xml file under app/code/Vendor/Modulename/view/adminhtml/ui_component directory with below code
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <columns name="sales_order_shipment_columns"> <column name="custcolumn" class="Vendor\Modulename\Ui\Component\Listing\Column\Custcolumn"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="filter" xsi:type="string">text</item> <item name="label" xsi:type="string" translate="true">Custom Column</item> </item> </argument> </column> </columns> </listing> |
Step 3: Create Custcolumn.php ui component class file under app/code/Vendor/Modulename/Ui/Component/Listing/Column directory with below code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<?php namespace Vendor\Modulename\Ui\Component\Listing\Column; use \Magento\Sales\Api\OrderRepositoryInterface; use \Magento\Framework\View\Element\UiComponent\ContextInterface; use \Magento\Framework\View\Element\UiComponentFactory; use \Magento\Ui\Component\Listing\Columns\Column; use \Magento\Framework\Api\SearchCriteriaBuilder; class Custcolumn extends Column { protected $_orderRepository; protected $_searchCriteria; protected $_customfactory; public function __construct( ContextInterface $context, UiComponentFactory $uiComponentFactory, OrderRepositoryInterface $orderRepository, SearchCriteriaBuilder $criteria, \Magento\Framework\App\ResourceConnection $resource, \Magento\Sales\Model\OrderFactory $orderFactory, array $components = [], array $data = []) { $this->_orderRepository = $orderRepository; $this->_searchCriteria = $criteria; $this->resource = $resource; $this->orderFactory = $orderFactory; parent::__construct($context, $uiComponentFactory, $components, $data); } public function prepareDataSource(array $dataSource) { if (isset($dataSource['data']['items'])) { $connection = $this->resource->getConnection(); $tableName = $connection->getTableName('sales_shipment_grid'); foreach ($dataSource['data']['items'] as & $item) { $order = $this->orderFactory->create()->loadByIncrementId($item["order_increment_id"]); if($order->getCustcolumn()){ $item['custcolumn'] = $order->getCustcolumn(); } } } return $dataSource; } } |
[crayon-641facaa1c3c3077036351/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.