Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can't read out osCommerce session variables


boris_hu

Recommended Posts

I tried to write some php page outside osCommerce catalog directory. Suppose it is a.php

 

/htdocs/catalog/index.php

/htdocs/mydir/a.php

 

catalog/index.php has a link to a.php. Now my problem is: at a.php, how can I get the session variables from index.php, such as customer_id, etc?

 

I have tried

session_name('osCsid');

session_start();

echo "customer_id: " . $customer_id . " from sessions. " <br>";

 

It doesn't work. crying.gif

 

Any tips? Thanks a lot.

Link to comment
Share on other sites

First off make sure there is something in the session to see by adding the following to your page.

 

<?php
 echo "<pre>";
 print_r($_SESSION);
 echo "</pre>";
?>

 

That should dump the data from the session to the screen.

 

If that gives data in its output then look at the tep_customer_greeting() function in general.php to see how we do it.

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

First off make sure there is something in the session to see by adding the following to your page.

 

<?php
 echo "<pre>";
 print_r($_SESSION);
 echo "</pre>";
?>

 

That should dump the data from the session to the screen.

 

If that gives data in its output then look at the tep_customer_greeting() function in general.php to see how we do it.

 

 

Thanks a lot for your reply. It is empy output in a.php. :(

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...