Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can't read out osCommerce session variables


boris_hu

Recommended Posts

Posted

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.

Posted

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)

Posted
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. :(

Archived

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

×
×
  • Create New...