Forums / Bug Reports / sometimes ie8 add to cart doesn't work on my site

sometimes ie8 add to cart doesn't work on my site

Locked

Started by maxie1971 on 27 Jan 2010, 5:13 PM · Views: 9,785

Results 21 to 37 of 37
This thread is locked. New replies are disabled.
11 Mar 2010, 6:43 PM
#21
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

sometimes ie8 add to cart doesn't work on my site

Bummer...

Thanks Vger

11 Mar 2010, 8:56 PM
#22
shrimp_gumbo_mmmhhh avatar

shrimp_gumbo_mmmhhh

Totally Zenned

Join Date:
Jun 2007
Location:
Texas, USA
Posts:
1,436
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

Maxie1971:

it seems to be fine with all other browsers.... problem being a lot of people use ie8 and as a result there could be a lot of lost opportunity if people can't add things to cart..... and the weird thing is there is no pattern to it....

it all seems to work fine i.e. you have added an item to cart... you continue shopping and then it randomly won't let you add anything else.... but if you close the browser and then return to site your basket is still active.... obviously.... and you are able to add further items to the cart.....

all very strange!!!

I am not seeing any problem with ie8 on my site... in fact those using ie8 are converting better than the other ie versions.

11 Mar 2010, 10:59 PM
#23
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

It may not only relate to IE 8, but to which version of operating system IE 8 is running on. There are various choices - XP, Vista, Windows 7.

It would be good if we can pin down exactly where it's causing problems.

Vger

12 Mar 2010, 5:10 AM
#24
shrimp_gumbo_mmmhhh avatar

shrimp_gumbo_mmmhhh

Totally Zenned

Join Date:
Jun 2007
Location:
Texas, USA
Posts:
1,436
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

Vger:

It may not only relate to IE 8, but to which version of operating system IE 8 is running on. There are various choices - XP, Vista, Windows 7.

It would be good if we can pin down exactly where it's causing problems.

Vger

Firefox with Windows is showing 50% less conversions.
Firefox with Macintosh is showing 50% less conversions.
Chrome with Windows is showing 65% less conversions.
Opera with Windows is showing 70% less conversions.

ALL OF THESE SHOWED 0 Conversions

  1. BlackBerry8520 / BlackBerry
  2. BlackBerry8900 / BlackBerry
  3. BlackBerry9000 / BlackBerry
  4. BlackBerry9530 / BlackBerry
  5. BlackBerry9630 / BlackBerry
  6. BlackBerry9700 / BlackBerry
  7. Blazer / PalmOS
  8. Camino / Macintosh
  9. Chrome / Linux
  10. Chrome / Macintosh
  11. Firefox / FreeBSD
  12. Firefox / Linux
  13. Firefox / SunOS
  14. HTC_TouchDual Mozilla / Windows
  15. HTC_Touch_Diamond2_T5353 Opera / Windows
  16. Internet Explorer / (not set)
  17. Konqueror / Linux
  18. Mozilla / Danger Hiptop
  19. Mozilla / Linux
  20. Mozilla / Windows
  21. Mozilla Compatible Agent / (not set)
  22. Mozilla Compatible Agent / iPhone
  23. NetFront / (not set)
  24. NetFront / Sony
  25. Netscape / Macintosh
  26. Opera / (not set)
  27. Opera / Linux
  28. Opera / Macintosh
  29. Opera / Nintendo Wii
  30. Opera / Samsung
  31. Playstation 3 / Playstation 3
  32. Playstation Portable / Playstation Portable
  33. SAMSUNG-S8000 / Samsung
  34. Safari / (not set)
  35. Safari / Android
  36. Safari / SymbianOS
  37. Safari / Windows
  38. Safari / iPod
  39. SeaMonkey / Linux
  40. SeaMonkey / Windows
  41. Space Bison / (not set)
12 Mar 2010, 4:18 PM
#25
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

Re: sometimes ie8 add to cart doesn't work on my site

running xp sp3 and ie8, no problems on my site's add to cart buttons anywhere. running in both ie7 compatibility and regular mode, no issues.


Zen Cart and it's community are the best!!

12 Mar 2010, 8:37 PM
#26
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: sometimes ie8 add to cart doesn't work on my site

This (probably) doesn't have anything to do with this thread, but I had a client that no matter what I did, said his site looked "broken".

I pulled some hair, twiddled some CSS, and after a bunch of back and forth, discovered his browser was magnifying things like +150% because he did the <ctrl>+ thing on some site and left it there. This caused several weird things to happen that I couldn't "fix" or reproduce.

Some sites seem to hold together pretty well when you zoom in (or out) and some seem to fall apart.

Just something to file away under "W.T.F." if you bump into some strangeness like this.

13 Mar 2010, 7:15 PM
#27
billynytro avatar

billynytro

New Zenner

Join Date:
Mar 2010
Posts:
3
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

lankeeyankee:

running xp sp3 and ie8, no problems on my site's add to cart buttons anywhere. running in both ie7 compatibility and regular mode, no issues.

From what I can tell, this is a problem for some sites and not others, the only common thread is IE. I actually discovered the problem using IE7, and upgraded to IE8 to see if it would solve the problem, but it didn't.

I looked at the other ADD TO CART buttons that DO work in IE8 (for instance, in the all products view, instead of the product detail view) and the main difference in the code is that the working buttons are part of an HTML <form>. I tried modifying the offending button to be part of a form, and was able to click it, but it didn't update the quantities properly in my cart (it would initially add 1 item, but then the number would stay at 1 when I added with subsequent clicks)

Firefox tends to be more forgiving when it comes to HTML tags, so I think it has to do with the fact that this button is not recognized by IE as a <form> and so it doesn't process its input.

Overall: I was unable to fix it, so I moved to Ubercart, which uses Drupal.

15 Mar 2010, 3:15 PM
#28
shrimp_gumbo_mmmhhh avatar

shrimp_gumbo_mmmhhh

Totally Zenned

Join Date:
Jun 2007
Location:
Texas, USA
Posts:
1,436
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

billynytro:

From what I can tell, this is a problem for some sites and not others, the only common thread is IE. I actually discovered the problem using IE7, and upgraded to IE8 to see if it would solve the problem, but it didn't.

I looked at the other ADD TO CART buttons that DO work in IE8 (for instance, in the all products view, instead of the product detail view) and the main difference in the code is that the working buttons are part of an HTML <form>. I tried modifying the offending button to be part of a form, and was able to click it, but it didn't update the quantities properly in my cart (it would initially add 1 item, but then the number would stay at 1 when I added with subsequent clicks)

Firefox tends to be more forgiving when it comes to HTML tags, so I think it has to do with the fact that this button is not recognized by IE as a <form> and so it doesn't process its input.

Overall: I was unable to fix it, so I moved to Ubercart, which uses Drupal.

Was there a particular template you were trying to use with it?

15 Mar 2010, 8:48 PM
#29
wilt avatar

wilt

Oji-san

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

Re: sometimes ie8 add to cart doesn't work on my site

Hi all,

After a lengthy period of research, we have discovered some problems with the way the cookie domain is set in v138 and older versions.

Generally it seems that where this problem surfaces (mainly with domains that do not have www in them, but also some country specific domains) that firefox and other browsers are lenient in their interpretation of the IETF rfc's for the cookie protocol.

However IE8 as far as I know uses the older Netscape definition for the cookie protocol and will most likely barf in these circumstances.

I have a candidate fix for the problem.

This requires changing a few files.

I'm putting together details of the fix, and will post back here shortly.

15 Mar 2010, 9:00 PM
#30
wilt avatar

wilt

Oji-san

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

Re: sometimes ie8 add to cart doesn't work on my site

Candidate fix for cookie/tld bug.
NOTE: This change has not been thoroughly tested. Please ensure that you make backups of any files that you change.

Changes required to

admin/includes/functions/general.php
includes/functions/functions_general.php

In both files the function zen_get_top_level_domain should be replaced with the following

  function zen_get_top_level_domain($url) {
    if (strpos($url, '://')) {
      $url = parse_url($url);
      $url = $url['host'];
    }
    $domain_array = explode('.', $url);
    $domain_size = sizeof($domain_array);
    if ($domain_size > 1) {
      if (SESSION_USE_FQDN == 'True') return $url;
      if (is_numeric($domain_array[$domain_size-2]) && is_numeric($domain_array[$domain_size-1])) {
        return false;
      } else {
        $tld = "";             
        foreach ($domain_array as $dPart)
        {
          if ($dPart != "www") $tld = $tld . "." . $dPart;
        }
        return substr($tld, 1);
      }
    } else {
      return false;
    }
  }

Changes to
admin/includes/init_includes/init_sessions.php
includes/init_includes/init_sessions.php

in both files replace the line that reads

session_set_cookie_params(0, '/', (zen_not_null($current_domain) ? $current_domain : ''));

with

session_set_cookie_params(0, '/', (zen_not_null($current_domain) ? "." . $current_domain : ''));
1 Apr 2010, 4:46 AM
#31
ca_zcuser avatar

ca_zcuser

New Zenner

Join Date:
Oct 2008
Posts:
5
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

wilt:

Candidate fix for cookie/tld bug.
NOTE: This change has not been thoroughly tested. Please ensure that you make backups of any files that you change.

Changes required to

admin/includes/functions/general.php
includes/functions/functions_general.php

In both files the function zen_get_top_level_domain should be replaced with the following

function zen_get_top_level_domain($url) {
if (strpos($url, '://')) {
$url = parse_url($url);
$url = $url['host'];
}
$domain_array = explode('.', $url);
$domain_size = sizeof($domain_array);
if ($domain_size > 1) {
if (SESSION_USE_FQDN == 'True') return $url;
if (is_numeric($domain_array[$domain_size-2]) && is_numeric($domain_array[$domain_size-1])) {
return false;
} else {
$tld = "";
foreach ($domain_array as $dPart)
{
if ($dPart != "www") $tld = $tld . "." . $dPart;
}
return substr($tld, 1);
}
} else {
return false;
}
}

> 
> Changes to 
> admin/includes/init_includes/init_sessions.php
> includes/init_includes/init_sessions.php
> 
> in both files replace the line that reads 
> ```
session_set_cookie_params(0, '/', (zen_not_null($current_domain) ? $current_domain : ''));

with

session_set_cookie_params(0, '/', (zen_not_null($current_domain) ? "." . $current_domain : ''));


This code forgets that init_includes/init_tlds.php prefixes a dot to $current_domain if SESSION_USE_FQDN is turned off, so that you would end up with two dots initially.

This may be going slightly off-topic in the sense that I have some questions that are a little broader than IE8, but they relate to this issue of cookie domains. [RFC 2109](http://www.ietf.org/rfc/rfc2109.txt), which specifies cookies, states that if an explicit domain is specified in a cookie, it must begin with a dot. Why then does Zen Cart have SESSION_USE_FQDN turned on by default? And do any browsers have a problem with a ".www" prefix (note the initial dot)? That seems both useless and odd to me (how often do you have a subdomain in front of "www"?), so maybe there are some browsers that would reject it? My sense is that, in general, it's best to either not explicitly specify a domain, or if you do, leave out the "www" and put an initial dot.
1 Apr 2010, 10:09 AM
#32
wilt avatar

wilt

Oji-san

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

Re: sometimes ie8 add to cart doesn't work on my site

hi,

Thanks for reminding me about the leading '.' problem. I'll tweak the code to take account of that and repost.

On your more general point. The main reason that Zen Cart is set to use the Fully Qualified Domain Name by default is related to shared servers and specifically shared SSL set ups.

With a shared SSL set up the domain names tends to be somethingg like.

http://www.mydomain.com/
https://mydomain.secure.com/

In this instance you DO NOT want to drop a cookie on the partial domain name i.e. .secure.com, as it is then readable by any other users of the shared SSL.

Also having a leading . on a www domain should cause no problems, and as you point out RFC2109 states you must have one. However its my experience that most browsers (safari and firefox certainly do) will automatically prepend the . if it isn't there in the first place.

15 Apr 2010, 2:32 PM
#33
crunch avatar

crunch

Zen Follower

Join Date:
Mar 2009
Posts:
227
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

Does there need to be any updates to this code for the leading '.' problem? Is it an issue? The code is the same in 1.3.9 so it hasn't been tweaked. Just curious. Thanks.

15 Apr 2010, 2:50 PM
#34
wilt avatar

wilt

Oji-san

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

Re: sometimes ie8 add to cart doesn't work on my site

There have been more specific changes made to the cookie code in the new v1.3.9 release.

We would be grateful if anyone who has direct experience of the IE8 issues would give the new code a try and report back.

See release announcement here

http://www.zen-cart.com/forum/showthread.php?p=869151#post869151

and feedback threads here

http://www.zen-cart.com/forum/forumdisplay.php?f=159

15 Apr 2010, 3:03 PM
#35
crunch avatar

crunch

Zen Follower

Join Date:
Mar 2009
Posts:
227
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

I just wanted to add this code to my 1.3.8a install. I am not in a position to be able to upgrade a test copy of my shop to 1.3.9. Probably be another week before I can devote time for that.

I just want to make sure that the code you originally posted (post 30) is ok to add to 1.3.8a without any tweaks for a leading . issue as you said you would make later (in response to CA_ZCUser) and update the code. Thanks.

21 Apr 2010, 9:54 AM
#36
jolla avatar

jolla

New Zenner

Join Date:
Mar 2009
Posts:
18
Plugin Contributions:
0

Re: sometimes ie8 add to cart doesn't work on my site

Tried the code proposed as a solution but did not work. Made my index not appear any more. any possibility to have the amended code? Thank you!

21 Apr 2010, 12:14 PM
#37
drbyte avatar

drbyte

Sensei

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

Re: sometimes ie8 add to cart doesn't work on my site

jolla, if the site ended up blank after you made edits, then you made your edits incorrectly, resulting in PHP errors causing the blank page.

As for "any possibility to have the amended code?", the v1.3.9 code is freely available for download now. You can find the link on the Zen Cart home page.

.
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.