Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

virtuemart reset session

virtuemart reset session

Hi,

I wonder if you can help with this query.  I am using j1.5, vm 1.13, metamod 2.2 (latest?)

Basically I have a recipe from you used to detect a landing page and display various modules if so. Now I have installed VM and as soon as someone goes to the VM page the session is reset so that all content is displayed.
I think this is because VM must be resetting the session - read this somewhere - but is there a way to get around it?


In case there is here is what I am doing:


[What I first tried to do was use your recipe for referrer to detect a referal link but for some reason couldn't do this as it was redirect to the site but wouldn't pick up the referring url.]


So instead I changed this by getting that url to direct to a specific landing page. That landing page has itemid=82 so i use the following recipe which you have kindly put on your site:

if ($Itemid == 82) { /* or some way to detect we are on the landing page */

  session_start();

  $_SESSION['LANDINGPAGE'] = true;

}

if (@$_SESSION['LANDINGPAGE']) return 63;/* replace with appropriate module id */

else {
  return 62;
}




This works fine as the url is directed to a page ending itemid=82.


But as written above as soon as someone clicks onthe VM page that info is lost and all content is displayed.


Any thoughts?


PS: Thanks for a great module!

britaculous
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: virtuemart reset session

Hi britaculous,

That's an interesting problem isn't it? I wasn't aware that VM was resetting the session like that, and I'd like to understand more about it.

I wonder if this is due to the "cookie check" that VM does when you first visit a VM page? It redirects that page and sets a cookie which it then checks for (I think that's what it is). From memory you might be able to turn that off. It would be interesting to know if turning that off stops the loss of session that you are experiencing. Of course, there might be other reasons you want to keep the cookie check enabled.

Meanwhile, we could change the approach slightly to avoid using sessions entirely. Instead, we could just use a plain old cookie, set to expire in 24 hours, to simulate a "session".

e.g.

if ($Itemid == 82) { /* or some way to detect we are on the landing page */
  $expire=time()+60*60*24;
  setcookie("LANDINGPAGE", "1", $expire);
  return 63;
}
if (@$_COOKIE['LANDINGPAGE']) return 63;/* replace with appropriate module id */
else {
  return 62;
}


I haven't tested this, but it should at least avoid the session problem.

Write back if you need any more help with it...
Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: virtuemart reset session

Hey.

Just checking in as been away for awhile.
Thanks for the suggestions. I will try that out tomorrow and report back.

britaculous
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Dormant:
User Info:
 
Total Users:
5601
Newest User:
deadlin2
Members Online:
0
Guests Online:
116

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked