PDA

View Full Version : Proceed to Checkout disappears (or Javascript refresh problem)


crown
19th June 2007, 10:23 AM
Hi,

We have an intermittent problem with the viewcart.htm page that causes the display of the cart to fail.

Sometimes, when the user chooses to buy an item and proceeds to view their cart, the rendering of the cart stops after the Back/Home buttons. Neither the contents of the cart, nor the Recalculate and Proceed buttons are displayed. As far as I can determine, this only happens to returning customers, and may be further restricted to returning customers who still have content in the cart cookie.

On Internet Explorer, the page shows an error at the bottom of the page complaining of 'null' (my apologies for not copying the full error message). Firefox records an error message saying that getProduct(pid) is null.

My company has used eziMerchant for a number of years, but I don't think they've noticed the problem until recently when customers began calling describing this issue.

Since the issue was first reported to us, I have upgraded eziMerchant to the latest version, and created a new skin for the shop. I spent some time in a Javascript debugger for a start, then I found that the version we had was years out of date so I stopped in the hope that this bug had been fixed. No such luck.

When debugging, it appeared that there was a product in the cart that didn't appear in the Javascript inventory, with an ID of 255. I'm not sure if this is a -1 value that has overflowed. Either way, it appears that if there is an item in the cart that is not in the inventory, the cart will fail to display.

I am not sure if this manifests itself because there is a value hanging around in a cookie or because the browser hasn't managed to download the updated product inventory Javascript files.

Either way, if any of the above makes sense I'd appreciate any help you can provide.

Many thanks,
James Telfer
Crown Content
http://www.crowncontent.com.au/shop/

dferguson
19th June 2007, 11:53 AM
Hi James

This should only happen if there is a mismatch between versions of the JS files on the server compared to the HTML.

It can also be caused by caching at the customers end.

V4 helps this situation in two ways.

1. The cart no longer produce's an ugly JS error if it cannot find the PID in the JS. The cart will display as per normal and customers can add other products to the cart normally. This is a big improvment on V3 carts - where by the cart would stop working completly until the browser session was ended and restarted.

2. PID (Product ID's) are reused in V4. So, if you delete a product from your site and create a new product, it will reuse the ID - therefore all but eliminating the possability of a PID being missing from the JS. (thou, caching could still cause the wrong product to be added to the cart - but a CTRL - REFRESH would fix this.

crown
19th June 2007, 04:31 PM
To answer my own problem, I gave eziMerchant a call earlier and they suggested upgrading to version 4 of eziMerchant. The version 4 codebase checks that the codes are valid when rendering the cart, and removes the offending items.

There are a few conditions under which the above problem can occur:

the eziMerchant javascript files were not updated along with the category and detail files (this is the most common cause).
the user has adds an item to their cart, doesn't complete the transaction, and returns to the site later without closing their browser. If the product has been removed in the meantime, this error may occur.
if the user's browser doesn't update files in it's local cache automatically, it is possible to be out-of-sync with the server.


All in all, not overly likely. That said, it happened to some of our customers, so be aware that it is a possibility.

Finally, the upgrade path to eziMerchant v4 was smooth. It upgraded our database without much difficulty, and generated our site without a hitch. I was especially happy that I didn't have to rewrite our custom theme.

Thanks guys!

JT

dferguson
19th June 2007, 07:37 PM
Glad to hear that it went well.. :-)