Jump to content

read Session variable


Recommended Posts

Hi,

 

i run an affiliate programm with a third party for my shop. My affiliates send potential customers through a link looking like

 

http;//xxxxxxshop.de/?belboon=c1234,c1234

 

I want to read the variable belboon, save it for the session and use it in the order-confirmation. How to do this with presta 1.4.4?

 

in presta 1.2.5 i simply put the following code in init.php:

@session_start();
if(Tools::getValue('belboon')){
 $_SESSION['belboonSession'] = Tools::getValue('belboon');
}

and used it in order-confirmation.tpl with

{$belboonSession}

 

that's unfortunately not working anymore in presta 1.4.4. Anybody an idea how to do it?

 

Thanks in advance!

Link to comment
Share on other sites

Ok, so i suggest you to do 2 test :

1) in the init.php after your little code, just add the following :

p($_SESSION);

this will display the content of $_SESSION var, if it's empty it means that you have no session data, so check your cookies, php.ini session conf, etc.

 

2) If there is a session var not empty, assign it to smarty manually like this :

$smarty->assign('mySession', $_SESSION);

in bottom of init() method of classes/frontController.php classes, then use it in tpl with {$mySession.belboonSession}

Link to comment
Share on other sites

so check your cookies,

 

When I first enter my site via the provided link by the affiliate network, cookies have to be disabled. There is no way around it, because it's a requirement by the affiliate network. So I probably can't save the var in a cookie?

Link to comment
Share on other sites

p($_SESSION); will just display the content of the var $_SESSION in the top of you page. This should display something like :

Array(
  belboonSession => something
)

 

This is usefull to debug PHP arrays.

I think your problem just come from the fact that you store your data in a session, but since you have no cookie, on the next page, PHP is not able to retrieve your stored datas.

Link to comment
Share on other sites

OK, there is no output whatsoever after putting this in init.php.

 

The affiliate network tracks conversions with 3 different methods:

  • cookie tracking
  • flash cookie tracking
  • session tracking (that's what they call it)

For each method I get a test link. The test link for session tracking only works if cookies are disabled. The rules of the affiliate network explicitly state that I'm not allowed to store the information for the session tracking method in a session cookie.

 

 

 

So I need another way to store this piece of information than session cookies.

 

The only option I see right now, is turning back to presta 1.2.5. I desperately hope, there is another way.

 

By the way, thank you for your efforts! :)

Link to comment
Share on other sites

I'm not sure if init.php ist still the right place for my code.

 

My adjustments for the cookie and flash tracking that were made in 1.2.5 in order-confirmation.php had to move to OrderConfirmationController.php to work with 1.4.

 

Maybe there is a better place than init.php? I'm not bound to this piece of code, I just need a way to store thef information one way or another and retrieve it on the order-confirmation.tpl

 

A (non-kosher) way to solve my problem would be to pass on the parameters to the next links the user clicks. I'm allowed to use cookies after the user reached my site, since the order process of presta won't work without cookies.

 

For 1.2.5 we needed 2 days to find a solution, so I still don't give my hopes up. :)

 

By the way this would be a great idea for a payed module, since I'm not the only merchant. with this problem. ;)

Link to comment
Share on other sites

  • 2 weeks later...

bump.

 

i still hope somebody can help me. I don't manage it by myself.

 

The user reaches my site via

http://xxxxxxshop.de/?belboon=c1234,c1234

 

I need to store the information after "?belboon=" somehow (but not in a cookie), so i can use it on the order-confirmation-page.

Link to comment
Share on other sites

  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...