diff --git a/src/Adapter/Shop/Context.php b/src/Adapter/Shop/Context.php index cbc2183f3fd53..3e2f8c16938d7 100644 --- a/src/Adapter/Shop/Context.php +++ b/src/Adapter/Shop/Context.php @@ -72,6 +72,23 @@ public function getContextListShopID($share = false) return Shop::getContextListShopID($share); } + /** + * Return the result of getContextListShopID() for customers usecase + * This handles the "multishop sharing customer" feature setting + * + * @return array + */ + public function getContextListShopIDUsingCustomerSharingSettings() + { + $groupSettings = Shop::getGroupFromShop(Shop::getContextShopID(), false); + + if ($groupSettings['share_customer']) { + return Shop::getContextListShopID(Shop::SHARE_CUSTOMER); + } else { + return Shop::getContextListShopID(); + } + } + /** * Get if it's a GroupShop context. * diff --git a/src/PrestaShopBundle/Resources/config/services/core/grid/doctrine_query_builder.yml b/src/PrestaShopBundle/Resources/config/services/core/grid/doctrine_query_builder.yml index c0eb43acc6cca..46136491a0215 100644 --- a/src/PrestaShopBundle/Resources/config/services/core/grid/doctrine_query_builder.yml +++ b/src/PrestaShopBundle/Resources/config/services/core/grid/doctrine_query_builder.yml @@ -66,7 +66,7 @@ services: arguments: - '@prestashop.core.query.doctrine_search_criteria_applicator' - "@=service('prestashop.adapter.legacy.context').getContext().language.id" - - '@=service("prestashop.adapter.shop.context").getContextListShopID()' + - '@=service("prestashop.adapter.shop.context").getContextListShopIDUsingCustomerSharingSettings()' public: true prestashop.core.grid.quer_.builder.language: