kabir Posted April 1, 2022 Share Posted April 1, 2022 Hi, I would like to import products from a third-party provided csv file. There are so many products which have very low stock such as, 1 or 2. I would like to import only those products who have a minimum stock of 2. Can you please help me how I can do that with Prestashop store manager or any other way? Thanks in advance. Link to comment Share on other sites More sharing options...
endriu107 Posted April 3, 2022 Share Posted April 3, 2022 You can open this file in any CSV editor, sort by quantity and remove all unwanted rows or skip those rows on import. Link to comment Share on other sites More sharing options...
kabir Posted April 3, 2022 Author Share Posted April 3, 2022 Hi, Thank you very much for your suggestion. But the problem is that I get the CSV file from url link. That's why it is not possible to modify the CSV. Yes, manually I can do that every time after downloading the file form the server but it is huge time consuming. Link to comment Share on other sites More sharing options...
knacky Posted April 4, 2022 Share Posted April 4, 2022 (edited) How do you download a remote csv file? How do you import into Prestashop? Editing csv is very simple. But there are several ways to do it. For example, you can create a second csv file and insert only lines according to the conditions. There are many examples of how to do this on the Internet. Edited April 4, 2022 by knacky (see edit history) Link to comment Share on other sites More sharing options...
knacky Posted April 4, 2022 Share Posted April 4, 2022 (edited) $in = fopen('original.csv', 'r'); $out = fopen('new.csv', 'w'); while( $row = fgetcsv( $in, 10000)){ if( $row[5] > 2 ){ fputcsv($out, $row); } } fclose($in); fclose($out); unlink('original.csv'); rename('new.csv', 'original.csv'); row[5] is the column number where quantity is. It starts from row[0]. Edited April 4, 2022 by knacky (see edit history) Link to comment Share on other sites More sharing options...
kabir Posted April 4, 2022 Author Share Posted April 4, 2022 5 hours ago, knacky said: How do you download a remote csv file? How do you import into Prestashop? Editing csv is very simple. But there are several ways to do it. For example, you can create a second csv file and insert only lines according to the conditions. There are many examples of how to do this on the Internet. Hi, Thank you very much for your help. My suppliers provided me with csv link, for example, https://..............csv. I use 2 modules which are 'Prestashop Store manager' and 'Product catalog (CSV, Excel) import module' for importing the products into my prestashop. Link to comment Share on other sites More sharing options...
kabir Posted April 4, 2022 Author Share Posted April 4, 2022 5 hours ago, knacky said: $in = fopen('original.csv', 'r'); $out = fopen('new.csv', 'w'); while( $row = fgetcsv( $in, 10000)){ if( $row[5] > 2 ){ fputcsv($out, $row); } } fclose($in); fclose($out); unlink('original.csv'); rename('new.csv', 'original.csv'); row[5] is the column number where quantity is. It starts from row[0]. Thank you very much. I would like to ask you where I should put this expression? Link to comment Share on other sites More sharing options...
knacky Posted April 4, 2022 Share Posted April 4, 2022 Unfortunately, I can't help anymore. This is just an example of how to remove invalid entries from a CSV file, not a ready-made and functional solution !!! Ask to modify the module developer. No one here will research third party modules and give solutions, it's time consuming. Link to comment Share on other sites More sharing options...
kabir Posted April 4, 2022 Author Share Posted April 4, 2022 13 minutes ago, knacky said: Unfortunately, I can't help anymore. This is just an example of how to remove invalid entries from a CSV file, not a ready-made and functional solution !!! Ask to modify the module developer. No one here will research third party modules and give solutions, it's time consuming. Thank you very much for your help. Much appreciated. The mathematical expression you shared will help me lots. Link to comment Share on other sites More sharing options...
Constantino Posted April 8, 2022 Share Posted April 8, 2022 On 4/2/2022 at 1:32 AM, kabir said: Hi, I would like to import products from a third-party provided csv file. There are so many products which have very low stock such as, 1 or 2. I would like to import only those products who have a minimum stock of 2. Can you please help me how I can do that with Prestashop store manager or any other way? Thanks in advance. you can do it via Store Manager using the expression formula during import, setting a rule for the identification field (e.g. sku) - if the CSV file with the quantity field is greater than 2 then take the value from the sku column, else empty with an empty field for identification the product will not be imported, the import result will show how many products were skipped contact Store Manager support for a formula https://www.prestashopmanager.com/support-center/contact-us/ Link to comment Share on other sites More sharing options...
kabir Posted April 8, 2022 Author Share Posted April 8, 2022 7 hours ago, Constantino said: you can do it via Store Manager using the expression formula during import, setting a rule for the identification field (e.g. sku) - if the CSV file with the quantity field is greater than 2 then take the value from the sku column, else empty with an empty field for identification the product will not be imported, the import result will show how many products were skipped contact Store Manager support for a formula https://www.prestashopmanager.com/support-center/contact-us/ Hi, Thank you very much for your suggestion. Actually Store manager charge a fee for customized expression if the expression is complex one. If you know any example of this expression and share with us, it would be great. Thanks again. Link to comment Share on other sites More sharing options...
Constantino Posted April 8, 2022 Share Posted April 8, 2022 I don't think it is complex, I would recommend contacting them anyway. you can also use this article as a hint https://www.prestashopmanager.com/useful-articles/how-to/how-to-manage-prestashop-data-in-the-process-of-import-by-means-of-expression/ 1 Link to comment Share on other sites More sharing options...
kabir Posted April 9, 2022 Author Share Posted April 9, 2022 3 hours ago, Constantino said: I don't think it is complex, I would recommend contacting them anyway. you can also use this article as a hint https://www.prestashopmanager.com/useful-articles/how-to/how-to-manage-prestashop-data-in-the-process-of-import-by-means-of-expression/ Many many thanks for the article. That's what I am looking for. 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