If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / message stack - when to use add and add_session?

message stack - when to use add and add_session?

Started by kamion on 16 Jan 2012, 3:00 AM · Views: 1,188

Results 1 to 3 of 3
16 Jan 2012, 3:00 AM
#1
kamion avatar

kamion

New Zenner

Join Date:
Mar 2011
Posts:
93
Plugin Contributions:
0

message stack - when to use add and add_session?

Dear experts,

I'm a noob. :wacko: But when should one use the add_session method and when should one use the add method in the messageStack class?

Also, can someone review the messageStack usage in all the payment modules? Most of the payment modules contain lots of messageStack usage code like:

$messageStack->add_session(MODULE_PAYMENT_PAYPALDP_TEXT_REFUND_FULL_CONFIRM_ERROR, 'error');

Surely, it's missing the '$class' field in the method parameters? :shocking:

Cheers,
kamion

16 Jan 2012, 3:27 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: message stack - when to use add and add_session?

  1. add is used when the message doesn't need to be stored in the session.
    add_session is when the message needs to be stored in the session, such as when a page-refresh/reload is about to be triggered

  2. the admin calls to $messageStack don't need the $class parameter, in fact it will break if you use one. And the example you quoted is for code that only runs in admin mode.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Jan 2012, 3:30 AM
#3
kamion avatar

kamion

New Zenner

Join Date:
Mar 2011
Posts:
93
Plugin Contributions:
0

Re: message stack - when to use add and add_session?

Ok. Thanks for the explanation, DrByte. :)