Closed (fixed)
Project:
Commerce Donation Flow
Version:
1.0.0-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2020 at 19:31 UTC
Updated:
4 Nov 2020 at 20:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mrweiner commentedComment #3
mrweiner commentedWhoops, setting status
Comment #4
fathershawn@mrweiner I'll have a look - thanks for the patch.
I want to be sure I understand your case. Since the project that we generalized and extracted this from had only one active checkout flow, is your case that there is more than one active flow and these panes are causing an issue in the flow where they are not used?
DonationItemPaneBaseprovides common code for two panes used in our flow, as it also is a base class forMemorialCheckoutPaneComment #6
mrweiner commentedYup, still building the site but there's another, pre-existing "default" checkout flow that we have running. So I'm seeing the errors from these panes when checking out with the Default flow even though the panes are disabled there.
Comment #7
mrweiner commentedComment #8
fathershawnThe reason for throwing an exception is that everything the pane does depends on data from a donation OrderItem. Your case didn't have trouble with
MemorialCheckoutPanebecause it overrides the defaultisVisible()method and includes a check for this object. This patch adds aninVisible()method to the base class and theThankYouPane.A pane that is not visible will not be built in the flow and this will accomplish the same purpose.
Comment #9
fathershawnComment #10
mrweiner commentedStill seeing the errors with #8 applied. Actually, even if I delete all of the logic in
DonationItemPaneBase::create()and return the$instanceearly,DonationItemPaneBase::isVisible()doesn't seem to fire during my Default flow. I suspect thatisVisible()only fires if the pane itself is enabled, whilecreate()seems to be fired no matter what.My initial patch actually broke the donation flow itself, but here's an alternative approach. Just checks the
$configurationto see whether or not the pane is enabled.You could certainly add the isVisible() stuff as well if you wanted to, but that will affect pane visibility when it is enabled.
Comment #12
fathershawnOh! I dropped the the check in
create()forThankYouPanebut missed dropping it inDonationItemPaneBase. That was part of my whole point. It's important not to ask the pane to do it's work without a donation OrderItem, but that shouldn't keep the pane from being instantiated as an object. Throwing an exception increate()prevents instantiation, but putting a check inisVisible()keeps the pane from being presented.Comment #13
fathershawnComment #14
mrweiner commentedAh! Thought you did that on purpose, ha. Alright yeah I see what you're saying. No need to even check whether it's enabled or disabled since Commerce will check on its own after it's been instantiated and then, if it is enabled,
isVisible()will determined whether or not to display it.Looks good to me. Thanks!
Comment #15
fathershawnGreat :-) If it works in your use case, please mark as RTBC! The automated functional test passes so that's a good first sign.
Comment #16
mrweiner commentedComment #18
fathershawn