Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default 404 Error when adding to cart (session related)

    Sometimes when adding a product to the cart you are presented with a 404 error. This happens when a session expires but is not limited to customers who are logged in.

    You can replicate this by adjusting the zenid cookie and clicking 'Add to cart' on a product page.

    I've adjusted the init_sanitize.php file to direct to FILENAME_TIME_OUT as opposed to FILENAME_PAGE_NOT_FOUND which is obviously more helpful but it doesn't explain why this would happen randomly. It only seems to happen when visiting the site again much later in the day or when the session has actually expired.

    Should this not try to combine the zenid provided in post variables to the cookie, rather than simply throwing an error? A lot of my customers are reporting that they can't add products to their cart page...

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

    Default Re: 404 Error when adding to cart (session related)

    Hi,

    There is another thread which covers the incorrect redirtect to page_not_found at http://www.zen-cart.com/showthread.p...ession-timeout

    And we have corrected that in our internal repository to use FILENAME_TIME_OUT

    However we agree that is not optimal, and there should be some better way of handling for customers who are logged out.

    Its not possible to do what you ask (using zenid/cookie) to reinstate a customer session for both techical and security reasons. We are considering some options an will let you know the outcome.

  3. #3
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Re: 404 Error when adding to cart (session related)

    Thanks for the reply and confirmation.

    Is there anything temporarily that can be done?

    Perhaps I could detect referrer page and if contains 'action=add_product' then perhaps reload the page in an attempt to grab a new zenid...?

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

    Default Re: 404 Error when adding to cart (session related)

    Well I guess the real question is, why are you seeing so many complaints from customers.
    Given a standard session timeout of 24 minutes.

    Is your site geared to customers building large baskets, or is there another reason they may 'sit around' before adding products.

    On the techical side

    If the session has timed out, then the securityToken is now no longer accessible, and hence the post of add to cart data will fail.
    Furthermore because the session has timed out, there is a good probability that garbage collection has taken place, so any session information indexed by the zenid will also have disappeared
    because of this there is no information availabe to code to 'know' in what state the system was before the session timed out, so we can't even create a new session for the customer as we have no access to knowing who the customer is.

    Even if the garbage collection had not occured, building a new customer session based on the information indexed by the zenid is fraught with security problems, The whole point of the securityToken is that we are mitigating against some thirdparty gaining access to the customers session through some socially engineered session hijack.
    Last edited by wilt; 26 Jul 2012 at 12:05 PM.

  5. #5
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Re: 404 Error when adding to cart (session related)

    That's where the main issue is... There doesn't neccesarily have to be a 24 minute gap.

    I experienced the problem this morning when testing in Chrome. I opened the browser, visited the website, added something to the cart and voila - 404. There were plenty of pages I hit for a new session to be generated but instead it must have continued to try and use an old one? I had previously visited the website in Chrome a couple of days earlier so it's almost as if old sessions aren't being removed? The settings stored with the cookie seem to be fine though - no expires date set just a "session only" variable.

    My suggestion was to detect when a session has timed out when adding to cart and to create a new session when this happens, rather than telling them it's timed out. If it's a genuine timeout then they should realise when they get to the checkout and it prompts them to login... at which stage their cart will be combined anyway.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: 404 Error when adding to cart (session related)

    What are your settings in Admin->Configuration->Sessions ?
    .

    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.

  7. #7
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Re: 404 Error when adding to cart (session related)

    Quote Originally Posted by DrByte View Post
    What are your settings in Admin->Configuration->Sessions ?
    Session Directory = /home/website8/public_html/cache
    Cookie Domain = True
    Force Cookie Use = True
    Check SSL Session ID = True
    Check User Agent = False
    Check IP Address = False
    Prevent Spider Sessions = True
    Recreate Session = True
    IP to Host Conversion Status = true
    Use root path for cookie path = False
    Add period prefix to cookie domain = False

  8. #8
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: 404 Error when adding to cart (session related)

    wilt and I were talking about this some more:
    Does changing "Force Cookie Use" to false help?
    .

    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.

  9. #9
    Join Date
    Jun 2011
    Posts
    9
    Plugin Contributions
    0

    Default Re: 404 Error when adding to cart (session related)

    Quote Originally Posted by DrByte View Post
    wilt and I were talking about this some more:
    Does changing "Force Cookie Use" to false help?
    The website is currently live for a client with no staging environment available so I will have to test this on another website but I'll give it a trial and let you know of the results. Thanks.

  10. #10
    Join Date
    Aug 2012
    Posts
    48
    Plugin Contributions
    0

    Default Re: 404 Error when adding to cart (session related)

    I'm curious to know the results. I'm experiencing similar issues. Thank you!

 

 

Similar Threads

  1. Replies: 3
    Last Post: 8 Jun 2015, 09:08 PM
  2. Replies: 14
    Last Post: 29 Dec 2012, 08:51 PM
  3. v150 Receiving a 404 Error When Adding to Cart
    By cmorrow in forum General Questions
    Replies: 1
    Last Post: 13 Aug 2012, 06:41 PM
  4. 404 error when adding product
    By ajs002004 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 12 Mar 2010, 05:26 AM
  5. 404 Error when adding products to site
    By ieguana in forum General Questions
    Replies: 1
    Last Post: 1 Oct 2008, 11:40 AM

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