Cart empty after adding product

Tagged: , ,

This topic contains 50 replies, has 14 voices, and was last updated by  Inigo 2 years, 1 month ago.

  • Author
    Posts
  • #946

    Seer Zoltan
    Member

    Hey guys, I can’t add products to cart, I’ve printed the $_POST variables on the cart page and it contains all information (post_id, tcp_count, etc), but the cart remains empty. I use a custom loop and I call the tcp_the_buy_button() function. Can this be a problem?

    P.S.: The page is on a local server, all the apache settings are on default.

    Regards,
    Zoltan

  • #5183

    Inigo
    Participant

    Hi Zoltan,

    Have you take a look to the session? Your PHP installation must allow sessions, and your Internet browser must allow cookies.

    Best regards

  • #5184

    Seer Zoltan
    Member

    Hi Sensei,
    Thanks for your answer, but I think elsewhere is the problem. I’ve checked the php_info, it says the Session Support is enabled; the cookies are allowed by the browser. I’ve reinstalled with a clean wordpress install to another server, I still have the problem.
    http://bit.ly/wZElus – you can take a look.
    I’ve printed the $_SESSION variable, the ShoppingCart Object is there with the fields, but all of these are empty.
    What do you recommend?

    Zoltan

  • #5185

    Joy
    Participant

    It sounds like the problem I had. It was the session directory that was not writable.

    http://community.thecartpress.com/groups/development/forum/topic/shopping-cart-empty/

  • #5186

    Inigo
    Participant

    Cool site!!!

  • #5187

    Seer Zoltan
    Member

    Hi Joy,
    I don’t think that is the problem because:
    1. The session are created when the getShoppingCart() method is called in the TheCartPress.class (in the session directory will be a new file when a new session is started). I’ve tested it making a new session, put some values in it, and it’s working. That’s why I don’t understand the cart session why remains empty.
    2. I think the default option is writable for the session directory.

    First, if I put something in the cart, $this->shopping_cart_items[$shopping_cart_id] = $sci; (ShoppingCart.class line 59) sets the details in the shopping_cart_items array… But I don’t find when this array gets into the session. Could you help me in this please, maybe with this I can find the problem.

    Regards,
    Zoltan

  • #5188

    Inigo
    Participant

    Hi Seer,

    In TheCartPress.class.php we execute “$shoppingCart = TheCartPress::getShoppingCart();”
    So, all the modifications applied to this variable ($shoppingCart) will be saved in the session.

    Be sure to use the latest version of PHP.

    Best regards

  • #5189

    Seer Zoltan
    Member

    Hi Sensei,
    Thanks. I noticed that the wp_head() method is not running. The script never reach this method, but I don’t know where is called. I’ve made a call from the ShoppingCartPage.class in the constructor, now the cart is working. Adding products to the cart, modifying, deleting, everything. What do you think, it is good solution?

    Thanks,
    Zoltan

  • #5190

    Inigo
    Participant

    Hi Zoltan,

    I don’t know….but perhaps your theme is not 100% compatible , or a plugin is not compatible…
    I prefer to test TheCartPress on a cleaned wordpress and activate, one by one, the theme and the rest of the plugins.

    Best regards

  • #5191

    TCP Team Luis
    Keymaster
  • #5192

    Seer Zoltan
    Member

    TCP_team,
    Thank you, I’ve forgot about the wp_head in the header. At least now I know the whole TCP system :)
    It’s a great, smartly built plugin.
    Thanks again!

    Regards,
    Zoltan Seer

  • #5193

    Steve P.
    Member

    NEED HELP ASAP – Just installed the recent update to TheCartPress and now items are not going into the cart… site is http://www.testdrivetech.net I have not changed ANYTHING in the default files.. Please help!

  • #5194

    Inigo
    Participant

    Hi Steve,

    I think your server doesn’t support session. Our extend site has the last version (1.0.9.1) and it’s running.

    Perhaps any change in your server configuration…

    Best regards

  • #5195

    TCP Team Luis
    Keymaster

    Hi Steve,
    I see your site.. It seems to be having a problem with session on your site.
    We have not detected this error in any of our installations or those of our customers..
    Could you disable other plugins to test for conflicts between plugins?
    Please let us know

  • #5196

    labuenapipa
    Member

    Hi Sensei.
    I got the same problem. After including one item in the cart and trying to make checkout the message of “your car is empty” appears. Just if it is helpful for fixing purposes I have the following plugins : :Qtranslate, Simple lightbox and Theme my login. I have tried to disable anyone of the three but the problem still exists. http://www.labuenapipa.com/delta/
    Regards
    Luis

  • #5197

    Steve P.
    Member

    TCP Team – I just tested the issue after deactivating all but TheCartPress plugins and still have the same result. TCP was working just fine until I installed an update a few days back… Can you be more specific about “having a problem with a session on your site” I’m not a programer.. I’m a small business owner so if you could please speak in simple terms for me. It seems like Labuenapipa has the same issue… I am using GoDaddy as my hosting provider BTW if that makes a difference but I have not had any issues in the past until this last update. Your help is much appreciated.

  • #5198

    labuenapipa
    Member

    Hi Steve,
    I fixed my problem a few minutes ago. I had one plugin named Websimon tables. When disabling this plugin the checkout started operating for me. It would be very strange that you have the same plugin but may be another one causing the problem.
    Regards
    Luis

  • #5199

    Steve P.
    Member

    I’ve turned off ALL of my plugins and still get the same issue… If I can’t get this fixed very soon I will have to find another cart (which I don’t want to do)… I hope someone from @tcpteam can help me solve this issue…

  • #5200

    jfriesen
    Member

    I am having the same trouble since the 1.1.9.1 update. Eeek! It was lovely before…

    - Per Sensei’s suggestions, I created a php.ini with the following:
    php_value session.save_path /home//www/sesh/tmp/
    - No results.
    - I added the following to wp-config:

    /** Fixing a problem where sessions are not being saved.
    see http://php.net/manual/en/function.session-save-path.php */
    session_save_path('/home//sessions');
    ini_set('session.gc_probability', 1);

    I have reviewed this thread, this thread.

    Error log reports:


    [13-May-2012 00:52:24] WordPress database error Unknown column 'wp_postmeta.meta_value' in 'order clause' for query SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND 0 GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 asc LIMIT 0, 10 made by require, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

    Tearing my hair out here — the customer needs to launch the site tomorrow… :S

  • #5201

    Allan Bayaua
    Member

    Hello, I have the cartpress plugin on a wordpress site thats on a server and we just made our first sale a few weeks ago. I updated the plugin however, and now the cart is always empty. I read the above comments & i’m very novice at programming, I have the same problem and I’ve tested it on chrome and firefox..oddly enough after deactivating and reactivating the plugin, if I add an item to the cart, view the cart (or set it to “go to shopping cart”), the item is there, however I can’t modify or add other items and if I click checkout, it takes me to the empty cart.. I thought it was becuase I installed child plugins for TCP such as dynamic options and shipping by ranges (both of which I’ve uninstalled.) I hope an update patch resolves this issue soon, because the majority of our business online is based on selling goods via TCP.
    thank you

    http://www.beatswapmeet.com

  • #5202

    jfriesen
    Member

    Further:

    I created a simple test to determine whether sessions was in fact permitted.


    /** Fixing a problem where sessions are not being saved.
    see http://php.net/manual/en/function.session-save-path.php */
    session_save_path('/home/modelexp/tmp/sessions');

    /* testing whether sessions are working */
    session_start();
    if(isset($_SESSION))
    $_SESSION=$_SESSION+1;
    else
    $_SESSION=1;
    echo "Views=". $_SESSION;

    It’s at http://bennington.accountservergroup.com/~modelexp/theTests/session-test.php for your verification. :)

    As expected, it correctly increments page views. Further, in /home/modelexp/tmp/sessions (above the www as recommended), I get a file called “sess_b52a510d78a3ced91f97e0f3ad46a39″ (or similar) with the contents

    views|i:17;

    I can delete the session file from that directory manually via SSH, and as expected, the “views” will reset to 1 and a new session file will be created at /home/modelexp/tmp/sessions

    I have added the following to my wp_config.php file:


    session_save_path('/home/modelexp/tmp/sessions');

    This works in my tests, so theoretically, it should work in WordPress/TheCartPress. However, items are still not being correctly added to the cart.

    This should verify that sessions are:

    • - enabled
    • - correctly being set in the test code
    • - correctly being read back to the page by the test code
    • - correctly pointed at a folder above www using session_save_path in php in the test code
    • - correctly writing sessions files to the aforementioned folder in the test code
    • - not doing any of the above in WordPress/TheCartPress

    I really need to hear back from TheCartPress with assistance in troubleshooting this very worrisome problem.

    (Edits for clarification and formatting)

  • #5203

    jfriesen
    Member

    I should also add that I am using the “eCommerce Twenty Eleven 1.0 by thecartpress” theme, have re-uploaded the 1.1.9.1 files in case I’d inadvertently changed something essential, and have only made changes in plugins or language files (or other text changes).

  • #5204

    Joy
    Participant

    They always disappear on weekends….
    I suggest you unzip the latest version and the version that worked, on two folders in your computer and use a tool to compare them and see what changed.

  • #5205

    jfriesen
    Member

    Drat! Thanks for the note… I’ll see what I can dig up…

  • #5206

    Inigo
    Participant

    Hi to all,

    I’m taking a look!!! It’s running ok in the extend site. Please, test to activate/deactivate the plugin.

    Best regards

  • #5207

    Inigo
    Participant

    Hi jfriesen,

    We change the way to use the session to avoid problems with other plugins.

    We use an Object to manage the cart in the session. I think Object Oriented programming help us to get a better product, but some other plugins open the session before the rest of the plugins load its classes, and this is a PHP requirement to use objects in the session.

    Then in 1.0.9 version we have changed the way we store the cart in the session. If you have a previous stored session TheCartPress needs to delete it.

    Best regards

  • #5208

    jfriesen
    Member

    Okay, Sensei.

    I’m going to do a fresh install of WordPress & theCartPress and see if I can get it running again. If I run into problems I will definitely post here. :)

  • #5209

    jfriesen
    Member

    Initial test on a fresh install appears to be working. Clearly I broke something in the process.

    Rebuilding site…

  • #5210

    Inigo
    Participant

    Hi jfriesen,

    That’s sound great.

    @testdrivetech and @abayaua have you fix the issue?

    Best regards

  • #5211

    Allan Bayaua
    Member

    so what should I do, uninstall and reinstall the plugin? I definitely do not want to rebuild this site from scratch. I am also running the twenty eleven theme 1.03 and have the TCP loop settings use the twenty eleven theme compatibility.

  • #5212

    TCP Team Luis
    Keymaster

    Hi Allan,
    No rebuild site from scratch,
    Try deactivate and reactivate thecartpress. Close/open browser (delete session9
    Try deactivating other plugins to detect conflicts with session.
    Let us know
    Best regards

  • #5213

    Allan Bayaua
    Member

    I did deactivate and reactivate.. there is a conflict with the following plugin because it appears to affect my entire site if i deactivate it.. logo manager,

    the only file i remember editing was the header.php and this is what is instructed to do,
    Using the plugin
    Open the header.php file using the appearance editor. Replace the line of code that looks like:
    “>


    Allan Bayaua
    Member

    Allan Bayaua
    Member

    wow that code just won’t show up.. weird.

  • #5216

    Nicolas
    Participant

    Hello,

    First of all, thanks a lot for this great plugin !

    I had some empty cart pb too. As long as I stay in some product or product category page, the cart remains ok, but becomes empty if I go elsewhere (eg, home, regular post, page…).

    I looked into the code to see where it was dealing whith sessions and found out that a little change solved my problem. Don’t know if it can help someone and if it’s a goog idea. Anyway, I just added a line here :
    (TheCartPress.class.php, l.173) :

    static function saveShoppingCart() {
    global $tcp_shoppingCart;
    $_SESSION = serialize( $tcp_shoppingCart );
    }

    becomes :

    static function saveShoppingCart() {
    global $tcp_shoppingCart;
    TheCartPress::getShoppingCart();
    $_SESSION = serialize( $tcp_shoppingCart );
    }

    seems like sometimes, the global $tcp_shoppingCart variable is lost somehow… and calling getShoppingCart() makes it load again or something…

    (I’m french so please forgive my poor english…)

  • #5217

    hennie
    Member

    Hi
    I am reading this thread but i dont seem to find any definitive solution for this problem
    Its my 2 cent when something is not working properly it should be fxt by the devs but i dont see any solutions here

    so my questions
    is there a solution for this problem
    will there be a update to prevent this in the future
    can the solutions here mentioned that don’t work be removed please

  • #5218

    Inigo
    Participant

    Hi Nicolas,

    I’m taking a look.

    Hi Hennie,

    Have deactivate/activate the plugin?

  • #5219

    hennie
    Member

    yes i deactivate it and activate it with no result

  • #5220

    Allan Bayaua
    Member

    Hi, I noticed ya’ll updated the plugin w/ a TCP debug widget? Is there a way we can use this to help you debug the issue? I still have the same issue of items in the cart not going to checkout and not being able to modify / add to the cart after 1 item. I’m not sure how to delete the session after deactivating, reactivating the plugin.

  • #5221

    Inigo
    Participant

    Done!

    Please, download 1.1.9.2

  • #5222

    Nicolas
    Participant

    Hello Sensei,

    Yes !
    I just upgraded TCP and the cart is all OK now.

    Great job. Thanks a lot !

  • #5223

    Inigo
    Participant

    Hi Nicolas,

    You gave me the first clue (using TheCartPress::getShoppingCart();). Then @tomccar posted how to get the error, but not enough for me. My installation was running properly all the time (and extend.thecartpress.com, and other ecommerces). Finally, a very angry user, in the wordpress forums, gave me the last detail, in a fresh installation. (I always use TheCartPress widgets)

    So in a fresh installation, following Tom’ steps, I got an empty cart. So, looking to your post, the issue was that if in a server access no one changed the cart, it became empty. So I have added an if statement. Also, I have taken advantage to save the variable within the class and everything has stayed cleaner.

    These was the main clues but all the posts about the issue have been very appreciate by me. All of them have took me in the right direction. Thanks to everybody.

    Best regards

  • #5224

    Allan Bayaua
    Member

    Hi, thank you so much for fixing that issue! I just updated and checked to see if I could modify and view the cart and it all works! you guys are awesome!

  • #5225

    Loretta
    Member

    How was this fixed? I just loaded cart and it appears to be a great tool, but my cart is empty too. I lod projects, but when I click on shopping cart or check out.. everything zero’s out! Please help. I have deactivated every other plugin… no help and re-loaded the plugin… twice. PLEASE HELP. This is very frustrating. I too am not a developer and need a layman’s explanation. PLEASE!!!

  • #5226

    Joerg
    Member

    @Loretta

    I think it has been fixed in latest TCP version. Which version are you running?

  • #5227

    Nickkos
    Member

    I am having this problem currently and I need immediate support,
    The site is http://hideawayscarf.com/?tcp_product=nyc-chic

    I am using the latest version, 1.9.1.2
    PHP 5.3

  • #5228

    Nickkos
    Member

    it is creating sessions in the proper directory I can include an example sessions file – but it seems all data is null?

  • #5229

    TCP Team Luis
    Keymaster

    Hi Nickkos,
    I can´t see TheCartPres in your site.
    Best Regards

  • #5230

    Skip Andrews
    Member

    Greetings everyone, I have followed this thread but I am still having the same “Empty Cart” problem. I have deactivated, reactivated version 1.1.9.3 on a 3.3.2 WP site.

    Any time a user clicks on the “Add to Cart” button, it merely returns to an empty cart page and the widget shows no items added.

    Please check it out at:

    https://www.howdoihealmyself.org/product/set-essential-oils/

    Thanks for your help! –Skip

  • #5231

    Inigo
    Participant

    Hi Skip,

    TheCartPress uses the Session to store the cart. so your PHP must allow to use the session. Using previous versions of TheCartPress we had problems with others plugins, but we changed the way to store the session so those issues was fixed.

    But we can do a review:
    First, and more important, Do your server allow session?
    Do you use a lot of plugins in your site?

    Best regards

  • #5232

    Inigo
    Participant

    Hi skip,

    There are another issue that we have resolved in the new version 1.2. the Session is modified in the wp_head action (a WordPress hook). If your theme is not 100% compatible, this hook is not called. Could you change your theme to “twenty eleven”? If TheCartPress runs then the problem is in your theme.

    For TheCartPress 1.2 I hope to fix this issue.

    Best regards

You must be logged in to reply to this topic.