PaoloPinkel Posted October 5, 2011 Share Posted October 5, 2011 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 More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 Hello, try this variable in your template : {$smarty.session.belboonSession} Regards Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 Putting {$smarty.session.belboonSession} in order-confirmation.tpl shows no result with @session_start(); if(Tools::getValue('belboon')){ $_SESSION['belboonSession'] = Tools::getValue('belboon'); } in init.php Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 Well I ask a stupid question : is this variable set ? I mean, did you browse first the url yourwebsite.com/yourpage.php?belboonSession=test ? Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 yes i did Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 Ah but i have to say, that before i test the link - i have to disallow cookies in my browser (requirement by the network). Immediately afterwards i turn cookies back on Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 Is the "force compile" option in "BO -> tools -> performance" set to ON ? Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 yes, cache is disabled and smarty compilation is forced Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 When you put this code in template, what do you see ? Test={$smarty.session} Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 it's empty: Test= Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 to be clear: i disable cookies --> i click the link --> i enable cookies Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 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 More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 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 More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 Yeah PHP sessions need cookies : all data are stored in a file on your server, but the ID which do the link between you and the server is stored in a cookie. Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 I don't get what you just wrote. Can you please try to explain once more? When I put p($_SESSION); in my init.php, i'm not sure where to look for the output. Link to comment Share on other sites More sharing options...
Raphaël Malié Posted October 5, 2011 Share Posted October 5, 2011 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 More sharing options...
PaoloPinkel Posted October 5, 2011 Author Share Posted October 5, 2011 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 More sharing options...
Raphaël Malié Posted October 6, 2011 Share Posted October 6, 2011 Well I don't see why this code would work on 1.2.5 instead of 1.4, sorry Link to comment Share on other sites More sharing options...
PaoloPinkel Posted October 6, 2011 Author Share Posted October 6, 2011 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 More sharing options...
PaoloPinkel Posted October 18, 2011 Author Share Posted October 18, 2011 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 More sharing options...
yabonga Posted June 8, 2012 Share Posted June 8, 2012 Hi PaoloPinkel, hast du mittlerweile das Problem lösen können und den Belboon-Trackingcode in PS integriert? Gruß, Dennis Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now