Zen Cart Logo
Forums / General Questions / message stack - when to use add and add_session?

message stack - when to use add and add_session?

Views: 1,186

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,513
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.

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. :)