marcusnye Posted May 19, 2015 Share Posted May 19, 2015 I was hoping for some help in my setup. I have a Prestashop install on 1.6.0.14 - I am importing products via CSV from an external stock management system using the normal CSV import routine, which is working really well except for one issue - if a product's stock reduces to 0 (zero) on the CSV import, it is simply ignored on the routine. ie - We have a product with with one item in stock, its sold in our physical shop, the next CSV import shows zero on the file, however Prestashop continues to show 1 in stock. Any figure above 0 updates perfectly, so if i change it on the CSV to quantity of 5, it updates. If i then change it back to 0, Prestashop remains at 5 Is this by design or is there a workaround? For now, its a case or manually updating the stock on Prestashop down to zero when something is sold outside of the shop, but we are bound to miss something! Many thanks in advance! The file contains: Reference#,Name,PriceTaxExcluded,Quantity,WholesalePrice Link to comment Share on other sites More sharing options...
shacker Posted May 25, 2015 Share Posted May 25, 2015 try to import only product rec and quantity, this overrides all values Link to comment Share on other sites More sharing options...
juergen-sfx Posted June 12, 2015 Share Posted June 12, 2015 try to import only product rec and quantity, this overrides all values Please elaborate what you mean with "product rec" I tried to import a test CSV with this data: ID;Quantity 4868;0 This will not update the products quantity value. We are using Presta version 1.6.0.14 Link to comment Share on other sites More sharing options...
shacker Posted June 12, 2015 Share Posted June 12, 2015 sorry, product reference, And select the option to force product refrence as keyword Link to comment Share on other sites More sharing options...
juergen-sfx Posted June 12, 2015 Share Posted June 12, 2015 (edited) UPDATE: I updated my Patch for Presta version 1.6.1.17 Just copy the file to /override/controllers/admin/ Download: AdminImportController.php Old Patch file (do not use): AdminImportController.diff.txt On 12.6.2015 at 12:59 PM, shacker said: sorry, product reference, And select the option to force product refrence as keyword Ok. I tried as you reccommend, but my quantities do not change to "0". I'm not sure if this is caused by the multistore configuration or because we do not use the advanced stock management. I was able to find the reason why this is not working in our setup. in controllers/admin/AdminImportController.php Line 1827 the product quantity is checked. If quantity is 0 no database update will be done. I suppose this should prevent overwriting all stock values with zero if a empty quantities column is imported, but it also prevents setting a stock value to zero via csv-import. I changed this and a second check and now my import will write zero values just fine. Diff file attached. Edited January 16, 2018 by juergen-sfx Updated Solution (see edit history) 2 Link to comment Share on other sites More sharing options...
shacker Posted June 12, 2015 Share Posted June 12, 2015 sorry, if you quantity in the CSV its zero, the system dont update. That have sense because maybe you have stock in your store, but your supplier not. You can change in the CSV the zer ovalues of stock to -1, that did the trick Link to comment Share on other sites More sharing options...
marcusnye Posted June 12, 2015 Author Share Posted June 12, 2015 thanks for your help so far, looked promising, but when I made the changes from the diff file juergen-sfx offered, but i tried a couple of times and each time it broke the CSV import option (blank white screen). So i tried the suggestion of -1 for stock but it ignores this too. Its a weird one this, we only have one parts warehouse, and when the quantity is zero, we can't sell any more until stock is obtained from distribution. So wouldn't want to sell something that's physically not on premises Link to comment Share on other sites More sharing options...
Aromatik Posted July 24, 2015 Share Posted July 24, 2015 AdminImportController.diff.txt Ok. I tried as you reccommend, but my quantities do not change to "0". I'm not sure if this is caused by the multistore configuration or because we do not use the advanced stock management. I was able to find the reason why this is not working in our setup. in controllers/admin/AdminImportController.php Line 1827 the product quantity is checked. If quantity is 0 no database update will be done. I suppose this should prevent overwriting all stock values with zero if a empty quantities column is imported, but it also prevents setting a stock value to zero via csv-import. I changed this and a second check and now my import will write zero values just fine. Diff file attached. Thanks!!! Its really solve the problem! I have PS 1.6.0.14 Link to comment Share on other sites More sharing options...
Danijelp Posted August 13, 2015 Share Posted August 13, 2015 Thx juergen-sfx! it work for me on 1.6.0.14 Link to comment Share on other sites More sharing options...
lixotuka Posted August 17, 2015 Share Posted August 17, 2015 Anyone know if the last version of Prestashop solves this issue? Link to comment Share on other sites More sharing options...
shacker Posted August 17, 2015 Share Posted August 17, 2015 i think works as usual, becouse 0 stock means that the privider dont have stock, but you have stock in your store Link to comment Share on other sites More sharing options...
lixotuka Posted August 17, 2015 Share Posted August 17, 2015 (edited) i think works as usual, becouse 0 stock means that the privider dont have stock, but you have stock in your store 0 stock is 0 stock. I think this is a bug in this version (I'm using 1.6.0.13) because it worked properly before. I'm sure it's an issue of the latest versions of Prestashop because this also happens in the "Discount percent" column of the CSV. When I want to delete a discount and change to 0, no catches it, it only works if I put a minimum of 1, and that does not make any sense. That's why I wonder if in the latest version of Prestashop this is solved. Edited August 17, 2015 by lixotuka (see edit history) 2 Link to comment Share on other sites More sharing options...
zgredek Posted November 11, 2015 Share Posted November 11, 2015 (edited) AdminImportController.diff.txt Ok. I tried as you reccommend, but my quantities do not change to "0". I'm not sure if this is caused by the multistore configuration or because we do not use the advanced stock management. I was able to find the reason why this is not working in our setup. in controllers/admin/AdminImportController.php Line 1827 the product quantity is checked. If quantity is 0 no database update will be done. I suppose this should prevent overwriting all stock values with zero if a empty quantities column is imported, but it also prevents setting a stock value to zero via csv-import. I changed this and a second check and now my import will write zero values just fine. Diff file attached. Hey Magic! I lookin for answer to try repair my quantity upload 0 via CSV I found your post, some people says its works but my ~ line 1827 and near this in AdminImportController.php is dont have any code about quantity. I attached my code from this file - can You look at this and please give some suggestions/instructions or smth? Its Prestashop 1.6.1.2 This is my last needed modification in presta, and i spend like 4 days about that issue, no effect :-( Ah, i just try to found your start and ending sections of code what u give me and change it, doesn't work - error page when trying load import csv page :/ AdminImportController.php.txt Edited November 11, 2015 by zgredek (see edit history) Link to comment Share on other sites More sharing options...
kasutajanimi Posted November 23, 2015 Share Posted November 23, 2015 look line 1929 1 Link to comment Share on other sites More sharing options...
snehalmcse Posted January 23, 2016 Share Posted January 23, 2016 (edited) thanks this worked for me -1 works thanks @PrestaShop Legend in combination file i changed stock to "-1" and in back office it shows "-1 stock" and in front office the product page buy button is gone" so it worked for me Edited January 23, 2016 by snehalmcse (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted January 23, 2016 Share Posted January 23, 2016 can be a bug related to the ps version Link to comment Share on other sites More sharing options...
Lux-a-Porter Posted January 27, 2016 Share Posted January 27, 2016 Hi, I have a similar problem: in the last month, when a product is sold I receive a notification on the backoffice "recent orders", but when I go to the order, it doesn´t say which product was sold, only the cost of the sold product and the product is still available (in my shop I only have 1 product of each, so when it ´s sold it should get out of stock and show 0 in the backoffice, but it doesn´t... Luckily I have different prices in almos all products, so I could discover the one which has been sold. Can anyone please help me? Link to comment Share on other sites More sharing options...
shacker Posted February 11, 2016 Share Posted February 11, 2016 ok, that can be a db related issue. scan with ps cleaner module with fix option Link to comment Share on other sites More sharing options...
susieb Posted February 12, 2016 Share Posted February 12, 2016 (edited) Hi - I'm really new to this. I want to update my products stock from the supplier every day ideally. I have uploaded the products with a csv file including quantities. When I now try and upload a csv file to update the quantites it doesn't change them even though it says the upload was successful. I have looked in cpanel public html, controller, then adminimport controller and can't see the line you say to change either 1929 or 1827. Can anyone help? Am I doing the right thing in cpanel? There is a lot about quantities in 1929 but am really struggling and don't want to make a massive mistake. I also don't want to use advanced stock management but just a csv upload to change the quantity. I don't really want to spend over £100 on some mass management module if possible. Can anyone help? Edited February 12, 2016 by susieb (see edit history) Link to comment Share on other sites More sharing options...
Pieros1962 Posted March 24, 2016 Share Posted March 24, 2016 for me after this change on line 1827 delete && (int)$product->quantity works fine: if (isset($product->quantity) && (int)$product->quantity) { + if (isset($product->quantity)) { 1 Link to comment Share on other sites More sharing options...
servetsarap Posted April 7, 2016 Share Posted April 7, 2016 AdminImportController.diff.txt Ok. I tried as you reccommend, but my quantities do not change to "0". I'm not sure if this is caused by the multistore configuration or because we do not use the advanced stock management. I was able to find the reason why this is not working in our setup. in controllers/admin/AdminImportController.php Line 1827 the product quantity is checked. If quantity is 0 no database update will be done. I suppose this should prevent overwriting all stock values with zero if a empty quantities column is imported, but it also prevents setting a stock value to zero via csv-import. I changed this and a second check and now my import will write zero values just fine. Diff file attached. i couldn't manage to open diff file. i'm noob at developing. Is it possible to send your edited file or explain how to do with different something? Link to comment Share on other sites More sharing options...
juergen-sfx Posted April 8, 2016 Share Posted April 8, 2016 i couldn't manage to open diff file. i'm noob at developing. Is it possible to send your edited file or explain how to do with different something? Hi. I cannot send you the file, because this thread is pretty old and I did not update my patch to recent versions of PrestaShop. Open the File in a decent text Editor like Notepad++, Sublime, Textmate or Gedit. Search in your file for the lines marked with a leading "-" and replace them with the ones marked with a leading "+". Do not add the "+" Character to your File! Link to comment Share on other sites More sharing options...
servetsarap Posted April 8, 2016 Share Posted April 8, 2016 Thank you so much. İ will try to do it. Link to comment Share on other sites More sharing options...
Doudoupf Posted May 24, 2016 Share Posted May 24, 2016 Hi , i have the same problem . i have try to delete this : && (int)$product->quantity at line 1929 (PS1614) But dont work for me , i have error : activate stock advanced , i have do it .. but always error Link to comment Share on other sites More sharing options...
vucumbra Posted September 15, 2016 Share Posted September 15, 2016 how fix this problem? Link to comment Share on other sites More sharing options...
vucumbra Posted September 15, 2016 Share Posted September 15, 2016 and replace them with the ones marked with a leading "+". Do not add the "+" Character to your File! wich language is this? I have not understand nothing Link to comment Share on other sites More sharing options...
juergen-sfx Posted September 15, 2016 Share Posted September 15, 2016 wich language is this? I have not understand nothing What did you not understand? Link to comment Share on other sites More sharing options...
halmeida Posted September 29, 2016 Share Posted September 29, 2016 Hello, im in trouble here! i also have a problem updating my quantities through CSV importing, my product updates quantity to "8", as i can see on catalog search, but in product details, my product still remains with quantity "1". (presta 1.6.0.8) In the database i found the new value stored in ps_stock_available -> quantity but not in ps_product-quantity... So manually all is updated fine, but with importing tool, only the quantity in ps_stock_available is updated. How can i solve this? Thanks for the help. Link to comment Share on other sites More sharing options...
koguja Posted February 14, 2017 Share Posted February 14, 2017 Hello, I'm using version 1.6.1.6 and also have this problem, if quantity "0" , update not worked How can i solve this? Thanks for the help. Link to comment Share on other sites More sharing options...
shacker Posted February 18, 2017 Share Posted February 18, 2017 Hello, I'm using version 1.6.1.6 and also have this problem, if quantity "0" , update not worked How can i solve this? Thanks for the help. check this post. the solution is change the adminimportcontroller.php Link to comment Share on other sites More sharing options...
koguja Posted February 19, 2017 Share Posted February 19, 2017 Yes, I know. But when I try remove && (int)$product->quantity, this is not help me. Link to comment Share on other sites More sharing options...
shacker Posted February 19, 2017 Share Posted February 19, 2017 you delete the class_index.php in cache folder? 1 Link to comment Share on other sites More sharing options...
ballashop Posted March 2, 2017 Share Posted March 2, 2017 hi, I have the same problem, I use PS 1.6.1.4 if I write -1 works, if I write 0 (zero) doesn't works any suggestion? Thanks Link to comment Share on other sites More sharing options...
koguja Posted March 2, 2017 Share Posted March 2, 2017 you delete the class_index.php in cache folder? Thanks, when I has deleted this file, Import with "0" is worked. Link to comment Share on other sites More sharing options...
koguja Posted March 2, 2017 Share Posted March 2, 2017 hi, I have the same problem, I use PS 1.6.1.4 if I write -1 works, if I write 0 (zero) doesn't works any suggestion? Thanks Try to search and remove && (int)$product->quantity, in controllers/admin/AdminImportController.php. After this, you need delete the class_index.php in cache folder, Prestashop make new Link to comment Share on other sites More sharing options...
ballashop Posted March 2, 2017 Share Posted March 2, 2017 Try to search and remove && (int)$product->quantity, in controllers/admin/AdminImportController.php. After this, you need delete the class_index.php in cache folder, Prestashop make new thanks, I'll try and I'll come back soon Link to comment Share on other sites More sharing options...
ballashop Posted March 2, 2017 Share Posted March 2, 2017 I did, import csv does not work anymore if I restore the original file that area works! Any suggestion? thanks a lot Link to comment Share on other sites More sharing options...
ballashop Posted March 9, 2017 Share Posted March 9, 2017 Any suggestion? thanks Link to comment Share on other sites More sharing options...
Ghacko Posted May 26, 2017 Share Posted May 26, 2017 Working for me, thanks to juergen-sfx PS 1.6.1.9 Link to comment Share on other sites More sharing options...
tyz Posted August 19, 2017 Share Posted August 19, 2017 eliminar && ( int ) $ product -> quantity , en controllers / admin / AdminImportController.php funciona ok PS 1.6.1.1 Link to comment Share on other sites More sharing options...
Murphy Posted January 21, 2018 Share Posted January 21, 2018 need help, my csv import is not working now after overwriting with the new adminimportcontroller, i downloaded orginal file from prestashop and overwrite but still not able to see csv import page when clicked on !!! Link to comment Share on other sites More sharing options...
shacker Posted January 23, 2018 Share Posted January 23, 2018 delete the class_index file in the cache folder and try again Link to comment Share on other sites More sharing options...
Arminet Posted June 7, 2018 Share Posted June 7, 2018 (edited) It is not recommended to modify the controllers directly. Instead, a copy of the AdminImportController file found in "controllers / admin" should be made to the "override" folder. The file that we will modify is the one that we just copied. Then, for the changes to take effect we must delete the file "class_index.php" from the folder "cache" so that Prestashop can regenerate it A greeting. Arminet Edited June 7, 2018 by Arminet (see edit history) Link to comment Share on other sites More sharing options...
Erick Posted November 1, 2018 Share Posted November 1, 2018 (edited) Yes. You only change file: /controllers/admin/AdminImportController.php line 2404 and Change this: if (isset($info['quantity']) && (int)$info['quantity']) { to this: if (isset($info['quantity']) && (int)$info['quantity']>-1) { Edited November 1, 2018 by Erick disclosure my path (see edit history) 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