Forums / General Questions / Products disappearing in shopping cart

Products disappearing in shopping cart

Locked

Started by lerpsu on 18 Jul 2010, 3:55 PM · Views: 3,713

Results 21 to 38 of 38
This thread is locked. New replies are disabled.
20 Jul 2010, 9:50 PM
#21
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,569
Plugin Contributions:
59

Products disappearing in shopping cart

wilt:

k, could you also try this as a potential fix

in the extra_configures directory,
create a file called override_cookie_path.php
that contains

<?php define('CUSTOM_COOKIE_PATH', '/'); ```and try again with SSU on I tried but the issue persisted. However, after clearing my cookies from today in Firefox, I was able to add products. So, was this a result of clearing cookies, or implementing the fix. I'll keep testing...
20 Jul 2010, 9:57 PM
#22
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Re: Products disappearing in shopping cart

numinix:

Are others who are experiencing this problem also using Simple SEO URLs or some other SEO URLs script? Does disabling the script help?

Hi, I use CEON's URL add-on, on a 1.3.9d site.. so far no one has reported issues like the one you are experiencing nor can i seem to be able to recreate the problem... (thankfully)

20 Jul 2010, 9:58 PM
#23
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,943
Plugin Contributions:
3

Re: Products disappearing in shopping cart

I expect if you had old cookies that it may interfere with the fix.

Note. I've only been able to reproduce this using Safari 5 on mac. I cannot reproduce the problem on my normal linux/firefox setup.

So the problem appears to be browser based, and not necessarily tied to SSU.

20 Jul 2010, 10:01 PM
#24
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,569
Plugin Contributions:
59

Re: Products disappearing in shopping cart

wilt:

I expect if you had old cookies that it may interfere with the fix.

Note. I've only been able to reproduce this using Safari 5 on mac. I cannot reproduce the problem on my normal linux/firefox setup.

So the problem appears to be browser based, and not necessarily tied to SSU.
For me it happened with Firefox on PC. With others it was Google Chrome on PC. It doesn't seem to be consistent.

20 Jul 2010, 10:21 PM
#25
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,943
Plugin Contributions:
3

Re: Products disappearing in shopping cart

k,

A little more digging suggests this may be a mod_rewrite problem.

Would u be willing to share that rule you are using to remove the index.php from the URI.

(By PM if you want.)

20 Jul 2010, 10:37 PM
#26
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,569
Plugin Contributions:
59

Re: Products disappearing in shopping cart

wilt:

k,

A little more digging suggests this may be a mod_rewrite problem.

Would u be willing to share that rule you are using to remove the index.php from the URI.

(By PM if you want.)
I can show you the htaccess file here:

BOF SSU

#Options +FollowSymLinks
RewriteEngine On

Change "/zencart/ to the correct setting

if your site is located at root folder, then you should have RewriteBase /

Go to your include/configure.php, this value should be the same with the value of DIR_WS_CATALOG

RewriteBase /store/

Deny access from .htaccess

RewriteRule ^.htaccess$ - [F]

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L]

EOF SSU

21 Jul 2010, 7:52 AM
#27
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,943
Plugin Contributions:
3

Re: Products disappearing in shopping cart

k,

Can you try changing

RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L]

to

RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L,PT]

Note. to test this you will also have to remove the
fix I gave earlier.

21 Jul 2010, 6:16 PM
#28
lovingexpress avatar

lovingexpress

New Zenner

Join Date:
Jul 2010
Location:
Spokane, WA
Posts:
25
Plugin Contributions:
0

Re: Products disappearing in shopping cart

I resorted to the paypal button because the zen button wasn't appearing.. how do I delete the paypal button and get the zen button to work? because the zen button never worked..

"With hurricanes, tornadoes, fires out of control, mud slides, and flooding tearing up the country, and with the threat of bird flu and terrorist attacks, "Are we sure this is a good time to take God out of the Pledge of Allegiance?"

21 Jul 2010, 7:39 PM
#29
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Products disappearing in shopping cart

I think this conversation has gone way off the original topic of problems getting products to get into the shopping cart when clicking the add-to-cart button.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Jul 2010, 8:53 PM
#30
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,569
Plugin Contributions:
59

Re: Products disappearing in shopping cart

wilt:

k,

Can you try changing

RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L]

> 
> ```php
RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L,PT]
```Note. to test this you will also have to remove the 
> fix I gave earlier.
Wilt, I haven't tried this because the issue is no longer being reported by customers.

Here is a recap of everything I have done.  I can't say which individual thing could be the SOLUTION:


1. applied the cache fix (did nothing since the cache path was already correct and we use the database method in configure.php).
2. Upgraded Simple SEO URLs (made sure to clear the SSU cache AFTER upgrading)
3. Fixed a bug in /includes/init_includes/init_sessions.php
4. Uploaded a file called override_cookie_path.php with the cookie path definition.
5. cleared the browser's cache and cookies created in the last day.
Remember, a combination of these solutions was used and not until all of them were implemented was the solution resolved.
23 Jul 2010, 9:05 PM
#31
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,943
Plugin Contributions:
3

Re: Products disappearing in shopping cart

Hi,

I quite understand that now you have things working that you don't want to mess around too much with a live store.

recap from my point of view.

The bug seems to be caused by $_SERVER['SCRIPT_NAME'] being set incorrectly based on some URLS generated by SSU.

The $_SERVER['SCRIPT_NAME'] is used to set the cookie path, so if it is set incorrectly, then it will generate multiple cookies and cause Zen Cart to lose session.

The temporary fix is to use a custom override to always set the cookie path to the root directory.

However, it is my belief that the real culprit here is a bug (reported on both PHP and apache forums) that stems from a mod_rewrite that causes some environment variables (such as SCRIPT_NAME to be incorrectly set.

The workaround suggested by apache/php is to set the pass-through flag on mod_rewrite.

As such this is NOT a Zen Cart bug.

although we are happy to help :D

25 Jul 2010, 8:55 PM
#32
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,569
Plugin Contributions:
59

Re: Products disappearing in shopping cart

wilt:

Hi,

I quite understand that now you have things working that you don't want to mess around too much with a live store.

recap from my point of view.

The bug seems to be caused by $_SERVER['SCRIPT_NAME'] being set incorrectly based on some URLS generated by SSU.

The $_SERVER['SCRIPT_NAME'] is used to set the cookie path, so if it is set incorrectly, then it will generate multiple cookies and cause Zen Cart to lose session.

The temporary fix is to use a custom override to always set the cookie path to the root directory.

However, it is my belief that the real culprit here is a bug (reported on both PHP and apache forums) that stems from a mod_rewrite that causes some environment variables (such as SCRIPT_NAME to be incorrectly set.

The workaround suggested by apache/php is to set the pass-through flag on mod_rewrite.

As such this is NOT a Zen Cart bug.

although we are happy to help :D
Can you provide a link to that workaround? Why was it not happening before we upgraded to 1.3.9d?

25 Jul 2010, 9:35 PM
#33
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,943
Plugin Contributions:
3

Re: Products disappearing in shopping cart

Hi,

The workaround was the change I suggested to the mod_rewrite rule

RewriteRule ^(.+) index.php/$1 [E=VAR1:$1,QSA,L,PT]  

The reason that the problem only started to appear in the later 1.3.9 branches is that previously Zen Cart always set the cookie path to the root folder.

This was changed to use $_SERVER['SCRIPT_NAME'] to determine the actual folder that cookies should be stored to.

The idea behind all of the changes to how cookies were stored was to be more compatible with cookie RFC's and increase cross browser compatibility.

14 Aug 2010, 9:19 PM
#34
lerpsu avatar

lerpsu

New Zenner

Join Date:
Jul 2010
Posts:
7
Plugin Contributions:
0

Re: Products disappearing in shopping cart

I said earlier in this topic that I solved the problem temporarily by adding &zenid to my home links.

The problem is that Zen-Cart generates new session every time you go back to the home page, for example myshop.com. If link is something like myshop.com/index.php... everything works just fine with sessions and Zen-Cart won't generate new session. Site seems to generate automatically &zenid to the end of URL although it wouldn't need it.

I have my Zen-Cart installation in mydomain.com/myshop/ and I have modded .htaccess to redirect myshop.com to that folder so I have my shop at myshop.com. Here's my .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} myshop.com
RewriteCond %{REQUEST_URI} !^/myshop
RewriteRule ^(.*)$ myshop/$1 [L]

If I set HTTP_SERVER to 'mydomain.com' and DIR_WS_CATALOG to '/myshop/' it's working without loosing sessions. However, if I make redirect with .htaccess file and I set HTTP_SERVER to 'myshop.com' and DIR_WS_CATALOG to '/' it's loosing sessions. That's happening when link is pointing to HTTP_SERVER . DIR_WS_CATALOG.

I think this has something to do with this redirecting and the $_SERVER['SCRIPT_NAME'] bug wilt described above.

What do I have to do to make my site's sessions work?

Sorry for my English, I hope you understand what I mean :)

14 Aug 2010, 11:02 PM
#35
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,943
Plugin Contributions:
3

Re: Products disappearing in shopping cart

Can you try changing

RewriteRule ^(.*)$ myshop/$1 [L]

to

RewriteRule ^(.*)$ myshop/$1 [L,PT]
15 Aug 2010, 12:02 AM
#36
lerpsu avatar

lerpsu

New Zenner

Join Date:
Jul 2010
Posts:
7
Plugin Contributions:
0

Re: Products disappearing in shopping cart

That didn't work but I solved my problem myself.

I have my installation at Apache server, Cpanel enabled. Myshop.com was installed as parked domain but I changed it to add-on domain. This solved my problem and Zen-Cart won't lose sessions anymore.

15 Aug 2010, 3:28 AM
#37
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Products disappearing in shopping cart

That explains it. A parked domain doesn't work the same as a live domain. The cookies it sets would be for the actual live domain in the account where it was parked. Thus no session operations would ever work. In short: don't do that :blush:

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Aug 2010, 10:20 AM
#38
lerpsu avatar

lerpsu

New Zenner

Join Date:
Jul 2010
Posts:
7
Plugin Contributions:
0

Re: Products disappearing in shopping cart

I thought something like this.

I noticed that when I took copy of my db and made fresh install to another subdirectory. I used that with and without mydomain2.com and noticed difference.

I spent hours and hours with this and fix took only two minutes :S