maicol.cantagallo Posted April 20, 2021 Share Posted April 20, 2021 Hi all. My import script works fine but i have a problem in the multishop. Share my code: $_POST = array( "tab" => "AdminImport", "skip" => 1, "csv" => $fileName, "convert" => '', "regenerate" => 0, "entity" => 1, "iso_lang" => "it", "truncate" => 0, "forceIDs" => "", "match_ref" => 1, "sendemail" => 0, "separator" => ";", "multiple_value_separator" => ",", "import" => 1, "type_value" => $tracciatoCSV ); $import = new AdminImportControllerCore(); $import->ajaxProcessImport() So, this update all fields but not working when delete all old products image and save new. $tracciatoCSV = array('active', 'name', 'category', 'price_tex', 'id_tax_rules_group', 'wholesale_price', 'on_sale', 'reference', 'quantity', 'minimal_quantity', 'description', 'link_rewrite', 'available_for_order', 'show_price', 'image', 'delete_existing_images', 'ean13', 'shop'); CSV is attached. Problem is: does not correctly delete all product images (delete_existing_images) and does not add the new one. Only when multishop is enabled. If multishop is disabled works fine Why? Thanks Senza nome.csv Link to comment Share on other sites More sharing options...
maicol.cantagallo Posted April 20, 2021 Author Share Posted April 20, 2021 8 minutes ago, maicol.cantagallo said: Hi all. My import script works fine but i have a problem in the multishop. Share my code: $_POST = array( "tab" => "AdminImport", "skip" => 1, "csv" => $fileName, "convert" => '', "regenerate" => 0, "entity" => 1, "iso_lang" => "it", "truncate" => 0, "forceIDs" => "", "match_ref" => 1, "sendemail" => 0, "separator" => ";", "multiple_value_separator" => ",", "import" => 1, "type_value" => $tracciatoCSV ); $import = new AdminImportControllerCore(); $import->ajaxProcessImport() So, this update all fields but not working when delete all old products image and save new. $tracciatoCSV = array('active', 'name', 'category', 'price_tex', 'id_tax_rules_group', 'wholesale_price', 'on_sale', 'reference', 'quantity', 'minimal_quantity', 'description', 'link_rewrite', 'available_for_order', 'show_price', 'image', 'delete_existing_images', 'ean13', 'shop'); CSV is attached. Problem is: does not correctly delete all product images (delete_existing_images) and does not add the new one. Only when multishop is enabled. If multishop is disabled works fine Why? Thanks Senza nome.csv 2.22 kB · 0 downloads i think i have solved. I inserted this script before the import procedure: Shop::setContext(Shop::CONTEXT_ALL); and works fine! I hope it will be useful for someone else Thanks Link to comment Share on other sites More sharing options...
J.G. Posted March 14, 2023 Share Posted March 14, 2023 Hello, thanks for your topic. I'm looking for how to import programmatically products on prestashop and i found your idea of simulate post data and using ajaxProcessImport() function from AdminImportController. Is it a good way to proceed ? 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