|
| 1 | +diff --git a/vendor/magento/module-customer-segment/Model/Customer.php b/vendor/magento/module-customer-segment/Model/Customer.php |
| 2 | +index 169859499b69..6e95be722f2a 100644 |
| 3 | +--- a/vendor/magento/module-customer-segment/Model/Customer.php |
| 4 | ++++ b/vendor/magento/module-customer-segment/Model/Customer.php |
| 5 | +@@ -460,7 +460,7 @@ public function addVisitorToWebsiteSegments($visitorSession, $websiteId, $segmen |
| 6 | + $visitorSession->setCustomerSegmentIds($visitorSegmentIds); |
| 7 | + |
| 8 | + $value = array_filter($visitorSegmentIds[$websiteId]); |
| 9 | +- $this->_httpContext->setValue(Data::CONTEXT_SEGMENT, $value, $value); |
| 10 | ++ $this->_httpContext->setValue(Data::CONTEXT_SEGMENT, $value, []); |
| 11 | + |
| 12 | + return $this; |
| 13 | + } |
| 14 | +@@ -493,7 +493,7 @@ public function removeVisitorFromWebsiteSegments($visitorSession, $websiteId, $s |
| 15 | + ? array_filter($visitorCustomerSegmentIds[$websiteId]) |
| 16 | + : []; |
| 17 | + |
| 18 | +- $this->_httpContext->setValue(Data::CONTEXT_SEGMENT, $value, $value); |
| 19 | ++ $this->_httpContext->setValue(Data::CONTEXT_SEGMENT, $value, []); |
| 20 | + |
| 21 | + return $this; |
| 22 | + } |
| 23 | +@@ -505,6 +505,7 @@ public function removeVisitorFromWebsiteSegments($visitorSession, $websiteId, $s |
| 24 | + * @param int $websiteId |
| 25 | + * @param array $segmentIds |
| 26 | + * @return $this |
| 27 | ++ * @throws LocalizedException |
| 28 | + */ |
| 29 | + public function addCustomerToWebsiteSegments(int $customerId, int $websiteId, array $segmentIds): Customer |
| 30 | + { |
| 31 | +@@ -522,6 +523,7 @@ public function addCustomerToWebsiteSegments(int $customerId, int $websiteId, ar |
| 32 | + $visitorCustomerSegmentIds[$websiteId] = !empty($visitorCustomerSegmentIds[$websiteId]) |
| 33 | + ? array_unique(array_merge($visitorCustomerSegmentIds[$websiteId], $value)) |
| 34 | + : $value; |
| 35 | ++ sort($visitorCustomerSegmentIds[$websiteId]); |
| 36 | + $this->_customerSession->setCustomerSegmentIds($visitorCustomerSegmentIds); |
| 37 | + |
| 38 | + return $this; |
| 39 | +diff --git a/vendor/magento/module-customer-segment/Model/Layout/DepersonalizePlugin.php b/vendor/magento/module-customer-segment/Model/Layout/DepersonalizePlugin.php |
| 40 | +index 8efa0f07e80c..da5eda4cd7d5 100644 |
| 41 | +--- a/vendor/magento/module-customer-segment/Model/Layout/DepersonalizePlugin.php |
| 42 | ++++ b/vendor/magento/module-customer-segment/Model/Layout/DepersonalizePlugin.php |
| 43 | +@@ -115,13 +115,7 @@ public function afterGenerateElements(LayoutInterface $subject) |
| 44 | + ) { |
| 45 | + $websiteId = $this->storeManager->getWebsite()->getId(); |
| 46 | + $value = $this->customerSegmentIds[$websiteId] ?? []; |
| 47 | +- |
| 48 | +- if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) { |
| 49 | +- $this->httpContext->setValue(Data::CONTEXT_SEGMENT, $value, []); |
| 50 | +- } else { |
| 51 | +- $this->httpContext->setValue(Data::CONTEXT_SEGMENT, $value, $value); |
| 52 | +- } |
| 53 | +- |
| 54 | ++ $this->httpContext->setValue(Data::CONTEXT_SEGMENT, $value, []); |
| 55 | + $this->customerSession->setCustomerSegmentIds($this->customerSegmentIds); |
| 56 | + } |
| 57 | + } |
0 commit comments