Page 4 of 4 FirstFirst ... 234
Results 31 to 37 of 37
  1. #31
    Join Date
    Oct 2008
    Posts
    5
    Plugin Contributions
    0

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

    Quote Originally Posted by wilt View Post
    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

    PHP Code:
      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($tld1);
          }
        } 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
    Code:
    session_set_cookie_params(0, '/', (zen_not_null($current_domain) ? $current_domain : ''));
    with
    Code:
    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, 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.

  2. #32
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,881
    Blog Entries
    2
    Plugin Contributions
    2

    Default 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.
    Last edited by wilt; 1 Apr 2010 at 11:20 AM.

  3. #33
    Join Date
    Mar 2009
    Location
    Seattle, WA
    Posts
    221
    Plugin Contributions
    1

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

  4. #34
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,881
    Blog Entries
    2
    Plugin Contributions
    2

    Default 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/showth...151#post869151

    and feedback threads here

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

  5. #35
    Join Date
    Mar 2009
    Location
    Seattle, WA
    Posts
    221
    Plugin Contributions
    1

    Default 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.
    Last edited by Crunch; 15 Apr 2010 at 04:08 PM.

  6. #36
    Join Date
    Mar 2009
    Posts
    18
    Plugin Contributions
    0

    Default 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!

  7. #37
    Join Date
    Jan 2004
    Posts
    66,350
    Blog Entries
    7
    Plugin Contributions
    271

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

 

 
Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. Category image resizing works sometimes, sometimes doesn't
    By rossmanngroup in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 26 Dec 2011, 02:43 PM
  2. Drop Shadow Doesn't Work in IE8
    By Bloob in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 11 Jun 2011, 11:06 PM
  3. Add to cart link doesn't work
    By panuma in forum General Questions
    Replies: 6
    Last Post: 30 Nov 2010, 07:46 PM
  4. Add to cart button sometimes doesn't work
    By eastwood in forum Bug Reports
    Replies: 4
    Last Post: 3 Nov 2009, 03:51 PM
  5. Problem, My site doesn't show up sometimes
    By abo_shreek11 in forum Installing on a Linux/Unix Server
    Replies: 5
    Last Post: 20 Apr 2009, 09:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR