Closed jan-ziehme closed 2 years ago
Hi @jan-ziehme. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, review the Magento Contributor Assistant documentation.
Add a comment to assign the issue: @magento I am working on this
To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
Problem resulted from an old and "incompatible" third party extension. Because of this, the route customer/section/load was cached in FPC. This in combination with a maybe customer-data.js Bug (url was missing the url parameter _={timestamp}) the customers get user data from another users. The JS Call was customerData.reload(['customers', true]).done( ... ).
I close this issue.
Preconditions (*)
Steps to reproduce (*)
<div class="text-center margin-bottom-15" data-bind="scope: 'customer'"><span class="text-small text-bold c-navyblue"><?= __('Login'); ?><br/><?= __('MyAccount'); ?></span><span class="c-denimblue"><?= __('logged in as '); ?><span data-bind="text: customer().fullname"></span></span></div>
Conclusion
Enhance CustomerData Plugin
di.xml
`
`
CustomerData.php
`use Magento\Customer\Api\AddressRepositoryInterface; use Magento\Customer\Helper\Session\CurrentCustomer; use Magento\Directory\Model\CountryFactory;
class CustomerData { /**
@var CurrentCustomer */ protected $currentCustomer;
/**
@var AddressRepositoryInterface */ protected $addressRepository;
/**
@var CountryFactory */ protected $countryFactory;
/**
@var \Magento\Customer\Api\Data\AddressInterface */ private $billingAddress;
/**
@var \Magento\Customer\Api\Data\AddressInterface */ private $shippingAddress;
/**
@throws \Magento\Framework\Exception\LocalizedException */ public function __construct( CurrentCustomer $currentCustomer, AddressRepositoryInterface $addressRepository, CountryFactory $countryFactory ) { $this->currentCustomer = $currentCustomer; $this->addressRepository = $addressRepository; $this->countryFactory = $countryFactory;
}
/**
@return mixed */ public function afterGetSectionData(\Magento\Customer\CustomerData\Customer $subject, $result) { if ($this->currentCustomer->getCustomerId()) { $customer = $this->currentCustomer->getCustomer();
}
/**
@return array */ public function getBillingAddress() { $billingAddress["prefix"] = __($this->billingAddress->getPrefix()); $billingAddress["suffix"] = $this->billingAddress->getSuffix(); $billingAddress["firstname"] = $this->billingAddress->getFirstname(); $billingAddress["lastname"] = $this->billingAddress->getLastname(); $billingAddress["company"] = $this->billingAddress->getCompany(); $billingAddress["telephone"] = $this->billingAddress->getTelephone(); $billingAddress["street"] = implode(" ", $this->billingAddress->getStreet()); $billingAddress["postcode"] = $this->billingAddress->getPostcode(); $billingAddress["city"] = $this->shippingAddress->getCity(); $billingAddress["country"] = $this->getCountry($this->billingAddress->getCountryId());
}
/**
@return array */ public function getShippingAddress() { $shippingAddress = array();
}
/**
Autofill JS
` define([ 'uiComponent', 'Magento_Customer/js/customer-data', 'jquery' ], function (Component, customerData, $) { 'use strict';
}); `
Expected result (*)
Actual result (*)
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.