Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Upgrading Your Zen Cart / Upgrading to 1.5.x / upgrading to 1.5.4 and can't place product in cart

upgrading to 1.5.4 and can't place product in cart

Started by earmsby on 25 Jun 2015, 3:46 PM · Views: 4,591

Results 1 to 20 of 39
25 Jun 2015, 3:46 PM
#1
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #1 by earmsby

I'm been banging my head against a wall for some time with an issue upgrading a shop from 1.5.1 to 1.5.4. First the live shop has a moderate amount of customizing but I've documented it pretty well and have a thorough list of altered files and such. The problem I ran into was that in the new test shop I can not add anything to the cart. ZC doesn't throw an error or anything (at least not one I can see in the logs). It just says the cart is empty after I click the button to add to cart.

At first I thought it was an issue with a customized file. But I have since started compeltely fresh with an uncustomized test shop. The cart works with the sample data in a compeltely clean cart. The problem happens when I use the data from the live shop. Here's a step by step of what I did to replicate the problem:

  • back up database from live shop
  • create new database on server
  • restore data from backup into new database
  • change store and admin config files to point to new database
  • upload zc_install
  • run database upgrade only
  • delete zc_install
  • attempt to add product to cart
  • problem occurs
  • edit config files again to point to original data (sample from clean install)
  • product is able to be added to cart

Given the above, it seems that something in the database itself is causing the issue. It's almost as if there is some setting that is telling ZC not to allow any products to be purchased. I did check the store config in admin to be sure it was not set to showcase only. Am I missing some other setting?

I would love for this to turn out to be some goofy, tiny thing that is wrong and that takes 30 seconds to fix. :frusty:

Ellie Armsby

25 Jun 2015, 4:39 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

Since putting something in the cart requires PHP be able to start a "session", your problem appears to be sessions-related.
Start by clearing your browser cache and cookies (or at least the zenid cookie).
Then make sure your HTTP_SERVER and HTTPS_SERVER are correct in the configure.php file.
Lots more guidance in this related FAQ: https://www.zen-cart.com/content.php?258-i-cant-stay-logged-in-to-my-admin-area-or-php-session-handling-isnt-working-for-me

If this is only for your 'test site', it's possible that your settings in Admin->Configuration->Sessions have been altered from defaults, and putting them back to defaults would be a good starting point for troubleshooting.

.
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.

25 Jun 2015, 5:04 PM
#3
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #3 by earmsby

Thanks for this clue! I thought it might be something like that. I will investigate and report back.

Ellie Armsby

25 Jun 2015, 6:14 PM
#4
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #4 by earmsby

Well, I really thought you were on to something but the config values under Admin->Configuration->Sessions are the same for both databases. I also tried clearing the cookie and trying to add a product again. Also tried changing the cache folder permission to 777.

None of those had any effect. Still toggling back and forth between the default database and the backed up one results in cart working versus not working. All other values in both config files are unchanged. Also, no problems logging into and staying logged into admin in the test environment.

Any other thoughts?

Ellie Armsby

25 Jun 2015, 6:31 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #5 by drbyte

Beyond add-to-cart, can you login as a customer okay? Can you create an account?

Also, just curious: what's the foldername of the subdirectory in which you've put the test site files? (basically I'm curious whether it contains a "." in it)

Are you using HTTPS for these sites?

Are there any paths in your test site's /includes/configure.php file that are actually still pointing to the "live" site's directories? If so, update them as a test. (of particular interest is SESSION_WRITE_DIRECTORY)

.

.
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.

25 Jun 2015, 6:36 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #6 by drbyte

earmsby:

the config values under Admin->Configuration->Sessions are the same for both databases.
I'm sorry if I'm being thick here. You've talked about importing various databases. So I'm not sure whether you're telling me that the settings on your live site match the imported settings of the test site ... which they should if the import worked. But I'm interested in knowing how your settings are different from original ZC defaults.

So, I've gone to one of my dev sites and grabbed the list of defaults for you:
Session Directory = (this needs to point to your site's /cache/ folder ... the complete path from the server "root")
Cookie Domain=True
Force Cookie Use=False
Check SSL Session ID=False
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=True

.
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.

25 Jun 2015, 6:50 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #7 by drbyte

Also, Ajeh just suggested checking whether your configure.php has SQL_CACHE_METHOD set to 'file'. If so, then you'll have to set the Session Directory to the directory where your test site's cache folder is located, not your live site.
It's better to use SQL_CACHE_METHOD set to 'database'

.
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.

23 Jul 2015, 1:47 PM
#8
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #8 by earmsby

Thanks DrByte. I've been out of town away from this project for a few weeks but am getting back to it now. I'll look into the issues you raised and see what I can determine. Will report back on progress/resolutions (if any).

Ellie Armsby

28 Jul 2015, 6:48 PM
#9
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #9 by earmsby

DrByte:

Beyond add-to-cart, can you login as a customer okay? Can you create an account?

Also, just curious: what's the foldername of the subdirectory in which you've put the test site files? (basically I'm curious whether it contains a "." in it)

Are you using HTTPS for these sites?

Are there any paths in your test site's /includes/configure.php file that are actually still pointing to the "live" site's directories? If so, update them as a test. (of particular interest is SESSION_WRITE_DIRECTORY)

.

Yes, I am able to both log in to an existing account as well as create a new one.

No, I am not using HTTPS for the development site. The live shop of course does use this.

No, there are no references to the live site in either admin configure.php or non-admin configure. I did not see any configuration value for SESSION_WRITE_DIRECTORY. That looks more a value from the CONFIG table rather than the config.php file?

I will continue to look into this and work my way through your other suggestions & questions.

Ellie Armsby

28 Jul 2015, 7:10 PM
#10
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #10 by earmsby

DrByte:

I'm sorry if I'm being thick here. You've talked about importing various databases. So I'm not sure whether you're telling me that the settings on your live site match the imported settings of the test site ... which they should if the import worked. But I'm interested in knowing how your settings are different from original ZC defaults.

So, I've gone to one of my dev sites and grabbed the list of defaults for you:
Session Directory = (this needs to point to your site's /cache/ folder ... the complete path from the server "root")
Cookie Domain=True
Force Cookie Use=False
Check SSL Session ID=False
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=True

Thanks. Yes, the settings under Admin>Sessions match these settings exactly.

To explain a bit more about what I mean by "toggling between databases" - what I did was first just make a clean install of v. 1.5.4 with the database as created by the install. After completing the install, I can create an account, log in to the account, place items in the cart and then complete the order. Again, this is all in a sub-folder of my live site and does not use SSL (because the certificate is not issued in such a way that it will work with this URL).

After verifying that the clean install with default DB worked as expected, I then made a backup copy of the live database from the live store. I changed the name of the database only in the two config files (no other changes to either config file). Of course when I do that then I am prompted to upgrade the database (because it's a copy from v. 1.5.1 shop). So, I do the database upgrade only and all appears successful. After this, I am able to log in, able to create a new account but not able to add anything to the cart. I just get "Your Shopping Cart is Empty" message after attempting to add any product.

If I simply change the database name back to the one created by the clean install in config.php, I can once again add items to the cart with no other changes to any file or settings in admin (although of course the values in admin are contained in the database so I can't be certain that no CONFIG values there are different between the two databases).

I should clarify that the settings under SESSIONS match those you gave above in BOTH databases.

One thing I thought I might try would be to back up just the CONFIG table from the clean database and restore it into the database which is the copy of the live shop. That way, I'd be sure that all config values in the whole shop are the ZC defaults. If doing that made the cart work again, then I could go through each setting in the live shop and compare to the test shop to see where the problem might be occurring.

Ellie Armsby

28 Jul 2015, 8:06 PM
#11
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #11 by earmsby

Ok, I did try replacing the config (and config_group) tables from the clean database into the live back up. My thinking was that if there was some CONFIG setting somewhere that preventing products from being added to the cart, that this should "reset" it and make it function like the clean database which works.

But...

No dice.

Even with the exact same config values from the database copied over, the cart still shows empty. Once again switching the database name in both config.php files (from live back up back to clean install version) solves the problem and items can now added to the cart.

So, it seems to me that the problem must not be with any config settings. It also doesn't seem that it would be with anything set in config.php since the only I'm changing between it working and not working is the name of the database being used (DB_DATABASE value).

I'm so baffled by this, I'm about ready to give up on this upgrade. :shocking:

Ellie Armsby

29 Jul 2015, 4:08 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #12 by drbyte

Have you considered installing your site on your local PC for testing purposes?

That way you can do all the testing of the new version directly on your PC and then simply copy the changed files to the server (and run the db upgrade on the live db) when it's time to go live. As explained here: http://www.zen-cart.com/entry.php?3-How-do-I-rebuild-my-site-on-the-new-version-instead-of-upgrading

.
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.

12 May 2017, 6:00 PM
#13
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #13 by earmsby

Hi,

This is older thread which I'm coming back to. I gave up on the upgrade at the time because, no matter what I did, I couldn't figure out what was causing the problem. It's now more urgent that I upgrade this store because the host will be moving to a higher level of PHP and the current store version won't run on it. So, I started over and hoped that I might have better luck. So far not.

Let me give a list of steps I've done and where the issue occurs in hopes someone can help me identify the problem.

First, here's the server info:
HTTP Server: Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
PHP Version: 5.4.27 (Zend: 2.4.0)
Database: MySQL 5.1.73-cll

So, here's what I've done so far:

  1. create a new directory to test v. 1.5.5e (www.mydomain.com/zc_store_upgrade/
  2. create a new blank database (name: estore_upgrd)
  3. run clean install of v1.5.5e in directory using db estore_upgrd (including test products)
  4. test that store is functioning with clean install and test data - tested logging in; creating account; adding to cart; placing order (with check payment since I will activate AIM payment module later) ALL IS FUNCTIONING
  5. make a back up of live store database (live store is on same server but is ZC v.1.5.1
  6. create second new blank database (name: estore_upgrd2)
  7. restore back up made in step 6 into estore_upgrd2
  8. edit the config.php in both zc_store_upgrade directory and ADMIN_FOLDER to use the database estore_upgrd2 (no other lines in config.php files were changed - just the one line from define('DB_DATABASE', 'subito_estore_upgrd'); to define('DB_DATABASE', 'subito_estore_upgrd2');
    9. test store again - when I go to the ADMIN_FOLDER, as expected I see the message that the database is out of date.
  9. upload zc_install & run database upgrade - runs successfully and version page shows "Zen Cart 1.5.5e || Database Patch Level: 1.5.5"
  10. delete zc_install directory
  11. test functionality in store - can log in and create new account and pages that should run over SSL do
  12. THIS IS WHERE THE PROBLEM OCCURS - even though I am able to log in and out, when I attempt to place an item in the cart, it goes to the shopping cart page (http://www.mydomain.com/zc_store_upgrade/index.php?main_page=shopping_cart) but displays "Your Shopping Cart is empty."

I can't see how the issue is in the config file since the only line I'm changing is the one line about the name of the database and it works fine before I do that. So, it seems that problem must be somewhere in the database itself.

Where should I look? Dr. Byte mentioned previously that it's most likely an issue with session writing. That certainly sounds right but other than rechecking the values in admin under Configuration > Sessions, I'm not sure where else to look for a problem.

I am really at a loss but I also really need to get this to work before the host upgrades their server. Help!

Ellie Armsby

12 May 2017, 6:23 PM
#14
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #14 by earmsby

I'm looking a little more closely at the values in Admin > Config > Sessions and I see that the first item is "Session Directory." This is true in both 1.5.1 and 1.5.5e but the description is a little different in 1.5.1 it says "If sessions are file based, store them in this directory." but in 1.5.5e it says "This should point to the folder specified in your DIR_FS_SQL_CACHE setting in your configure.php files."

I thought maybe that was a clue and so I checked in the configure.php file for the value mentioned. But I see it is commented out (not by me) and says "Advanced use only: * The following are OPTIONAL, and should NOT be set unless you intend to change their normal use. Most sites will leave these untouched."

Could this be the problem? Should I delete that value? Should I do something in the configure file?

Ellie Armsby

12 May 2017, 6:25 PM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #15 by drbyte

  • As referred to in earlier posts, what's the path for the session directory?

  • Any errors recorded in the /logs/ folder of the new site?

The DIR_FS_SQL_CACHE is auto-detected by newer Zen Cart versions, and points to whatever_your_zencart_folder_is/cache/

.
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.

12 May 2017, 6:43 PM
#16
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #16 by earmsby

- As referred to in earlier posts, what's the path for the session directory?

- Any errors recorded in the /logs/ folder of the new site?

The path that shows in admin as the session directory is currently "/tmp." In fiddling around with the default data (estore_upgrd) that was added in the clean install I noticed that this was the value for that config value. But the value that was originally indicated in estore_upgrd2 was something else. Since that seemed to be the only difference between when it worked and when it didn't, I changed the value in estore_upgrd2 to match the value in the clean install. Unfortunately, it did not solve the problem.

There is nothing in the logs folder except for some database errors from when I first did the clean install. There are no errors from the time that I have been trying to add an item to the cart.

Ellie Armsby

12 May 2017, 8:02 PM
#17
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Post #17 by website_rob

Admin -> Configuration -> Sessions
Cookie Domain
Force Cookie Use

  • make sure they both say True

The learning is in the doing.

Potent Products

12 May 2017, 9:42 PM
#18
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #18 by earmsby

Checked those. The value for Force Cookie Use was set to false so I changed it to true but that didn't solve the issue. :(

Ellie Armsby

12 May 2017, 9:55 PM
#19
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #19 by earmsby

Ok, so I now changed the value for "session directory" back to "complete/physical/pathto/store/cache" and I left the value for FORCE COOKIE set at true. Still no dice and no errors are being thrown in the logs folder.

Is it possible that the problem is to do with the cache folder itself? Since adding to the cart works for the default installation and "/tmp" but not cache, I wonder. I suppose I could switch configure.php back to the default database and try changing the value in session directory to the cache folder to see if it then breaks.

So weird. I did another upgrade for another client (different host) and didn't have this issue at all.

Ellie Armsby

13 May 2017, 6:00 AM
#20
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Post #20 by website_rob

So you have a URL using: https://www.mydomain.com/zc_store_upgrade/
Created a new blank database: estore_upgrd
Did a clean install of v1.5.5e db: estore_upgrd and installed the test database - no problems

Created a second new blank database: estore_upgrd2
Restored a back up made in step 6 into estore_upgrd2

Where did the database come from that you Imported? Is it your live site database or the test database?

The learning is in the doing.

Potent Products