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
Started by maxie1971 on 27 Jan 2010, 5:13 PM · Views: 9,785
Totally Zenned
Bummer...
Thanks Vger
Totally Zenned
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.
Past Contributor
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
https://www.terranetwork.net/zencart-web-hosting.php
UK based Zen Cart Hosting
Totally Zenned
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
Totally Zenned
Totally Zenned
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.
New Zenner
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.
Totally Zenned
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?
Oji-san
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.
Oji-san
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 : ''));
New Zenner
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.phpIn 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.
Oji-san
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.
Zen Follower
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.
Oji-san
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
Zen Follower
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.
New Zenner
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!
Sensei
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.
Tell staff why this post should be reviewed.