koolrifz Posted March 18, 2011 Share Posted March 18, 2011 Getting this error when I alter a product: Fatal error (StockMvt -> id_stock_mvt_reason = -1) (see attached image)Searched the forum and have found this solution: Open table "ps_stock_mvt_reason"remove auto increment on id_stock_mvt_reason,and create a record:id_stock_mvt_reason = 0sign = 1 I've applied this and still get the above error. Any help would be greatly appreciated.Thanks,Rob Link to comment Share on other sites More sharing options...
mytheory. Posted March 18, 2011 Share Posted March 18, 2011 Hi,This is in the Bug Report... but a few people have managed to fix it by setting the default stock movement reason from "order" to "increase". To do so, go to the BO, click Catalog --> Stock Movement, then scroll down to the bottom.HTH!PS. Post a follow up if this works for you... ithink there are a few bugs with this new stock movement feature. I don't even know what is its purpose. Link to comment Share on other sites More sharing options...
koolrifz Posted March 19, 2011 Author Share Posted March 19, 2011 Hi,...a few people have managed to fix it by setting the default stock movement reason from "order" to "increase". To do so, go to the BO, click Catalog --> Stock Movement, then scroll down to the bottom. Actually, I didn't have a default setting for Stock Movement Reason. (See attached) instead there is ID 0 with the name " - "I wonder if this is the same for everyone? I upgraded to version 1.4 - not from a clean install. I will post back when I think it is solved. Link to comment Share on other sites More sharing options...
Raggy786 Posted March 19, 2011 Share Posted March 19, 2011 Koolrifz - I am in the same position. Let me know if you have sorted it.If i find the answer, i will let you know.Many thanksPS: mine only happens when i input a image. Link to comment Share on other sites More sharing options...
koolrifz Posted March 20, 2011 Author Share Posted March 20, 2011 Raggy786,Have you applied the database fix from my first message? I know that when I turned off auto increment kept increasing in ps_stock_mvt_reason. Then I turned auto increment on and then off and for some reason it seems to be working. I haven't needed to change any setting in Catalog —> Stock Movement as suggested by mytheory above.HTH Link to comment Share on other sites More sharing options...
Raggy786 Posted March 20, 2011 Share Posted March 20, 2011 Hi, I dont understand your sql query .. SorryI am not as good on mysql. but know the basics. Link to comment Share on other sites More sharing options...
koolrifz Posted March 20, 2011 Author Share Posted March 20, 2011 I dont understand your sql query No problem. Do you have access to PHPMYADMIN? Assuming you do, navigate to your database and find the following table:YOURPREFIX_stock_mvt_reasonFollow the images:1. Table in MySQL2. Click on Structure3. edit id_stock_mvt_reason4. turn off auto_increment5. save changesNo Images for the following6. Next to Structure click on BROWSE7. There should only be one row of information (Let me know if there is more as I'm not too sure how this table actually works)8. Click the edit pencil9. Where it says "id_stock_mvt_reason" set "VALUE" to 0 (zero)10 Where it says "sign" set "VALUE" to 1 (one)Save by clicking GO. Hope it works. Cheers,Rob 1 Link to comment Share on other sites More sharing options...
Raggy786 Posted March 20, 2011 Share Posted March 20, 2011 that was great. But i do not have one row. I have 5 Rows. lol that is why its confusing.7. There should only be one row of information (Let me know if there is more as I’m not too sure how this table actually works)( more than one row ) Link to comment Share on other sites More sharing options...
Raggy786 Posted March 20, 2011 Share Posted March 20, 2011 Actually it started to work? I think when adding a product. you should select restocking option from the dropdown menu.Stock Movement:and save. And when you go to images it should work. Link to comment Share on other sites More sharing options...
koolrifz Posted March 20, 2011 Author Share Posted March 20, 2011 Ok. Looks like maybe we just need to understand how the Stock Movements actually works eh? I don't need it as our on-line presence is quite personable. We contact each customer and handle all stock through MYOB. My guess is to delete those extra rows in id_stock_mvt_reason and leave just the one as suggested above. Obviously back up your DB in case it causes problems - but I think you're pretty safe.Cheers Link to comment Share on other sites More sharing options...
Allyt Posted March 21, 2011 Share Posted March 21, 2011 @ Koolrifz / Rob - Thank you so much for your 'hack' Indeed the default was set to autoincrement. There were also other rows, as the default data comes along with options to increase, decrease, order, 'misplaced' ?? I guess with time, maybe this will be useful when we know how to use it I noticed the following when searching for a resolve. This may well be a bug. http://www.prestashop.com/bug_tracker/view/8372/Thanks againAlly Link to comment Share on other sites More sharing options...
koolrifz Posted March 21, 2011 Author Share Posted March 21, 2011 Ally,Good work. If there are no objections, I will alter the topic as [sOLVED]. Someone please correct me if I'm wrong.Cheers! Link to comment Share on other sites More sharing options...
Simon-AV Posted March 23, 2011 Share Posted March 23, 2011 Hi,This is in the Bug Report... but a few people have managed to fix it by setting the default stock movement reason from "order" to "increase". To do so, go to the BO, click Catalog --> Stock Movement, then scroll down to the bottom.HTH!PS. Post a follow up if this works for you... ithink there are a few bugs with this new stock movement feature. I don't even know what is its purpose. This worked for me! Cheers for the suggestion Link to comment Share on other sites More sharing options...
guest* Posted March 26, 2011 Share Posted March 26, 2011 Getting this error when I alter a product: Fatal error (StockMvt -> id_stock_mvt_reason = -1) (see attached image)Searched the forum and have found this solution:Open table "ps_stock_mvt_reason"remove auto increment on id_stock_mvt_reason,and create a record:id_stock_mvt_reason = 0sign = 1 I've applied this and still get the above error. Any help would be greatly appreciated.Thanks,Rob Thank you for the hack, it solved my problem Link to comment Share on other sites More sharing options...
vietnam Posted March 30, 2011 Share Posted March 30, 2011 9-10 screenshotBu ti get SQL query: Edit UPDATE `mobila_badie`.`ps_stock_mvt_reason` SET `id_stock_mvt_reason` = '0', `sign` = '1' WHERE `ps_stock_mvt_reason`.`id_stock_mvt_reason` =4 MySQL said: Documentation #1062 - Duplicate entry '0' for key 1 EDIT : It works if i get only sign = 1 for allLATER EDIT : I still get the same error Fatal error (StockMvt -> id_stock_mvt_reason = -1) Link to comment Share on other sites More sharing options...
guest* Posted March 31, 2011 Share Posted March 31, 2011 @vietnamsorry but I don't understand your problem. The only thing what you have to do is to set the in your DB the table ps_stock_mvt_reason to: NULL instead of auto increment and than reasign again auto increment. For me the error disappeared and I'm able to manage stock without any problems and any error-message on products... Link to comment Share on other sites More sharing options...
vietnam Posted April 6, 2011 Share Posted April 6, 2011 @vietnamsorry but I don't understand your problem. The only thing what you have to do is to set the in your DB the table ps_stock_mvt_reason to: NULL instead of auto increment and than reasign again auto increment. For me the error disappeared and I'm able to manage stock without any problems and any error-message on products... I do not understand exatly how SQL query: ALTER TABLE `ps_stock_mvt_reason` CHANGE `id_stock_mvt_reason` `id_stock_mvt_reason` INT( 11 ) NOT NULL DEFAULT NULL MySQL said: Documentation #1067 - Invalid default value for 'id_stock_mvt_reason' Then i tried ALTER TABLE `ps_stock_mvt_reason` CHANGE `id_stock_mvt_reason` `id_stock_mvt_reason` INT( 11 ) NULL ALTER TABLE `ps_stock_mvt_reason` CHANGE `id_stock_mvt_reason` `id_stock_mvt_reason` INT( 11 ) NOT NULL AUTO_INCREMENT Link to comment Share on other sites More sharing options...
bellini13 Posted April 6, 2011 Share Posted April 6, 2011 i recently upgraded 2 presta shops from v1.2 to v1.4 and the only thing i did was to change the stock order to increase, saved, then changed back to order and saved. I did not experience any problems on these sites, but I did the above because of a new 1.4 installation i previously performed had the issues described here. Simply doing the above solved the problem for me without having to modify any records/tables in mysql directly. Link to comment Share on other sites More sharing options...
vietnam Posted April 6, 2011 Share Posted April 6, 2011 i recently upgraded 2 presta shops from v1.2 to v1.4 and the only thing i did was to change the stock order to increase, saved, then changed back to order and saved. I did not experience any problems on these sites, but I did the above because of a new 1.4 installation i previously performed had the issues described here. Simply doing the above solved the problem for me without having to modify any records/tables in mysql directly. I have used the same solution as http://www.prestashop.com/forums/viewreply/402830/ and as yours lellini13 and yes, this one worked Link to comment Share on other sites More sharing options...
1lk4y Posted April 6, 2011 Share Posted April 6, 2011 When I went to brouse to set up the value and sign theres more then one is that normal or is there only suppose to be one Link to comment Share on other sites More sharing options...
The Ge Posted April 9, 2011 Share Posted April 9, 2011 Hi guys,Had the same problem after an update from 1.2.5.0 to 1.4.0.17. I tried first changing the default stock movement reason to something (actually it doesn't matter to what). It stopped the error, but every time I modified something in the product page it added another row in ps_stock_mvt table. Very annoying! It should check if the movement stock quantity is zero and if it is, it should do nothing!So I looked for the function - it is addStockMvt from /classes/product.php. So I made an override adding at its start if ($quantity == 0) return true; I also attached a file that can be put in /override/classes. I removed my other overrides so I didn't try it in this form, but it should work ok.All in all, I had to fight a fair share of bugs in this upgrade. I'm somehow dissappointed in Presta's Quality Control department. Oh well...All the best. Product.php Link to comment Share on other sites More sharing options...
Jenny75 Posted April 11, 2011 Share Posted April 11, 2011 Hi,This is in the Bug Report... but a few people have managed to fix it by setting the default stock movement reason from "order" to "increase". To do so, go to the BO, click Catalog --> Stock Movement, then scroll down to the bottom.HTH!PS. Post a follow up if this works for you... ithink there are a few bugs with this new stock movement feature. I don't even know what is its purpose. worked for me. many thanks Link to comment Share on other sites More sharing options...
lashonda79 Posted April 26, 2011 Share Posted April 26, 2011 BACKOFFICE-> CATALOG-> STOCK MOVEMENTS-> scroll down to bottom, change "order" to "increase"This has worked for me as well! Thanks a bunch!! Link to comment Share on other sites More sharing options...
wirgism Posted October 10, 2011 Share Posted October 10, 2011 No problem. Do you have access to PHPMYADMIN? Assuming you do, navigate to your database and find the following table: YOURPREFIX_stock_mvt_reason Follow the images: 1. Table in MySQL 2. Click on Structure 3. edit id_stock_mvt_reason 4. turn off auto_increment 5. save changes No Images for the following 6. Next to Structure click on BROWSE 7. There should only be one row of information (Let me know if there is more as I'm not too sure how this table actually works) 8. Click the edit pencil 9. Where it says "id_stock_mvt_reason" set "VALUE" to 0 (zero) 10 Where it says "sign" set "VALUE" to 1 (one) Save by clicking GO. Hope it works. Cheers, Rob Hi, I have same problem... I am a novice in these matters. What do u mean "PHPADMIN" access. I have admin acces in prestashop of site and ftp acces, so what more i need to do so i can fix this problem. And what i need to do programs or something step by step. Thank you for patience. Link to comment Share on other sites More sharing options...
Kvark Posted October 10, 2011 Share Posted October 10, 2011 Hope it works. Cheers, Rob Rob, thanks a lot, it's realy work! Link to comment Share on other sites More sharing options...
varinder Posted February 23, 2012 Share Posted February 23, 2012 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 More sharing options...
varinder Posted February 23, 2012 Share Posted February 23, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now