The Secret World of OpenCart

by steve on August 6, 2010

OpenCart logo

who doesn't love a logo?

I spent some time today helping a client debug problems she was having with OpenCart.  OpenCart is an open source PHP based shopping cart / product catalog.  You can buy a “commercial” version which gets you support, or for the savvy web nerd, you can wing it on your own.

As some of you out there may know, there’s lots of ways for your ecommerce solution to let you down, plenty of tiny little things to break, and lots of details to get right for it to work.  Here’s some tricks we figured out with OpenCart today:

  • Shopping cart dies when the customer tries to check out.

Problem: The customer finishes filling in his billing/shipping order, hits submit and the site dies, nothing but a blank screen with a crazy error message.  What gives?  Well, if you are running OpenCart 1.4.7 and using UPS for shipping you’re seeing a bug.  UPS is generating an error message that OpenCart can’t handle and it dies.

Solution: Upgrade to OpenCart 1.4.8.  This is a known bug and they’ve fixed it.  You can get the new software here.  Upgrade installation instructions are here.  After you get this installed, OpenCart will actually show the error message from UPS instead of crashing.

  • OpenCart tells you the shopping cart is empty when you go to check out.

Problem: Your customer puts items in their shopping cart.  When they click “checkout” OpenCart complains that their cart is empty!  What gives!

Solution: This is a problem with cookies.  Apparently some web hosts will force your browser to make a distinction between http://yourstore.com and https://yourstore.com.  That means, by default your customer’s shopping is saved in a cookie at http://yourstore.com, then when they try to check out and your shopping cart switches to encrypted SSL mode at https://yourstore.com suddenly there’s an empty cookie with no products!  The simplest solution to this is to force OpenCart to use https:// for everything.  Two steps for doing that:

1) A small code edit, instructions here.  NOTE: these are current for OpenCart 1.4.8. Other versions? Your milage may vary.  Keep a backup.

2) Go into your OpenCart admin screen.  Go to System -> Settings -> Store URL.  Set that URL to https://example.com instead of http://example.com

  • “Oregon is not a valid state” – maddening!  Even after we fixed the problems above, the cart was still kicking out crazy messages after the customer entered their shipping/billing info.

Problem: The OpenCart administration screens lack error checking.  It’s completely up to you to read the instructions carefully and enter the right thing into the form fields.

Solution: In the Administration section under Extensions -> Shipping -> UPS -> Origin State/Province … the form will allow you to enter whatever you type there, BUT our friends at UPS will generate an error message if they don’t like what you typed, and error message which you may find confusing because it only shows up on checkout.  This field only works if you enter the proper two character abbreviation

Now, bright students will notice these are cascading errors.  You fix one and you find there was another one you hadn’t seen.  Next week’s problem?  Why her PayPal transactions won’t complete.

Stay Tuned…

p.s. another super-secret clue for debugging ecommerce problems? Test credit card numbers.

Comments on this entry are closed.

Previous post:

Next post: