Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    bug Checkout when not logged in or with empty cart

    Hi,

    In ZenCart v1.3.7 trying to checkout when not logged in or when your cart is empty sends you to the timeout page.

    In includes\modules\pages\checkout_shipping\header_php.php the code says:
    PHP Code:
    // if there is nothing in the customers cart, redirect them to the shopping cart page
      
    if ($_SESSION['cart']->count_contents() <= 0) {
        
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));
      } 
    I think this should read:
    PHP Code:
    // if there is nothing in the customers cart, redirect them to the shopping cart page
    if ($_SESSION['cart']->count_contents() <= 0) {
      
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));

    This will redirect the user to the shopping cart page rather than the time out page if their cart is empty.

    Also the above code should be moved so that it is after the checks to see if the user is logged in. The user will then be correctly redirected to the login page if they are not logged in rather than being sent to the timeout page.

    Hope this helps.

    Christian.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Checkout when not logged in or with empty cart

    Actually ... if we went to checkout_shipping at the moment of the click ... the screen knew we had content in the shopping cart ...

    However ... you went outside to play with the dog for 24 minutes ... and the session timed out ...

    What good is going to the empty shopping cart? I'd rather be reminded that my session timed out and log in so that I get my cart back and hopefully complete my order ...

    Does that make sense?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    Default Re: Checkout when not logged in or with empty cart

    Hi,

    Quote Originally Posted by Ajeh View Post
    What good is going to the empty shopping cart? I'd rather be reminded that my session timed out and log in so that I get my cart back and hopefully complete my order ...
    The problem is that the code as is does not check for a timed out session it checks if the shopping cart is empty. If the user has a valid session but an empty shopping cart and they try and check out they are told that their session has timed out, which it has not. There should be a seperate check for a timed out session.

    It looks as if the code originally redirected the user to the shopping basket as per the comment but someone tried a quick fix for a timed out session. An empty cart does not mean a timed out session, it means the cart is empty (or the session has timed out and cart contents cannot be checked).

    Regards,
    Christian.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Checkout when not logged in or with empty cart

    If you go to the empty shopping_cart you will note that there isn't a link to checkout_shipping ...

    If you empty your shopping_cart you will note that there isn't a link in the header for the checkout_shipping ...

    If you have your shopping_cart sidebox always on ... you will note when empty that there isn't a link to checkout_shipping ...

    If you add something to the shopping_cart and were logged in ... then move somewhere ... or even stay on the shopping_cart page ... you will see the links are now active to go to the checkout_shipping ...

    But, if you sit there for 24 minutes (the session times out) and you now click one of the displayed links to the checkout_shipping ... you must have had products in the shopping_cart before this time out occured ... or you would not have seen the links to get to the checkout_shipping ...

    By default ... if you do get to checkout_shipping with nothing in the cart ... it is therefor assumed you had to have had a session timeout or this never could have happened ...

    So the whoops! you timed out is the better choice here so the customer will try to login again and recover their cart so that they can continue to shop or proceed to checkout_shipping normally ...

    Make more sense?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    Default Re: Checkout when not logged in or with empty cart

    Quote Originally Posted by Ajeh View Post
    If you go to the empty shopping_cart you will note that there isn't a link to checkout_shipping ...

    If you empty your shopping_cart you will note that there isn't a link in the header for the checkout_shipping ...

    If you have your shopping_cart sidebox always on ... you will note when empty that there isn't a link to checkout_shipping ...
    This is the default out of the box behaviour but it is not always so. Some people have the checkout button always present and this was the case on the site I have just set up. The client wanted the checkout button always present so that the interface was consistent and buttons where not appearing and disappearing.

    Assuming that an empty cart means the session timed out is not always a valid assumption, especially in a product that is meant to be configurable as Zen Cart is. Wouldn't it be better to explicitly check for a session timeout? Something like...

    PHP Code:
    // if the session has timed out then redirect the customer to the time out page
    if (!isset($_SESSION['cart']))
      
    zen_redirect(zen_href_link(FILENAME_TIME_OUT));

    // if there is nothing in the customers cart, redirect them to the shopping cart page
    if ($_SESSION['cart']->count_contents() == 0)
      
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); 
    Regards,
    Christian.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Checkout when not logged in or with empty cart

    That might be more logical ... we will play with the idea and see what else can break ...

    Thanks for the suggestion!
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v154 add to cart not working when not logged in
    By delia in forum General Questions
    Replies: 17
    Last Post: 23 Jun 2016, 02:10 PM
  2. 1064 when clicking paypal checkout button and not logged in as a user
    By Phil C in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 16 Apr 2014, 03:34 PM
  3. v151 Display product with tax does not when customer is logged in
    By jeking in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 16
    Last Post: 17 Feb 2014, 11:22 AM
  4. Empty cart when checkout CCnow
    By Macedonium in forum Addon Payment Modules
    Replies: 0
    Last Post: 18 Mar 2008, 04:21 PM
  5. Problem with logging in when shopping cart is empty
    By DML73 in forum General Questions
    Replies: 2
    Last Post: 21 Dec 2007, 12:21 AM

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