yguerin Posted May 26, 2016 Share Posted May 26, 2016 Dear, prestashop: 1.6 I use the following code to do my import: the header: # init les fct + scriptob_flush();flush();define('_PS_ADMIN_DIR_', getcwd());include(_PS_ADMIN_DIR_.'/../config/config.inc.php');include(_PS_ADMIN_DIR_.'/functions.php');include_once '../controllers/admin/AdminImportController.php'; my call: ($fichier and $langue are set before) loadProductsPost($fichier, $langue);$import->productImport(); function loadProductsPost($fichier, $langue) {$_POST = array ('truncate' => 'off', 'delete_existing_images' = '1''tab' => 'AdminImport','skip' => '1','csv' => $fichier,'convert' => '1','regenerate' => '0','entity' => '1','separator' => ';','multiple_value_separator' => ',','forceIDs' => '1','import' => 'import','iso_lang' => $langue,'type_value' =>array (0 => 'id',1 => 'reference',2 => 'category',3 => 'description',4 => 'active',5 => 'meta_description',6 => 'name',7 => 'price',8 => 'quantity',9 => 'description_short',10 => 'ean13',11 => 'upc',12 => 'image',13 => 'url_rewrite',),);} I try to include the "delete_existing_images" but without any success so I need some help Regards, Yves Link to comment Share on other sites More sharing options...
yguerin Posted May 26, 2016 Author Share Posted May 26, 2016 (edited) Dear, The quick and dirty hack is to add: $product->deleteImages(); to the AdminImportController.php line: 1811 But I dislike this king of doing. So until I got a better answer or a more elegant method I will use this one. Regards, Yves Edited May 26, 2016 by yguerin (see edit history) Link to comment Share on other sites More sharing options...
yguerin Posted May 26, 2016 Author Share Posted May 26, 2016 Dear, After more testing this hack is not working as expected, rollback. Regards, Yves Link to comment Share on other sites More sharing options...
yguerin Posted May 26, 2016 Author Share Posted May 26, 2016 Dear, My dirty hack is working you have to start with an empty catalogue next step try to add 'delete_existing_images' in my php code Regards, Yves Link to comment Share on other sites More sharing options...
yguerin Posted May 26, 2016 Author Share Posted May 26, 2016 [RESOLVED] Dear, I finally understand something about prestashop: - do not touch any code - just add a column in your csv file as: header: delete_existing_images row: 0|1 and map the column number in your php code as: ... 12 => 'image',13 => 'url_rewrite', 14 => 'delete_existing_images',), Run import Regards, Yves Link to comment Share on other sites More sharing options...
saeyo Posted October 30, 2017 Share Posted October 30, 2017 Hi @yguerin Thanks for the solution! I'm gonna try it. Which file should I modify? Thanks 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