Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2009
    Posts
    21
    Plugin Contributions
    0

    Default Cart Empty After Adding Items? Things Disappearing!

    My server recently suffered a hard-drive failure, and now that my hosting company has restored everything from old backups, my zen cart is no longer working correctly.

    I am having a weird problem. When visiting the store, if you add an item to your cart and then click on the bright red "view cart" button on the left-hand side, it tells you that your cart is empty.

    After that, if you go add items to your cart and then try to view it, everything is fine.

    For some reason, using the "Shopping Cart" link in the top menu usually works just fine (but not always).

    It appears that only certain items have issues, but perhaps the answer it that the error just randomly occurs and makes it look that way.

    Sometimes, if you close your browser, and try the process all over again, it will have trouble the first time again. And sometimes not.

    Obviously it's having problems with the session IDs, sometimes not passing them. I'm not sure why this would be happening though.

    I'm completely lost as to why this isn't happening consistantly either.

    SO, here is the info you need if you are so kind as to check it out and try to give me your guesses. I'm tearing my hair out and setting up a fresh install just in case in another folder.

    The URL: http://www.vintagepicnic.com
    Version: 1.3.8a

    Trouble in Firefox3.0.13 AND IE7.0.6001.18000

    I've installed the Canada Post module, and the Fast and Easy Checkout Module.

    I altered my main_page template to display bright red "view cart" and "checkout now" buttons on the top lefthand side of the page if you add items to your cart. I think maybe I didn't use the right code. However, the code appeared to work just fine before my hard drive crash.

  2. #2
    Join Date
    Jul 2009
    Posts
    21
    Plugin Contributions
    0

    Default Re: Cart Empty After Adding Items? Things Disappearing!

    I still do not have this figured out. Any ideas are appreciated.

    I'm pretty sure that it's a problem with the buttons I installed to appear if anyone adds something to their cart.

    Does anyone know the proper way to link to the shopping card within the code so that the session ID will not be lost?

    Any other suggestions, thank you!

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Cart Empty After Adding Items? Things Disappearing!

    Quote Originally Posted by lhardie View Post
    My server recently suffered a hard-drive failure, and now that my hosting company has restored everything from old backups, my zen cart is no longer working correctly.

    ...

    However, the code appeared to work just fine before my hard drive crash.
    I agree that the problem is most certainly related to something that went amuck in the recreation of the site from backups after the server crash.

    The first thing I'd be doing is asking the hosting company for assistance, since you're likely not the only one having problems. Maybe the server is having intermittent problems with PHP session handling.

    The next thing I'd do is make sure you don't have leftover files in your /cache/ folder (other than the original index.html and/or .htaccess files), and that that folder's permissions are set to writable.

    Then I'd be checking the db_cache table in the database and emptying it. Same with the sessions table and whos_online table. And then I'd do a full database repair ... even if it must be done one-table-at-a-time via phpMyAdmin. (Usually there's a control panel (cPanel if you have it) option to Repair Database, making it faster than one table at a time.)

    Then I'd be testing a few things:
    a) Logins use sessions. Can you login properly? Can you view your My Account area and access old order details? Edit your account profile?

    b) Admin login also uses sessions. Can you login to the admin? Can you make changes?

    c) After doing that, does the problem persist? Is there a specific pattern of empty-cart problems? ie: *always* first click?
    Is there anything unique to the particular "link" you're using to look at the cart?
    Is there a reason why you're using that particular *link* instead of having the shopping cart appear immediately when something is added to the cart? If you've turned that option off, try turning it on and see what happens re: empty cart, etc.

    d) Checkout uses sessions. Can you do a checkout successfully? With one product? with several products? with various shipping and payment choices?

    e) If you set up a new clean uncustomized install of Zen Cart in another folder on the server, and in another database just for testing, does *that* cart work properly? Or does the problem continue with that one too?

    f) Make sure you've got all the latest security patches applied, and double-check that there's been no unexpected alterations to any files on your site ... whether you've been hacked or not, it's still good to double-check that everything is truly "clean" whenever you're encountering odd behaviors.
    .

    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.

  4. #4
    Join Date
    Jul 2009
    Posts
    21
    Plugin Contributions
    0

    Default Re: Cart Empty After Adding Items? Things Disappearing!

    Thank you SO much for your reply. I am going to go over your reply thoroughly and try everything you have suggested. Hopefully I can figure this out with the help that you've offered! I will post when I have results to share.

    Thanks again!

  5. #5
    Join Date
    Jul 2009
    Posts
    21
    Plugin Contributions
    0

    Default Re: Cart Empty After Adding Items? Things Disappearing!

    OK, I've done some testing (not all yet) and here is what I've found.

    It ONLY happens with the first item added to the cart. After that, it seems to "remember" you.

    You can login to your customer account, make account changes, log out and login again, and all without any problems.

    I haven't had any issues with the admin. I can login, make changes, and all that is great.

    If you add your first item to the cart and click on "Shopping Cart" in the links across the very top of the page, it works just fine. But if you use the button that I added to the sidebar, a button that appears ONLY if your cart has items, it says you have an empty cart.

    SO, I am thinking it may be an issue with the code I used to add those buttons.

    Here is the code I used:
    if ($_SESSION['cart']->count_contents() > 0) {
    ECHO "<a href=\"http://www.vintagepicnic.com/index.php?main_page=shopping_cart\"><IMG SRC=\"http://www.vintagepicnic.com/includes/templates/template_default/buttons/english/button_view_cart.gif\" border=\"0\"></a>";
    ECHO "<a href=\"http://www.vintagepicnic.com/index.php?main_page=checkout_shipping\"><IMG SRC=\"http://www.vintagepicnic.com/includes/templates/template_default/buttons/english/button_checkout.gif\" border=\"0\"></a>";
    }

    Does anything stand out as wrong in that code? I can't see why it would work with the exception of the first item a new visitor adds to their cart.

    I did turn off the option to have the cart appear after you add an item, but I have turned it back on, and that doesn't help. You will add your first item, it shows you the cart with the item, but then when you hit my "View Cart" button, it says you have an empty cart.

    I installed a clean install of zen cart in a new folder and encounter the issue ONLY if you use MY buttons that I added to the code.

    So again, I'm thinking it's my code as opposed to the script itself. I can't see what is wrong though. I am using the same URL that the script uses elsewhere to access the shopping cart, and nothing jumps out in the code that would create this type of error.

    I'm going to keep working with my hosts, and look at your other suggestions. The Cache was not writeable, but changing that didn't help. The cache has nothing but the original index and htaccess, and then some .log files. Should I delete even those .log files?

    Thanks again, I really appreciate it.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Cart Empty After Adding Items? Things Disappearing!

    Quote Originally Posted by lhardie View Post
    I installed a clean install of zen cart in a new folder and encounter the issue ONLY if you use MY buttons that I added to the code.
    I think that's the issue.

    You probably hard-coded links when it would be safer to use the same PHP code that generates the ones you copied from ... or use the built-in shopping-cart sidebox. Or one of the addons that do that.
    .

    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
    Jul 2009
    Posts
    21
    Plugin Contributions
    0

    Default Re: Cart Empty After Adding Items? Things Disappearing!

    What doesn't make sense to me though is why those buttons would work all of the time, except the very first time you add an item to your cart. AND on top of that, it's dependent on which item you add.

 

 

Similar Threads

  1. Descriptions disappearing after adding poduct
    By whiteknight1 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 17 Jan 2011, 02:03 AM
  2. "Your shopping cart is empty!" error after adding item to cart...
    By pappaj333 in forum Installing on a Linux/Unix Server
    Replies: 12
    Last Post: 14 Aug 2010, 04:58 PM
  3. Shopping Cart not showing up after adding items
    By russa2 in forum General Questions
    Replies: 3
    Last Post: 30 Jan 2009, 03:25 PM
  4. Items disappearing from shopping cart after logging out.
    By crawlina in forum General Questions
    Replies: 1
    Last Post: 28 Jan 2009, 10:13 PM
  5. security token + empty cart after adding Google Checkout
    By aerosmith in forum Addon Payment Modules
    Replies: 0
    Last Post: 30 Oct 2008, 10:48 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