Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Registering a session variable


lildog

Recommended Posts

I am trying to register and recall later a session variable. Below it the basic code. Looks like it is pretty straight forward but there is no value for $wa_dest_tax_rate['rate'] on pages used later. Obviously I am doing something wrong.

 

tep_session_register('wa_dest_tax_rate');

 

$wa_dest_tax_rate['rate']='9';

$wa_dest_tax_rate['resultcode']='0';

 

 

Thank you,

lildog

Link to comment
Share on other sites

Here is a little more info. The code in my posts above is in a function file of it's own and is called when tep_get_tax_rate is called. The array is fine at the end of the file but is lost or wiped out when it leaves the function file.

Link to comment
Share on other sites

Is the code constructed like this:

 

if ( !tep_session_is_registered('wa_dest_tax_rate') ) {
 tep_session_register('wa_dest_tax_rate');
}

:unsure:

 

If you just register it programatically without checking to see if it is already there you may be wiping out the contents.

 

I've never screwed with session variables, this is just an "educated guess" on my part.

:blush:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Thanks germ I thought that was it, but I did not add the session variable to the global declaration at the beginning of the function.

 

global $customer_zone_id, $customer_country_id, $billto, $sendto, $cart, $customer_id, $order, $wa_dest_tax_rate;

 

I didn't know it needed to be, but it does?

 

lildog

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...