Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default add to cart not working when not logged in

    I made a number of small changes to a site that has resulted in a weird problem. If I log in, adding products is not a problem. When not logged in, you can't add products from either the product info page or the product list page. It will go to the shopping cart but says there are no products in the cart.

    I've checked the mods and other changes and am pretty sure they aren't the cause of this.

    I also applied the recommended patches and I suspect there lies the problem. I've tried to back those changes out - in admin it fixed one problem I was having there. I've had other problems with these patch files but this is the updated set with all patches so far for 1.5.4.

    Those files are:
    ajax.php
    includes/functions/html_output.php - rolled back to 1.5.3 level as 1.5.4 did not change that file
    includes/extra_configures/security_patch_v154_and_older.php - removed
    includes/modules/pages/checkout_confirmation/header_php.php - not touched since I can't get that far

    admin/admin_account.php
    admin/includes/auto_loaders/config.adminSanitize.php - removed
    admin/includes/classes/AdminRequestSanitizer.php - removed - I think this was the one that screwed up admin
    admin/includes/init_includes/init_sanitize.php - returned to 1.5.3

    So the first question is there any way the patch files could cause this aberrant behavior of not adding to cart?

    Second question - can anyone think of any alternate scenario that would cause this behavior? Never had it happen before.

    It has to be template caused: no admin settings have changed. I will set up a test scenario and gradually add the template back in but I am hoping for a clue first so that I don't have to spend a lot more time on this.
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  2. #2
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: add to cart not working when not logged in

    maybe this will help. Print session returns this:
    Code:
    [1] => Array
                            (
                                [page] => product_info
                                [mode] => NONSSL
                                [get] => Array
                                    (
                                        [products_id] => 11152
                                        [cPath] => 2683_2684
                                        [action] => add_product
                                    )
    
                                [post] => Array
                                    (
                                    )
    
                            )
    Looks like it does retain tje product but won't post it to the cart?
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  3. #3
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: add to cart not working when not logged in

    Does the product page contain the securityToken that is typically added to within the form tags by use of the zen function for generating a post related form?

    Also, what files are in the includes/extra_cart_actions directory?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: add to cart not working when not logged in

    happening on both product info and product list pages
    nothing in the extra cart actions
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  5. #5
    Join Date
    Jul 2012
    Posts
    16,816
    Plugin Contributions
    17

    Default Re: add to cart not working when not logged in

    How does includes/modules/pages/shopping_cart and related files in that directory differ from a ZC vanilla install?

    What includes/classes/observers are installed and to what do they listen?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: add to cart not working when not logged in

    So I finally just set up the cart in another directory but with the same database and no custom template. It's doing the same thing so it must not be template based. The files are the default files for 1.5.4. What in the heck could be going on?
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: add to cart not working when not logged in

    I'm a bit baffled too. Normally symptoms like this also affect login.

    Has the shopping_cart class been altered?

    The add-to-cart process works like this:
    a) user clicks link/button to request the add ... this fires a GET/POST depending on where they're at
    b) init system fires, to confirm session is started, and link to visitor's current session
    c) main_cart_actions and extra_cart_actions fire to trigger the actual add
    d) the shopping_cart class (fired by cart actions above) stuffs the added product into the visitor's basket:
    - if logged in, the basket data is stored in both the session and in the database
    - if not logged in, the basket data is stored only in the session, until they login (which causes a merge of the data)

    So, given that both the logged-in and not-logged-in visitor are treated the same until the last step where the actual add happens, it's odd to see a disparity like this.

    Quote Originally Posted by delia View Post
    So I finally just set up the cart in another directory but with the same database and no custom template. It's doing the same thing so it must not be template based. The files are the default files for 1.5.4. What in the heck could be going on?
    I'd be very interested in seeing if v155 does the same, on the same server and hosting account.

    Are there any custom php.ini files on this site? How about any PHP directives in any .htaccess files?
    (I'm thinking mainly of things that would affect how sessions are configured on this server, where temporary session data is stored on this server, whether that's out-of-disk/quota-space, and so on)
    .

    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.

  8. #8
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: add to cart not working when not logged in

    Server shouldn't be an issue. It is my server - leased from, setup and supported by geekhost.ca. There are no custom php.ini files on the hosting account. Running three other zen cart installations on the same account with no issues (all 1.5.4)

    I don't have any live 1.5.5 sites running on this server but there is a test site that works perfectly.

    I did a print session from my now upgraded 1.5.5 default template where this is happening - this is when product is added and I see the product id in the session.

    [cart] => shoppingCart Object ( [contents] => Array ( ) [total] => 0 [weight] => 0 [cartID] => [content_type] => [free_shipping_item] => 0 [free_shipping_weight] => 0 [free_shipping_price] => 0 [download_count] => 0 [total_before_discounts] => 0 [display_debug_messages] => [flag_duplicate_msgs_set] => ) [check_valid] => true [navigation] => navigationHistory Object ( [path] => Array ( [0] => Array ( [page] => product_info [mode] => NONSSL [get] => Array ( [cPath] => 14_86_316 [products_id] => 902 [action] => add_product ) [post] => Array ( ) ) [1] => Array ( [page] => shopping_cart [mode] => NONSSL [get] => [post] => Array ( ) ) ) [snapshot] => Array ( [page] => product_info [mode] => NONSSL [get] => Array ( [cPath] => 14_86_316 [products_id] => 902 ) [post] => Array ( ) ) ) [language] => english [languages_id] => 1 [languages_code] => en [currency] => GBP [today_is] => 2016-06-20 [updateExpirations] => 1 [session_counter] => 1 [customers_ip_address] => 7xxxxx [valid_to_checkout] => 1 [cart_errors] => )
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  9. #9
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,872
    Plugin Contributions
    96

    Default Re: add to cart not working when not logged in

    If that's the full dump of the site's $_SESSION variable, then you're missing the securityToken value which is the root cause of the issue you're having (add-to-cart not working).

    You need to determine why that value isn't being set (some session-related issue), correct that and your cart-handling will follow suit.

  10. #10
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: add to cart not working when not logged in

    nope, I just left it off - first part is
    Array ( [securityToken] => 1cd17a7148ad85dda2d179ee89aa7931 [customers_host_address] => xxxxxx [cartID] =>
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 18
    Last Post: 29 Sep 2009, 02:37 PM
  2. Shipping Estimator does not work for me when not logged in
    By speedraceratl in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 22 Aug 2009, 06:14 PM
  3. paypal express not working when customer is not logged in
    By Debby in forum PayPal Express Checkout support
    Replies: 6
    Last Post: 6 Sep 2008, 02:38 PM
  4. add to cart not working...currency not working
    By pcdesigns in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 12 Jun 2008, 05:03 AM
  5. Checkout when not logged in or with empty cart
    By CJPinder in forum Bug Reports
    Replies: 7
    Last Post: 14 Apr 2007, 05:07 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