Jump to content

Fatal error (StockMvt -> id_stock_mvt_reason = -1)


Smartje

Recommended Posts

Everytime I manually edit a product that I imported with a CSV file I get this fatal error. The changes I submit DO get saved though, it's just somewhat annoying.

Any idea what's causing this?

On a sidenote: I want to disable stock tracking in every possible way. Just can't seem to find the correct option for this.

Link to comment
Share on other sites

Hello,

This is the common solution :
-> Go to ps_stock_mvt_reason, remove "auto increment" on the 'id_stock_mvt_reason' field,
-> Create a record with id_stock_mvt_reason = 0 and sign = 1 like this :

insert into ps__stock_mvt_reason VALUES(0,1,now(),now()) ;



I hope this help.
Mike

Link to comment
Share on other sites

  • 11 months later...

Hi Guys,

 

i also faced the same issue in updating the prestashop 1.3 to 1.4.

Did lot of RND but didn't got the solutons.

 

At last after spending lot of time i found one permanent solutions to the problem.

 

First of all, the problem rises because there is no option called "Stock Movements" in Prestashop 1.3 and this is the new feature added to the Prestashop 1.4. So the when we add new product it checks for the value of "id_mvt_reason" in the Product class which returns -1 which in-return creates problem in adding new product.

 

Solution: We don't have to make any modification anywhere in the Database; what we need to do is just go to "Tools.php" file inside classes folder and look for the getValue$key, $defaultValue = false) function in that. It would be on line no. 208 i guess not sure it depends upon the changes in the file.

 

Just replace the following code in that function:

 

return !is_string($ret)? $ret : stripslashes($ret);

 

with

 

 

if($key != 'id_mvt_reason')

return !is_string($ret)? $ret : stripslashes($ret);

else

return 1;

 

And just upload the file and check.

 

Your problem goes away forever.

 

Please Note: I'm not aware of the "Stock Movement" functionality; and those who knows please check that doesn't break their code.

 

Cheers Guys!!!

 

Varinder Singh

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...