Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

session ID problem


yarndog

Recommended Posts

Hello, I am using the sts template system. I have set up my site so that a user can click ADD TO CART right from the category page. This works fine, I go to the shopping cart where I have a session ID. Now if the user clicks CONTINUE it goes back to the previous category they were on before, the session ID is still the same. So far so good. However, when the user clicks on another item's ADD TO CART button they are sent back to the shopping cart...here is the problem...there is now a NEW session ID....I have lost my old session. I am noob, so I have been digging through the application_top.php, shopping_cart.php, and sessions.php files trying to figure out a solution. Not having the best of luck tracing through everything. It seems like everytime the user is sent to the shopping cart a new session starts. How do I prevent this if there is already a session going on for the user and they just want to add more items to their cart? Thanks for your help in advance!!

 

P.S. My php.ini file is set to auto_start sessions off.

Link to comment
Share on other sites

Hello, I am using the sts template system.  I have set up my site so that a user can click ADD TO CART right from the category page.  This works fine, I go to the shopping cart where I have a session ID.  Now if the user clicks CONTINUE it goes back to the previous category they were on before, the session ID is still the same.  So far so good.  However, when the user clicks on another item's ADD TO CART button they are sent back to the shopping cart...here is the problem...there is now a NEW session ID....I have lost my old session.  I am noob, so I have been digging through the application_top.php, shopping_cart.php, and sessions.php files trying to figure out a solution.  Not having the best of luck tracing through everything.  It seems like everytime the user is sent to the shopping cart a new session starts.  How do I prevent this if there is already a session going on for the user and they just want to add more items to their cart?  Thanks for your help in advance!! 

 

P.S.  My php.ini file is set to auto_start sessions off.

 

 

Hello again. I am using the STS template system. After much nashing of the teeth and playing my version of "Jim Rockford" , Slueth, I have finally figured out a SOLUTION to my problems. It wasn't easy, it ain't pretty, but it works!!! Yehaaaa!!! My sessions are working properly and I am not losing the session when the user goes to the shopping cart. The CONTINUE button in my shopping cart shows up and works properly; it goes to the page the user was on just previous to the shopping cart. It is a combination of coding logic errors in application.php, shopping_cart.php, and checkout_success.php, and tracing all the redirections that go on as well as keeping proper track of the sessions.....well...if anyone has been losing their sanity and asking themselves "Why do I continue to exist?" (hey, there is that word CONTINUE again), if you have been struggling to keep your sessions instead of losing them...then let me know...I will do my best to explain my solution....

 

I have to be honest though. I am a bit disappointed in the number of bugs in osCommerce. I find myself continually finding and figuring out bugs that I don't think should be there. A continue button should properly show up in the shopping cart, and when clicked, should go to the proper place. Sessions should not be mysteriously disappearing when clicking on the add to cart button. Part of the struggle is, in my humble opinion, the lack of documentation(I don't find many answers in the knowledge base and as far as I know there is no document that actually shows or lists how all the files or pieces are hooked together), no tutorial of any sort, and it is not always very easy to find the solution or even knowing what questions to ask when it comes to the forums. I would like to see the design and functional aspects separated for I think that is a great part of the struggle, everything is jammed together. I understand that the next milestone will take care of this.

 

Hey, thanks for listening, these are just my humble opinions. I do have to admit though it is kind of fun(at times) doing my "Jim Rockford" and finding the solution that amounts to a needle in a haystack.....although it is murder on my sleep...take care.

Link to comment
Share on other sites

Anytime you add a link, you have to use the tep_href_link function, rather than just an anchor tag. If you don't, then there is no way for OSCommerce to keep track of what session you are in. If you look through OSCommerce, you'll notice that every link in the entire application uses tep_href_link.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Anytime you add a link, you have to use the tep_href_link function, rather than just an anchor tag. If you don't, then there is no way for OSCommerce to keep track of what session you are in. If you look through OSCommerce, you'll notice that every link in the entire application uses tep_href_link.

 

I appreciate the info and feedback. Knowing this solves a lot of problems. The problem I have is I am using the sts template system and my main page is contained in sts_template.html file. I tried putting that function code in that file, but did not work because, I think, the html doesn't know how to translate the php statement. So I ended up creating my own modification that keeps track of the session. I did this modification in the tep_start_session function inside of sessions.php...again I appreciate your help!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...