Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why do my cart contents disappear?


joejoe04

Recommended Posts

Hi,

I am having some trouble with my oscommerce shopping cart. My site is usedsemitires.com. When I add a product to the cart, then continue to try to shop for other products, if I click on one of my links to other pages, the cart information is completely erased. I have created my own php pages to go along with the shopping cart on my pages so I dont know if this is what is causing this. But if you look at the site, the navigation on the left has links to the pages I created and also has a link to the contact_us.php page, which as you probably know, came as part of the cart. Even if I try clicking on the link to that, the cart info is still erased. I code my links as follows: <a href="https://usedsemitires.com/tire/catalog/index.php">Tires</a>. If I click on one of the links from the header, the cart information remains intact though. So I was just wondering if you had any idea what might be happening. I know that it probably could be a lot of things but if you could even just offer some suggestions of things i might be able to try i would greatly appreciate it. Thanks!

Link to comment
Share on other sites

This is happening because you are losing the OSC session when you move from the store to one of your external pages. OSC tracks a user by their unique session ID so when this disappears, the contents of their cart (and all other related OSC session data) goes with it.

 

This contribution fixes the problem:

 

http://www.oscommerce.com/community/contributions,3257

Link to comment
Share on other sites

This is happening because you are losing the OSC session when you move from the store to one of your external pages. OSC tracks a user by their unique session ID so when this disappears, the contents of their cart (and all other related OSC session data) goes with it.

 

This contribution fixes the problem:

 

http://www.oscommerce.com/community/contributions,3257

 

Thank you sir, very kind of you!!

Link to comment
Share on other sites

Hey Jason, this sounded easy enough but I still cant get it to work. First of all, are you sure that this is the problem b/c, as I said before, my navigation bar consists of links to my pages I created and also to index.php and contact_us.php which are a part of the cart. But even if I click on one of those two links, the cart contents are still erased. I'm sorry, I dont really know what I'm talking about here. Anyways, there were not very good instructions with the contribution you suggested. I added the sessions.class.php to my catalog folder, where all my other pages are as well. Then I tried to add some of the code from the example to one of my pages...

 

<?php

//// change the paths below to match your site!!

include_once('includes/configure.php');

include_once('includes/database_tables.php');

include_once('sessions.class.php');

?>

 

but it still was not working.

If you could tell me what I'm doing wrong I would greatly appreciate it.

Link to comment
Share on other sites

Sorry - when you said you'd created your own pages I thought you had pages/sections *outside* of the store web root (which is quite common). I took a closer look and saw this isn't the case - so you don't need that contribution. The problem you are experiencing is due to the way you are coding your links. You must use OSC's tep_href_link() function which keeps the session alive. So change this:

 

<a href="https://usedsemitires.com/tire/catalog/our_guarantee.php">Our Guarantee</a>

 

to this:

 

<a href="<?php echo tep_href_link(FILENAME_OUR_GUARANTEE); ?>" class="headerNavigation">Our Guarantee</a>

 

Make sure you add FILENAME_OUR_GUARANTEE to your /includes/filenames.php file:

 

define('FILENAME_OUR_GUARANTEE', 'our_guarantee.php');

 

If you look at OSC's code - you will see that every link throughout the site is coded this way.

 

Not sure why are all your pages are over an https:// connection? There is no sensitive data being passed between the browser and the webserver on your info pages so encrytpting these pages is completely uneccessary and just slows your site down.

Link to comment
Share on other sites

Thanks again Jason, you have been very helpful. One more question though regarding the https if you dont mind. Should I just use it on pages such as the checkout/payment process and account creation pages where there is sensitive data there? Or am I misunderstanding the use of https? Thank you again, you have definitely saved me some time.

 

One more side note though just for your information. I started the creation of this site on the domain joedisalvo.com which I eventually transfered to usedsemitires.com. But if you visit joedisalvo.com, the content is still there and if you click on one of the links to another page, the cart contents do not get erased for whatever reason even though they are also linked the wrong way. I cant be sure, but I'm almost positive that at one point earlier in the process of making the site, the contents didnt erase on usedsemitires domain either. Just thought you might be interested to know that because it seems weird to me and I'm kind of curious as to why. If you are interested, visit joedisalvo.com to see for yourself. Otherwise thank you again for all your help and have a good one.

Link to comment
Share on other sites

Should I just use it on pages such as the checkout/payment process and account creation pages where there is sensitive data there?

Correct.

 

OSC does the switch automatically when moving to and from these sections. Just ensure your SSL is correctly installed and that ENABLE_SSL in your config file is set to true.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...