简体   繁体   中英

Integrating sessions from osCommerce store to main site

I am in the process of integrating user logins with my existing site to an osCommerce shopping cart. The problem is osCommerce stores the sessions in a database and my existing website does not.

I can't get the global login to work. That is, I have to login into the shopping cart separately to use it. I don't want to change the existing login system used by osCommerce but have to copy the session data to the shopping cart somehow so that I can login in from one place and do shopping.

For example, when a user logs in from www.example.com/login.php I register a session variable called $_SESSION['auth.user.id'] .

When I use www.example.com/shopping/shopping_cart.php I need to use the same $_SESSION['auth.user.id'] but in the style of osCommerce. If I use session_start() on top of the shopping_cart.php page before application_top.php I can access the session but the problem is shopping cart specific session details are lost.

If I use session_start() after application_top.php , $_SESSION['auth.user.id'] is lost.

How do I get around this issue?

It looks like you are initializing wrong session variables. Take a look at login.php of OCS:

    tep_session_register('customer_id');
    tep_session_register('customer_default_address_id');
    tep_session_register('customer_first_name');
    tep_session_register('customer_country_id');
    tep_session_register('customer_zone_id');
    tep_session_unregister('noaccount');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM