From 87caac31f6db866a9397a58ffd4950f20af0322e Mon Sep 17 00:00:00 2001 From: KrasnoshchokBohdan Date: Fri, 9 Jan 2026 17:27:18 +0200 Subject: [PATCH] magento/magento2#40027: Product stock alert's website and stock mismatch issue for multi website Enhance product alert queries to include website_id and store_id --- .../Model/ResourceModel/Price/Customer/Collection.php | 11 ++++++++++- .../Model/ResourceModel/Stock/Customer/Collection.php | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ProductAlert/Model/ResourceModel/Price/Customer/Collection.php b/app/code/Magento/ProductAlert/Model/ResourceModel/Price/Customer/Collection.php index bf98e06b28716..6c5b90e4fb859 100644 --- a/app/code/Magento/ProductAlert/Model/ResourceModel/Price/Customer/Collection.php +++ b/app/code/Magento/ProductAlert/Model/ResourceModel/Price/Customer/Collection.php @@ -22,7 +22,16 @@ public function join($productId, $websiteId) $this->getSelect()->join( ['alert' => $this->getTable('product_alert_price')], 'e.entity_id=alert.customer_id', - ['alert_price_id', 'price', 'add_date', 'last_send_date', 'send_count', 'status'] + [ + 'alert_price_id', + 'price', + 'add_date', + 'last_send_date', + 'send_count', + 'status', + 'website_id' => 'alert.website_id', + 'store_id' => 'alert.store_id' + ] ); $this->getSelect()->where('alert.product_id=?', $productId); diff --git a/app/code/Magento/ProductAlert/Model/ResourceModel/Stock/Customer/Collection.php b/app/code/Magento/ProductAlert/Model/ResourceModel/Stock/Customer/Collection.php index 99591c26626cd..f95fc1ace5c65 100644 --- a/app/code/Magento/ProductAlert/Model/ResourceModel/Stock/Customer/Collection.php +++ b/app/code/Magento/ProductAlert/Model/ResourceModel/Stock/Customer/Collection.php @@ -22,7 +22,15 @@ public function join($productId, $websiteId) $this->getSelect()->join( ['alert' => $this->getTable('product_alert_stock')], 'alert.customer_id=e.entity_id', - ['alert_stock_id', 'add_date', 'send_date', 'send_count', 'status'] + [ + 'alert_stock_id', + 'add_date', + 'send_date', + 'send_count', + 'status', + 'website_id' => 'alert.website_id', + 'store_id' => 'alert.store_id' + ] ); $this->getSelect()->where('alert.product_id=?', $productId);