-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX]: Recent orders are not filtered per store at the customer account page #13257
[FIX]: Recent orders are not filtered per store at the customer account page #13257
Conversation
CollectionFactory $orderCollectionFactory, | ||
Session $customerSession, | ||
Config $orderConfig, | ||
StoreManagerInterface $storeManager, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @coderimus, did you have a look to retrieve the current store id other than via adding a new dependency with StoreManager?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need this new dependency it needs to be backwards compatible, see here: http://devdocs.magento.com/guides/v2.0/contributor-guide/backward-compatible-development/#adding-a-constructor-parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avoelkl thank you so much for your response and review!
I think I can do this without including new dependency using $this->_storeManager
property in the Block class and leave the unit test with the Mock object of the storeManagerInterface. As I can see they are the same objects.
I will implement this change, test it and deploy to review ASAP.
Thank you,
Alex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @coderimus, thanks for your reply. Let me know if you need some help!
Hi @coderimus, |
Hi @avoelkl, Changes explanation The main reason why I added dependency and didn't use parent class property is that during block class instance initialization (while tests are running) the |
Hi @avoelkl sorry if I interrupt you but when you will have free time, please, review uploaded changes. :) Thank you! |
Hi @coderimus! |
Btw I saw there is a failing check from Codacy/PR Quality Review. We can ignore it in this case. |
Hi @avoelkl, |
… customer account page #13257
Description
Hello,
In this PR I provide fix for filtering recent orders block where previously orders were not filtered by store. You can have different accounts with the same emails for stores belong to a website and when you logged-in to one of those stores you will see 5 recent orders but it is possible to see orders from all stores belong to a website.
Main changes:
Magento\Sales\Block\Order\Recent
Magento\Sales\Test\Unit\Block\Order\RecentTest
app/code/Magento/Sales/view/frontend/templates/order/recent.phtml
sizeof()
tocount()
and execute it only once instead of double callBest regards,
Alex
Fixed Issues (if relevant)
N/A
Manual testing scenarios
Recent Orders
section. It will show orders for all storesContribution checklist