Adding Custom Sessions

Open to all! Ask other shopowners for help.
Post Reply
levelup
Member
Posts: 15
Joined: Tue Mar 30, 2021 6:16 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 1 time

Adding Custom Sessions

Post by levelup »

I'm trying to figure out the best way to include a session that is created outside of PhoenixCart (but on the same domain).

I've tried to create a hook to check and I wanted to see if I was on the right track.

Code: Select all

  class hook_shop_system_sessionCheck {

    function listen_injectAppTop() {
      
      include($_SERVER['DOCUMENT_ROOT'] . '/session_made_here.php');

      if (isset($_SESSION['test_session'])) {
        // -- Do Stuff Here
      }
    }
  }
Of course, this doesn't work and I'm not even sure if I'm using the right "listen_inject" function.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Adding Custom Sessions

Post by burt »

Could you explain what the SESSION value needs to do in the Phoenix part of your site ?
I am not here to build for you.
I am here to build with you. Let's help each other.
levelup
Member
Posts: 15
Joined: Tue Mar 30, 2021 6:16 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 1 time

Re: Adding Custom Sessions

Post by levelup »

burt wrote: Fri Oct 03, 2025 7:47 am Could you explain what the SESSION value needs to do in the Phoenix part of your site ?
For sure, so the session is created during a separate login before viewing the catalog. The login piece works fine and my only hiccup is including the session that is created after logging in into PhoenixCart.

In the old osCommerce day, I would've put my session check logic in application_top.php. I'm just trying to figure out a proper way to avoid messing with application_top.php via a hook.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Adding Custom Sessions

Post by burt »

I think you're right on using a system hook.
Try injectRedirects listener.
I am not here to build for you.
I am here to build with you. Let's help each other.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Adding Custom Sessions

Post by ecartz »

You can only have one session open at a time. So you should open your special session first; do whatever; close it; open the regular Phoenix session. hook_shop_system__09_sessionCheck->listen_startApplication
levelup
Member
Posts: 15
Joined: Tue Mar 30, 2021 6:16 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 1 time

Re: Adding Custom Sessions

Post by levelup »

Today I learned! Thank you, this will at least steer me in the right direction.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply