-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Make "backoffice only" ship methods work and remove option "frontoffice only" #5392
Conversation
… and it's not straight forward to make it work correctly
… ignore ship methods configured for backoffice only Adding both unit and feature tests as this is important enough for that
I want to make sure I understand this - because right now I don't. Here's the use case: Producer sets shipping method A. Producer opens Order Cycle 1. Customer 1 buys and selects Shipping method A. Shipping method A is now attached to their order that the producer sees, and on the customers' order confirmation, and on the customer's invoice. Producer removes (or makes 'back office only' ) shipping Method A because that time slot is full. Producer adds (shipping method B). Order Cycle is STILL OPEN . Customer 2 places an order - and does NOT see the option for Shipping method A. Customer 2 chooses shipping method B. So now we have: Customer 1's invoice with shipping method A - and that method 'sticks' even if the producer opens and adjusts an order. And we have Customer 2's order with shipping method B - and that method sticks even if the producer adjusts the order. And in the reports - each customer will have the correct shipping method showing -- no matter at what time the order cycle is run? My follow up will be what happens to reports when Order Cycle 2 opens with new shipping methods. Sorry - its just this is a really frequent use case right now as users are changing shipping methods to make for pickup windows to ensure physical distancing. I want to make sure I can explain it. |
yes, that's all correct. --- what happens to reports when Order Cycle 2 opens with new shipping methods. I think the answer is nothing. |
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.
Great! Well explained, good test coverage, excellent! 😄
@@ -14,7 +14,7 @@ def current_customer | |||
def available_shipping_methods | |||
return [] if current_distributor.blank? | |||
|
|||
shipping_methods = current_distributor.shipping_methods | |||
shipping_methods = current_distributor.shipping_methods.display_on_checkout.to_a |
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.
Why to_a
?
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.
otherwise it's a relation and it was not working with it.
I cant remember exactly the error but I think it's related to some magic inside TagRuleApplicator (called just after this).
…if mixed with other tables in the same query
Hi @luisramos0, Verified/reproduced the issue:
After this PR:
Ready to go! |
Ah, btw., I saw (a bit too late) that there is a "Line is too long" issue from codeclimate... But I guess this should not influence the test/PR, right? Hope so. |
thanks @filipefurtad0 :-) |
@luisramos0 @filipefurtad0 I'm checking this as part of the release testing and the switch is only available as super admin. Yet when I read the PR description I understand it should be available for manager as well. We introduce a text with #5399 and it's a bit confusing if you cannot see the dropdown as a manager but the text tells you that you can. |
Hey @RachL , Yes, that's a good point. The text is only accurate for superadmins, where the dropdown appears - I missed that detail. If we change the text, maybe we could also mention the tag system to hide shipping methods as well (as you describe in your notes - point 3, in #5367)? I guess this is always an option, which works too. From the release notes, I understood this PR rather as a fix for an existing feature (the dropdown menu for superadmin) and not it's introduction for hub managers. But I guess it would make sense, as hub manager to be able use this dropdown as well. |
@filipefurtad0 Luis has written this in the PR:
This sentence makes me understand that this is not super admin only. If it was designed to be super admin only, it is really not a suitable workaround for #5367 ... So I guess that before releasing for now we need to change the text and include something like "contact your instance manager". But this will increase the support load and won't be something we can do on the long term. |
Hello, it's my mistake, I didnt see that the flag was super admin only. It's a simple line I can remove and it will show the option to anyone with access to the edit page, shall I do that? do you think this will create problems elsewhere? Rob added this if statement to hide this option from managers in 2014 when adapting the spree page to OFN: |
I need to add an automated test to verify automatically the manager can edit the field, but basically, this is the PR: |
What? Why?
This doesnt fix the root cause of #5367 but I think it's a good workaround. And it makes something that was broken work.
The "display on" field of shipping methods was basically ignored everywhere before this PR.
After this PR:
So, re #5367, managers instead of unlinking the ship methods from their enterprise, they can just set them as "backoffice only" so that it's not available on checkout.
What should we test?
We need to verify ship methods tagged with this "back office only" tag do not show up in the checkout. We need to verify these methods will still be available in admin when editing an order.
Release notes
Changelog Category: Fixed
Shipping methods can now be marked "Backoffice only" and that will work: the shipping method will not be available for users in the checkout process but will be available in the backoffice when editing an order.