Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to stop session number changing?


RobinN

Recommended Posts

I'm not a whizz at sessions, so I'm not sure where to look. If someone could point me toward the correct php module...

 

I've taken some of my categories and put them into a custom infobox - it's a "specialties" box. It's like a single level category box, but doesn't have all that lookup code - it is just links done with the current session ID. When you look at the source code, this specialties box looks, in source, exactly like the categories box, as far as link structure and classes...

 

Here's the problem. If I use the specialties box to travel to an index.php category, and buy something, it goes into the cart. If I click another page link in the specialties box (it refs the same sID in the link), I get a *new* session ID, and the cart "empties".

 

Also, if I use the specialties box to travel to an index.php category, and hit reload, I get a *new* sID. (If I go to an index.php from the main category box, then hit refresh, I keep my sID.

 

Where is the source code that releases sIDs, or makes new ones if it thinks they're needed? I've kind of investicated caching - I see that infoboxes that link to items seem to be cached, but I don't have caching turned on..

Link to comment
Share on other sites

another page link in the specialties box (it refs the same sID in the link)
Why do it in that manner? If you make a link the osC way:

<a href="<?php echo tep_href_link('product_info.php', 'products_id=33'); ?>">next page</a>

you won't need to worry about the session id changing.

Link to comment
Share on other sites

That's similar to what I'm doing - but I need to go to the index page for a list of items..

I actually do the source like this in my specialties page, the contents array is filled with...

 

<a href="' . tep_href_link(FILENAME_SPLAV) . '">' . BOX_LAV . '</a><br>

 

Where FILENAME_SPLAV is index.php?cPath=48

 

and more lines of the same stuff, all pointing to index.php with the product group id.

But in this box, when the new page comes up, everything is using a new sID, not the same one from the previous page...

 

I'll try using the different format of tep_href_link and see if that helps...

 

 

Thanks for the idea!

Link to comment
Share on other sites

Thank you Jan - I tried changing the code for the href_link, and that was it - it didn't like the way I was already including the parms in the original filename, instead of using the second parm of the tep_href_link function.

 

Learned something new!

Link to comment
Share on other sites

Curious - I can't see anything in the code of tep_href_link that would care which way you did this. I've done it Robin's original way and it has worked fine for me. (In fact, my "Embed links with SID in description" contrib depends on this working.)

Link to comment
Share on other sites

I can't see anything in the code of tep_href_link that would care which way you did this. I've done it Robin's original way and it has worked fine for me.
Remarkable, I would say that if you do it Robin's way you would get a second question mark in the URL instead of an ampersand and that would mean trouble:

 

index.php?cPath=48?osCid=75894594958588 instead of:

 

index.php?cPath=48&osCid=75894594958588

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...