diff --git a/vendor/magento/module-catalog-permissions/Plugin/Wishlist/Block/Customer/ApplyWishlistItemsPermissions.php b/vendor/magento/module-catalog-permissions/Plugin/Wishlist/Block/Customer/ApplyWishlistItemsPermissions.php new file mode 100644 index 000000000000..8921a9a79062 --- /dev/null +++ b/vendor/magento/module-catalog-permissions/Plugin/Wishlist/Block/Customer/ApplyWishlistItemsPermissions.php @@ -0,0 +1,110 @@ +permissionsConfig->isEnabled()) { + return $result; + } + $customerGroupId = $this->customerSession->getCustomerGroupId(); + $connection = $this->resource->getConnection(); + + $fromPart = $result->getSelect()->getPart(Select::FROM); + + $conditions[] = 'perm.product_id = main_table.product_id'; + $conditions[] = $connection->quoteInto('perm.store_id = ?', $this->storeManager->getStore()->getId()); + $conditions[] = $connection->quoteInto('perm.customer_group_id = ?', $customerGroupId); + $joinConditions = join(' AND ', $conditions); + $tableName = $this->tableMaintainer->resolveMainTableNameProduct($customerGroupId); + + if (!isset($fromPart['perm'])) { + $result->getSelect()->joinLeft( + ['perm' => $tableName], + $joinConditions, + ['grant_catalog_category_view', 'grant_catalog_product_price', 'grant_checkout_items'] + ); + } + + if (isset($fromPart['perm'])) { + $fromPart['perm']['tableName'] = $tableName; + $fromPart['perm']['joinCondition'] = $joinConditions; + $result->getSelect()->setPart(Select::FROM, $fromPart); + return $result; + } + + if (!$this->helper->isAllowedCategoryView()) { + $result->getSelect()->where('perm.grant_catalog_category_view = ?', Permission::PERMISSION_ALLOW); + } else { + $result->getSelect()->where( + 'perm.grant_catalog_category_view != ?' . ' OR perm.grant_catalog_category_view IS NULL', + Permission::PERMISSION_DENY + ); + } + + return $result; + } +} diff --git a/vendor/magento/module-catalog-permissions/etc/frontend/di.xml b/vendor/magento/module-catalog-permissions/etc/frontend/di.xml index 4d0c9657903c..ca4a73da4784 100644 --- a/vendor/magento/module-catalog-permissions/etc/frontend/di.xml +++ b/vendor/magento/module-catalog-permissions/etc/frontend/di.xml @@ -17,4 +17,8 @@ + + + diff --git a/vendor/magento/module-catalog-permissions/etc/graphql/events.xml b/vendor/magento/module-catalog-permissions/etc/graphql/events.xml new file mode 100644 index 000000000000..c1605a6f688f --- /dev/null +++ b/vendor/magento/module-catalog-permissions/etc/graphql/events.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/vendor/magento/module-multiple-wishlist/Helper/Data.php b/vendor/magento/module-multiple-wishlist/Helper/Data.php index 9dcb51edf734..3611eceb794e 100644 --- a/vendor/magento/module-multiple-wishlist/Helper/Data.php +++ b/vendor/magento/module-multiple-wishlist/Helper/Data.php @@ -242,7 +242,7 @@ public function getWishlistItemCount(Wishlist $wishlist) ) { $count = $collection->getItemsQty(); } else { - $count = $collection->getSize(); + $count = count($collection->getItems()); } return $count; }