Magento 2 : How to Customise Admin Sales Order Grid CollectionTrying to filter by 'In Stock' or 'Out of Stock' on product admin gridHow can I use UNION for 2 collections ? Or merge collections ? (for use in adminhtml grid)add column to sales/orders gridShow notice in admin order grid based on filterAdmin/Manual Order - Why is Adding Items slower after order custom attribute installation?Adding custom sales order attribute to order gridMagento 2 Particular order assign to sub-adminHow I can Filter admin Order collection by status (Pending Only)?Magento2 filter not working for request parameter for order gridreload grid when click on button and filter grid
Error message with tabularx
How can I place the product on a social media post better?
Do I have to worry about players making “bad” choices on level up?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?
Examples of subgroups where it's nontrivial to show closure under multiplication?
Reducing vertical space in stackrel
Why was Germany not as successful as other Europeans in establishing overseas colonies?
Don’t seats that recline flat defeat the purpose of having seatbelts?
What does it mean to express a gate in Dirac notation?
What does KSP mean?
Critique of timeline aesthetic
Is there really no use for MD5 anymore?
Why is it that the natural deduction method can't test for invalidity?
How to stop co-workers from teasing me because I know Russian?
Is contacting this expert in the field something acceptable or would it be discourteous?
How to solve constants out of the internal energy equation?
Unexpected email from Yorkshire Bank
Pulling the rope with one hand is as heavy as with two hands?
Combinable filters
What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?
Why does processed meat contain preservatives, while canned fish needs not?
Using a Lyapunov function to classify stability and sketching a phase portrait
How to make a pipeline wait for end-of-file or stop after an error?
Magento 2 : How to Customise Admin Sales Order Grid Collection
Trying to filter by 'In Stock' or 'Out of Stock' on product admin gridHow can I use UNION for 2 collections ? Or merge collections ? (for use in adminhtml grid)add column to sales/orders gridShow notice in admin order grid based on filterAdmin/Manual Order - Why is Adding Items slower after order custom attribute installation?Adding custom sales order attribute to order gridMagento 2 Particular order assign to sub-adminHow I can Filter admin Order collection by status (Pending Only)?Magento2 filter not working for request parameter for order gridreload grid when click on button and filter grid
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to customise admin sale order grid collection.
I have created an custom sale_order
attribute store_manager
. These store managers are admin users eg: 'manager1', 'manager2'.
1) Orders are manually assigned to 'manager1' or 'manager2' -- this part is done
2) Now I am trying to set filter on sale order grid collection, so when manager logged in to there system they can only see there orders.
In Magento 1 we have sales_order_grid_collection_load_before
, sales_order_grid_collection_load_after
for this requirement .
Is tried to such event for Magento 2 but didn't get any success.
My Queries :
Is there any such event like (sales_order_grid_collection_load_after
) in magento 1 which full fill my requirement?
Is there any other way where I can set filter to sale order grid collection?
Note : I already search for this on google but didn't get any perfect solution.
admin grid sales-order magento-2.1.3
add a comment |
I am trying to customise admin sale order grid collection.
I have created an custom sale_order
attribute store_manager
. These store managers are admin users eg: 'manager1', 'manager2'.
1) Orders are manually assigned to 'manager1' or 'manager2' -- this part is done
2) Now I am trying to set filter on sale order grid collection, so when manager logged in to there system they can only see there orders.
In Magento 1 we have sales_order_grid_collection_load_before
, sales_order_grid_collection_load_after
for this requirement .
Is tried to such event for Magento 2 but didn't get any success.
My Queries :
Is there any such event like (sales_order_grid_collection_load_after
) in magento 1 which full fill my requirement?
Is there any other way where I can set filter to sale order grid collection?
Note : I already search for this on google but didn't get any perfect solution.
admin grid sales-order magento-2.1.3
Any Solution about filter Order grid collection by admin user id?
– mahmoudismail
Jul 2 '18 at 10:00
add a comment |
I am trying to customise admin sale order grid collection.
I have created an custom sale_order
attribute store_manager
. These store managers are admin users eg: 'manager1', 'manager2'.
1) Orders are manually assigned to 'manager1' or 'manager2' -- this part is done
2) Now I am trying to set filter on sale order grid collection, so when manager logged in to there system they can only see there orders.
In Magento 1 we have sales_order_grid_collection_load_before
, sales_order_grid_collection_load_after
for this requirement .
Is tried to such event for Magento 2 but didn't get any success.
My Queries :
Is there any such event like (sales_order_grid_collection_load_after
) in magento 1 which full fill my requirement?
Is there any other way where I can set filter to sale order grid collection?
Note : I already search for this on google but didn't get any perfect solution.
admin grid sales-order magento-2.1.3
I am trying to customise admin sale order grid collection.
I have created an custom sale_order
attribute store_manager
. These store managers are admin users eg: 'manager1', 'manager2'.
1) Orders are manually assigned to 'manager1' or 'manager2' -- this part is done
2) Now I am trying to set filter on sale order grid collection, so when manager logged in to there system they can only see there orders.
In Magento 1 we have sales_order_grid_collection_load_before
, sales_order_grid_collection_load_after
for this requirement .
Is tried to such event for Magento 2 but didn't get any success.
My Queries :
Is there any such event like (sales_order_grid_collection_load_after
) in magento 1 which full fill my requirement?
Is there any other way where I can set filter to sale order grid collection?
Note : I already search for this on google but didn't get any perfect solution.
admin grid sales-order magento-2.1.3
admin grid sales-order magento-2.1.3
edited May 16 '17 at 12:41
Dhiren Vasoya
4,54251844
4,54251844
asked May 16 '17 at 12:39
Deepak MankotiaDeepak Mankotia
45321227
45321227
Any Solution about filter Order grid collection by admin user id?
– mahmoudismail
Jul 2 '18 at 10:00
add a comment |
Any Solution about filter Order grid collection by admin user id?
– mahmoudismail
Jul 2 '18 at 10:00
Any Solution about filter Order grid collection by admin user id?
– mahmoudismail
Jul 2 '18 at 10:00
Any Solution about filter Order grid collection by admin user id?
– mahmoudismail
Jul 2 '18 at 10:00
add a comment |
2 Answers
2
active
oldest
votes
override with your module Mage_Sales by writing in module.xml smth like
<module name="----" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
Create in your module view/adminhtml/ui_component/sales_order_grid.xml
in sales_order_grid do smth like
<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_columns">
<column name="attribute_id">
<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">Attribute Name</item>
<item name="sortOrder" xsi:type="string">3</item>
</item>
</argument>
</column>
</columns>
add a comment |
Create your custom module or already exit its not issue.
In etc folder di.xml created plugin
<type name="MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter">
<plugin name="bindStoreManagerSearch" type="NamespaceModule_namePluginGridSearchStoreManagerSearch" sortOrder="1" />
</type>
Create StoreManagerSearch.php file in plugin folder
<?php
namespace NamespaceModule_namePluginGridSearch;
class StoreManagerSearch
public function aroundApply(
MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter $subject,
callable $proceed,
MagentoFrameworkDataCollection $collection,
MagentoFrameworkApiFilter $filter
)
$result = $proceed($collection, $filter);
if($collection->getConnection()->tableColumnExists($collection->getMainTable(), 'store_manager'))
$collection->getSelect()->orWhere('`main_table`.store_manager = ?', $filter->getValue());
$parentTable = null;
if($collection->getMainTable() == 'sales_order_grid')
$parentTable = 'sales_order';
else if($collection->getMainTable() == 'sales_invoice_grid')
$parentTable = 'sales_invoice';
else if($collection->getMainTable() == 'sales_shipment_grid')
$parentTable = 'sales_shipment';
else if($collection->getMainTable() == 'sales_creditmemo_grid')
$parentTable = 'sales_creditmemo';
else
$parentTable = 'sales_order';
if($parentTable && $collection->getConnection()->tableColumnExists($parentTable, 'store_manager'))
$collection->getSelect()->join(
['sm' => $parentTable],
"sm.entity_id = main_table.entity_id",
[]
);
$collection->getSelect()->orWhere('`sm`.store_manager = ?', $filter->getValue());
return $result;
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f174669%2fmagento-2-how-to-customise-admin-sales-order-grid-collection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
override with your module Mage_Sales by writing in module.xml smth like
<module name="----" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
Create in your module view/adminhtml/ui_component/sales_order_grid.xml
in sales_order_grid do smth like
<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_columns">
<column name="attribute_id">
<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">Attribute Name</item>
<item name="sortOrder" xsi:type="string">3</item>
</item>
</argument>
</column>
</columns>
add a comment |
override with your module Mage_Sales by writing in module.xml smth like
<module name="----" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
Create in your module view/adminhtml/ui_component/sales_order_grid.xml
in sales_order_grid do smth like
<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_columns">
<column name="attribute_id">
<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">Attribute Name</item>
<item name="sortOrder" xsi:type="string">3</item>
</item>
</argument>
</column>
</columns>
add a comment |
override with your module Mage_Sales by writing in module.xml smth like
<module name="----" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
Create in your module view/adminhtml/ui_component/sales_order_grid.xml
in sales_order_grid do smth like
<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_columns">
<column name="attribute_id">
<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">Attribute Name</item>
<item name="sortOrder" xsi:type="string">3</item>
</item>
</argument>
</column>
</columns>
override with your module Mage_Sales by writing in module.xml smth like
<module name="----" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
</sequence>
</module>
Create in your module view/adminhtml/ui_component/sales_order_grid.xml
in sales_order_grid do smth like
<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_columns">
<column name="attribute_id">
<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">Attribute Name</item>
<item name="sortOrder" xsi:type="string">3</item>
</item>
</argument>
</column>
</columns>
answered Jun 2 '17 at 11:08
Andrei DinuAndrei Dinu
11
11
add a comment |
add a comment |
Create your custom module or already exit its not issue.
In etc folder di.xml created plugin
<type name="MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter">
<plugin name="bindStoreManagerSearch" type="NamespaceModule_namePluginGridSearchStoreManagerSearch" sortOrder="1" />
</type>
Create StoreManagerSearch.php file in plugin folder
<?php
namespace NamespaceModule_namePluginGridSearch;
class StoreManagerSearch
public function aroundApply(
MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter $subject,
callable $proceed,
MagentoFrameworkDataCollection $collection,
MagentoFrameworkApiFilter $filter
)
$result = $proceed($collection, $filter);
if($collection->getConnection()->tableColumnExists($collection->getMainTable(), 'store_manager'))
$collection->getSelect()->orWhere('`main_table`.store_manager = ?', $filter->getValue());
$parentTable = null;
if($collection->getMainTable() == 'sales_order_grid')
$parentTable = 'sales_order';
else if($collection->getMainTable() == 'sales_invoice_grid')
$parentTable = 'sales_invoice';
else if($collection->getMainTable() == 'sales_shipment_grid')
$parentTable = 'sales_shipment';
else if($collection->getMainTable() == 'sales_creditmemo_grid')
$parentTable = 'sales_creditmemo';
else
$parentTable = 'sales_order';
if($parentTable && $collection->getConnection()->tableColumnExists($parentTable, 'store_manager'))
$collection->getSelect()->join(
['sm' => $parentTable],
"sm.entity_id = main_table.entity_id",
[]
);
$collection->getSelect()->orWhere('`sm`.store_manager = ?', $filter->getValue());
return $result;
add a comment |
Create your custom module or already exit its not issue.
In etc folder di.xml created plugin
<type name="MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter">
<plugin name="bindStoreManagerSearch" type="NamespaceModule_namePluginGridSearchStoreManagerSearch" sortOrder="1" />
</type>
Create StoreManagerSearch.php file in plugin folder
<?php
namespace NamespaceModule_namePluginGridSearch;
class StoreManagerSearch
public function aroundApply(
MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter $subject,
callable $proceed,
MagentoFrameworkDataCollection $collection,
MagentoFrameworkApiFilter $filter
)
$result = $proceed($collection, $filter);
if($collection->getConnection()->tableColumnExists($collection->getMainTable(), 'store_manager'))
$collection->getSelect()->orWhere('`main_table`.store_manager = ?', $filter->getValue());
$parentTable = null;
if($collection->getMainTable() == 'sales_order_grid')
$parentTable = 'sales_order';
else if($collection->getMainTable() == 'sales_invoice_grid')
$parentTable = 'sales_invoice';
else if($collection->getMainTable() == 'sales_shipment_grid')
$parentTable = 'sales_shipment';
else if($collection->getMainTable() == 'sales_creditmemo_grid')
$parentTable = 'sales_creditmemo';
else
$parentTable = 'sales_order';
if($parentTable && $collection->getConnection()->tableColumnExists($parentTable, 'store_manager'))
$collection->getSelect()->join(
['sm' => $parentTable],
"sm.entity_id = main_table.entity_id",
[]
);
$collection->getSelect()->orWhere('`sm`.store_manager = ?', $filter->getValue());
return $result;
add a comment |
Create your custom module or already exit its not issue.
In etc folder di.xml created plugin
<type name="MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter">
<plugin name="bindStoreManagerSearch" type="NamespaceModule_namePluginGridSearchStoreManagerSearch" sortOrder="1" />
</type>
Create StoreManagerSearch.php file in plugin folder
<?php
namespace NamespaceModule_namePluginGridSearch;
class StoreManagerSearch
public function aroundApply(
MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter $subject,
callable $proceed,
MagentoFrameworkDataCollection $collection,
MagentoFrameworkApiFilter $filter
)
$result = $proceed($collection, $filter);
if($collection->getConnection()->tableColumnExists($collection->getMainTable(), 'store_manager'))
$collection->getSelect()->orWhere('`main_table`.store_manager = ?', $filter->getValue());
$parentTable = null;
if($collection->getMainTable() == 'sales_order_grid')
$parentTable = 'sales_order';
else if($collection->getMainTable() == 'sales_invoice_grid')
$parentTable = 'sales_invoice';
else if($collection->getMainTable() == 'sales_shipment_grid')
$parentTable = 'sales_shipment';
else if($collection->getMainTable() == 'sales_creditmemo_grid')
$parentTable = 'sales_creditmemo';
else
$parentTable = 'sales_order';
if($parentTable && $collection->getConnection()->tableColumnExists($parentTable, 'store_manager'))
$collection->getSelect()->join(
['sm' => $parentTable],
"sm.entity_id = main_table.entity_id",
[]
);
$collection->getSelect()->orWhere('`sm`.store_manager = ?', $filter->getValue());
return $result;
Create your custom module or already exit its not issue.
In etc folder di.xml created plugin
<type name="MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter">
<plugin name="bindStoreManagerSearch" type="NamespaceModule_namePluginGridSearchStoreManagerSearch" sortOrder="1" />
</type>
Create StoreManagerSearch.php file in plugin folder
<?php
namespace NamespaceModule_namePluginGridSearch;
class StoreManagerSearch
public function aroundApply(
MagentoFrameworkViewElementUiComponentDataProviderFulltextFilter $subject,
callable $proceed,
MagentoFrameworkDataCollection $collection,
MagentoFrameworkApiFilter $filter
)
$result = $proceed($collection, $filter);
if($collection->getConnection()->tableColumnExists($collection->getMainTable(), 'store_manager'))
$collection->getSelect()->orWhere('`main_table`.store_manager = ?', $filter->getValue());
$parentTable = null;
if($collection->getMainTable() == 'sales_order_grid')
$parentTable = 'sales_order';
else if($collection->getMainTable() == 'sales_invoice_grid')
$parentTable = 'sales_invoice';
else if($collection->getMainTable() == 'sales_shipment_grid')
$parentTable = 'sales_shipment';
else if($collection->getMainTable() == 'sales_creditmemo_grid')
$parentTable = 'sales_creditmemo';
else
$parentTable = 'sales_order';
if($parentTable && $collection->getConnection()->tableColumnExists($parentTable, 'store_manager'))
$collection->getSelect()->join(
['sm' => $parentTable],
"sm.entity_id = main_table.entity_id",
[]
);
$collection->getSelect()->orWhere('`sm`.store_manager = ?', $filter->getValue());
return $result;
answered Mar 17 '18 at 4:30
Vijay-CyberLockerVijay-CyberLocker
1376
1376
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f174669%2fmagento-2-how-to-customise-admin-sales-order-grid-collection%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Any Solution about filter Order grid collection by admin user id?
– mahmoudismail
Jul 2 '18 at 10:00