-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Issue: ready for confirmationReported on 2.4.6Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.
Description
Preconditions and environment
- Magento version >= 2.4.6
- 1 website
- 2 store groups with 4 store views each
Preconditions
- customer A added products to compare list and has logged out
- customer B added products to compare list and has logged out
- customer C added products to compare list and has not yet logged out
- customer D exists with remote assistance enabled
Steps to reproduce
- admin > login-as-customer with customer D
- frontend > log out
- admin > login-as-customer with customer D
sometimes, step 1. alone suffices for the bug to appear.
Expected result
compare lists for customers A and B stay with customers A and B respectively
Actual result
compare lists of customer A and B get transferred to customer D
Additional information
DB Query debugging results:
- upon logout, visitor_id for compare items get set to 0.
- login-as-customer has no visitor ID upon login, so it assumes that all compare items with visitor ID 0 belongs to current customer and updates customer_id in compare item table accordingly
this patch seems to fix it
diff --git a/vendor/magento/module-catalog/Model/ResourceModel/Product/Compare/Item.php b/vendor/magento/module-catalog/Model/ResourceModel/Product/C
index ff29a5a..f05f511 100644
--- a/vendor/magento/module-catalog/Model/ResourceModel/Product/Compare/Item.php
+++ b/vendor/magento/module-catalog/Model/ResourceModel/Product/Compare/Item.php
@@ -152,7 +152,7 @@ class Item extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
*/
public function updateCustomerFromVisitor($object)
{
- if (!$object->getCustomerId()) {
+ if (!$object->getCustomerId() || !$object->getVisitorId()) {
return $this;
}
additionally, sometimes login-as-customer won't work (customer section data error
{"message":"Item (Magento\\Catalog\\Model\\Product\\Interceptor) with the same ID "35910" already exists."}
)
see #40205
#40205
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Issue: ready for confirmationReported on 2.4.6Indicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.
Type
Projects
Status
Ready for Confirmation