Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.1
Component:
Rules integration
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2011 at 21:06 UTC
Updated:
5 Mar 2012 at 23:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
essbee commentedConfirmed also seeing this bug. Even with the redirect removed the message is not displayed, thus indeed suggesting it is an issue with the event.
Sam
Comment #2
rszrama commentedNah, it's not an issue with the event - it's the way the checkout form itself operates is my guess. We trap messages specially and display them inline with their checkout panes, but that event gets called during the form building process during which I believe messages may be lost.
Comment #3
TyrelDenison commentedHow then could I invoke a warning message on the page I redirect to with rules?
Comment #4
rszrama commentedNot sure yet. I'm guessing the checkout form builder just needs to accommodate messages being displayed during the form building process.
Comment #5
dpolant commentedThe problem seems to be that commerce_checkout_form clears the system messages queue when it attempts to render messages inline for each pane. Thus the messages are not there by the time the user lands on the page specified by the rules redirect.
Fortunately, rules sets a global variable to remind itself to do the redirect after the pages are fully built. It is possible to use this and conditionally prevent the checkout form builder from doing things that clear the message queue.
First-pass patch provided (it is against dev, where this problem does persist).
Comment #6
TyrelDenison commentedThe patch worked great for me. Thanks so much.
Comment #7
rszrama commentedAre we sure the solution needs to be tied specifically to the Rules redirect? It's feasible that modules might also directly be adding messages that we wouldn't want to be wiped out. I've been bitten by that before when I've tried to dump debug data out in a checkout form builder function.
Comment #8
dpolant commentedI was able to use dpm successfully inside the checkout form pane callback and inside commerce_checkout_form, both before and after the message queue clear/render. Any ideas on how to reproduce the message-loss issues you experienced before? It worked for me on a few different checkout pages.
I think the rules redirect issue may be separate from the problem where messages added on the same page-load by other modules are not displaying. The key to preventing redirection-message-loss is knowing when a redirect is going to happen and telling commerce_checkout_form's message renderer not to clear the queue. Without looking at whether a redirect is going to happen, we don't know whether messages should persist into the next page load or whether the queue should be cleared so that the user doesn't see them twice.
I was able to simplify the patch a bit.
Comment #9
essbee commentedGreat patch. Two lines of code and all is as expected.
Works great for me.
Comment #10
rszrama commentedFinally had a chance to review the patch, and it works exactly as expected. I was probably just remembering the other issues from before we updated message handling in the checkout form. Will keep an eye out but glad to fix the immediate issue with this patch. Thanks, Dan. : )