-
-
Notifications
You must be signed in to change notification settings - Fork 1.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 solidus stock locations sorting #3954
Fix solidus stock locations sorting #3954
Conversation
86caae0
to
e5e3a32
Compare
e5e3a32
to
d9735eb
Compare
d9735eb
to
7e3993b
Compare
Hey @kennyadsl 👋I thought I would bring the first commit in this PR to your attention, incase you think it's important for the Solidus 3 release. |
Hey @aldesantis 👋. I noticed that you had initially worked on the configurable location sorter before it was affected by a refactor. When you have some time, could you please have a look at this fix? |
guides/source/developers/shipments/stock-locations-sorter.html.md
Outdated
Show resolved
Hide resolved
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.
@ikraamg I think this looks good, thank you!
7e3993b
to
18289fc
Compare
The order of the stock locations that is returned from the configured sorter is lost in the SimpleCoordinator. Previously, the #sort_availability method was used to re-order the stock locations but this was lost during the refactor to allow extending the default Solidus allocation logic. This commit re-orders the stock locations for all methods called by the stock allocators.
This is useful because the Admin UI allows the updating of position value through a drag and drop interface. A more intuitive and user customisable approach.
18289fc
to
f70d648
Compare
@ikraamg Thanks! Can I ask you a little help with the CHANGELOG entry for this change? I'd like to understand what people upgrading to the next version that contains this change need to know during the upgrade process. As far as I got this change can impact how stocks are allocated during checkout so I want to be sure to provide clear instructions about how to be sure they don't have any negative drawback from this. Thanks! |
Sure @kennyadsl 👍 The first commit allows for custom stock allocators to work as expected. In other words, before this fix, Solidus technically ignored any custom allocators that stores had configured. The second commit changes the default solidus stock allocation logic (no custom allocator) by allocating stock first from the warehouse with the Previously, the default behaviour would have been In this image, the stock location named "default" will be used first then the rest by top to bottom: New York, London, Madrid.
|
Description
There are two challenges that this PR aims to solve:
The order of the stock locations that is returned from the configured
sorter is lost in the SimpleCoordinator. This occurs in
the Stock::Availiability class when creating the #stock_item_scope.
Previously, the #sort_availability method
was used to order the stock locations, but this was
lost during the refactor to allow extending the default Solidus
allocation logic.
This re-orders the stock locations for all methods
called by the stock allocators. Namely
on_hand_by_stock_location_id
and
backorderable_by_stock_location_id
This is useful because the Admin UI allows the switching of position through a drag and drop interface.
Currently, this interface is not used. It would be more intuitive to have the default stock location used first,
then select the next stock location based on its
position
column value. For more info, see this issue.Checklist: