Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support Thread for : Customer Never Loses Cart .


925SILVER4U

Recommended Posts

Contribution at : http://www.oscommerce.com/community/contributions,4738

 

 

Try adding some items to your cart on amazon.com (even without having an account with them) - close your browser, or return after 2-3 days - you will see that the items you added to your cart are still there.

 

Try it on your oscommerce store - it doesnt happen - but this contribution will do that for you.

Link to comment
Share on other sites

Contribution at : http://www.oscommerce.com/community/contributions,4738

Try adding some items to your cart on amazon.com (even without having an account with them) - close your browser, or return after 2-3 days - you will see that the items you added to your cart are still there.

 

Try it on your oscommerce store - it doesnt happen - but this contribution will do that for you.

 

Can you highlight and comment the changes for those like me who can't just replace the file ?

 

Thanks

Outside links in signatures are not allowed!

Link to comment
Share on other sites

Can you highlight and comment the changes for those like me who can't just replace the file ?

 

Thanks

 

Line 148 - Line 159 in /includes/application_top.php

 

 

// *** INTACT SHOPPING CART MODIFICATIONS

 

// set the session cookie parameters

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(604800, $cookie_path, ""/*$cookie_domain*/);

} elseif (function_exists('ini_set')) {

ini_set('session.cookie_lifetime', '604800');

ini_set('session.cookie_path', $cookie_path);

ini_set('session.cookie_domain', ""/*$cookie_domain*/);

 

}

// *** END MODIFICATIONS ***

 

 

 

 

 

In /includes/functions/sessions.php

 

Add this :

 

// **** SET SESSION LIFETIME HERE ***

$SESS_LIFE = 604800; //7 DAYS *24 HOURS *60 MINUTES *60 SECONDS

// *** SET SESSION LIFETIME HERE

 

 

BEFORE:

 

function _sess_open($save_path, $session_name) {

return true;

}

Link to comment
Share on other sites

Line 148 - Line 159 in /includes/application_top.php

// *** INTACT SHOPPING CART MODIFICATIONS

 

// set the session cookie parameters

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(604800, $cookie_path, ""/*$cookie_domain*/);

} elseif (function_exists('ini_set')) {

ini_set('session.cookie_lifetime', '604800');

ini_set('session.cookie_path', $cookie_path);

ini_set('session.cookie_domain', ""/*$cookie_domain*/);

 

}

// *** END MODIFICATIONS ***

In /includes/functions/sessions.php

 

Add this :

 

// **** SET SESSION LIFETIME HERE ***

$SESS_LIFE = 604800; //7 DAYS *24 HOURS *60 MINUTES *60 SECONDS

// *** SET SESSION LIFETIME HERE

BEFORE:

 

function _sess_open($save_path, $session_name) {

return true;

}

Well, I made these changes, but when I add something to my cart and then leave the site (just go to another site or close the browser) and go back, there is nothing in the cart. I tested using IE 7 with a medium (default) setting on privacy and with Mozilla Firefox 2 set to accept cookies and keep them until they expire.

Link to comment
Share on other sites

Well, I made these changes, but when I add something to my cart and then leave the site (just go to another site or close the browser) and go back, there is nothing in the cart. I tested using IE 7 with a medium (default) setting on privacy and with Mozilla Firefox 2 set to accept cookies and keep them until they expire.

 

Try it on my site 925silver4u.com it works.

 

Perhaps its your Sessions settings in Configuration.

Link to comment
Share on other sites

Try it on my site 925silver4u.com it works.

 

Perhaps its your Sessions settings in Configuration.

 

 

Hello,

 

We are also interested in this very useful contribution. Please let us know the Sessions Settings that you are using so that we could configure the same accordingly.

 

Thanks,

 

Lakshmanan S.

Link to comment
Share on other sites

Hello,

 

We are also interested in this very useful contribution. Please let us know the Sessions Settings that you are using so that we could configure the same accordingly.

 

Thanks,

 

Lakshmanan S.

 

Here you are:

 

Session Directory <CENSORED>

Force Cookie Use True Info

Check SSL Session ID True Info

Check User Agent False Info

Check IP Address False Info

Prevent Spider Sessions True Info

Recreate Session False Info

Link to comment
Share on other sites

Here you are:

 

Session Directory <CENSORED>

Force Cookie Use True Info

Check SSL Session ID True Info

Check User Agent False Info

Check IP Address False Info

Prevent Spider Sessions True Info

Recreate Session False Info

 

Thanks.

Link to comment
Share on other sites

Nice contribution...one that I felt was always needed in OSCommerce!

 

One thing I noticed is that with the contribution installed, the cart does remain for the customer, but that when the customer returns again to the website the shopping cart shows it is empty (on the first page loaded) until the customer visits their cart.

 

Is there a way to pull the cart info on the first click back into the site?

 

It is a bit missleading...

 

If we can figure out how to retrieve the cart on the first page loaded from the site...it would be better!

 

Keep up the good work!!

Link to comment
Share on other sites

// **** SET SESSION LIFETIME HERE ***

$SESS_LIFE = 604800; //7 DAYS *24 HOURS *60 MINUTES *60 SECONDS

// *** SET SESSION LIFETIME HERE

 

 

What happens in the sessions table if you are storing in MySQL? Would not the sessions table hold all sessions for 7 days?

 

This would make the sessions table get huge on busy site.

 

Can anyone comment on this?

Link to comment
Share on other sites

What happens in the sessions table if you are storing in MySQL? Would not the sessions table hold all sessions for 7 days?

 

This would make the sessions table get huge on busy site.

 

Can anyone comment on this?

 

 

Yes - I have to yet figure another workaround for this; I am not a very good php and I released this hoping it would be improved by others.

Link to comment
Share on other sites

Nice contribution...one that I felt was always needed in OSCommerce!

 

One thing I noticed is that with the contribution installed, the cart does remain for the customer, but that when the customer returns again to the website the shopping cart shows it is empty (on the first page loaded) until the customer visits their cart.

 

Is there a way to pull the cart info on the first click back into the site?

 

It is a bit missleading...

 

If we can figure out how to retrieve the cart on the first page loaded from the site...it would be better!

 

Keep up the good work!!

 

I am not sure what you mean by this - perhaps its conflicting with another contribution you have - as on my website the customer can see the cart right away. Have a try for yourself: www.925silver4u.com .

Link to comment
Share on other sites

  • 4 weeks later...

works like it should for me, good contribution--

 

I agree figuring a way for the sql table to not get overloaded will be good--hmmm

 

thanks!

"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Link to comment
Share on other sites

  • 7 years later...

Old topic I know, but this has been an issue with oscommerce since the beginning.

 

Been testing this for a few hours, seems like a pretty good solution. Flaw I see though is the cookie expiration does not update when you visit the site again when I view my cookies in Chrome. The session expiration in mysql seems to be renewing, but not the cookie expiration. So, no matter if you visit the site again your session (and cart) is going to be lost after 7 days. 

 

I'm thinking of setting the cookie to expire 10 years from now so it is essentially never expires to fix this problem.

 

Any drawbacks to my solution that anyone sees?

 

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Cookies should not be forced, in my opinion, so I can't answer your question directly. But keep in mind that cookies are stored on the visitors computer and it is common practice to clear them nowadays so setting them for such a long period probably wouldn't make much of a difference. If keeping the customers data over a long period is important to you, you may want to install the auto login addon. That will keep your customers cart until deleted from the shop since it becomes part of their account. Of course, if they delete the cookies, or use a different browser, they won't be logged in.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

  • 2 months later...

Thanks Jack.

 

Second issue I've been encountering is the session table becomes huge, slowing down the site dramtically and backing up mysql processing. We're on a dedicated server with 4 quad processors 16 gb ram so the hardware is likely not the fault. The session table has grown to 20mb  

 

One thing we're trying is setting the session to something smaller like 4 hours and the cart cookie to 30 days.

 

In basic testing this seems fine, but I'm worried about other variables I might not be aware of. Will this have any adverse effects?

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

I can't think of any problems it might cause, though 4 hours is very low. You may want to look at my Database Optimizer. It allows you to keep the tables, like sessions, to a certain limit.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...