Thursday, April 21, 2011

PrestaShop Tips - Fatal error (StockMvt -> id_stock_mvt_reason = -1) at product update or image upload

If you are using PrestaShop, the first official release of PrestaShop 1.4, You may encounter following Fatal error at uploading images for products at back office catalog.

The error details

Fatal error (StockMvt -> id_stock_mvt_reason = -1)

How does it happen?
There are multiple tabs of product information. Info tab include basic and core information of a product. Images tab manages product images.

The errors seems happens when your upload product image at catalog admin page.
When you upload new images, PrestaShop tries update the product database, one the the information is the product Stock movement. If you leave your Stock movement selection as "--", internal value = -1 at Info tab, then upload images at Images tab, this error will occurs

How to avoid the error
In order to avoid the Fatal Error, you need select a proper Stock Movement instead of "--" from drop down list, then go to image pages to upload your image.

You can choose any option like "Order", but leave the number to 0 for no changes.

Please note, the Fatal error will occur in any update of your products when you click "save" button if you leave Stock movement as "--".

I have no idea why there is such an option "--" at first place, if we already have option of "0" for no changes, we should not have this option.

Good news(update):
I heard that this issue has been fixed in 1.4.1, so it only happens on 1.4.0

No comments: