/rai Posted October 25, 2016 Share Posted October 25, 2016 how I can use the truncateTables() function, to clear tables before importing with loadCategoriesPost () and loadProductsPost () Link to comment Share on other sites More sharing options...
rocky Posted October 25, 2016 Share Posted October 25, 2016 How are you accessing these functions? Are you overriding AdminImport.php? Are you trying to access it from another file? It's a protected function, so it can only be used inside AdminImport.php. Link to comment Share on other sites More sharing options...
/rai Posted October 26, 2016 Author Share Posted October 26, 2016 How are you accessing these functions? Are you overriding AdminImport.php? Are you trying to access it from another file? It's a protected function, so it can only be used inside AdminImport.php. I'm calling from another file.php in admin folder include(_PS_ADMIN_DIR_ . '/../config/config.inc.php'); include(_PS_ADMIN_DIR_ . '/functions.php'); include_once '../controllers/admin/AdminImportController.php'; Link to comment Share on other sites More sharing options...
rocky Posted October 26, 2016 Share Posted October 26, 2016 You can't access the truncateTables function that way. If this code is only for your shop, you can simply change the code to make truncatedTables a public function instead of a protected function. If you are sharing this code with others, you'll need to copy the function to use it outside AdminImportController.php. Or you can create a class that overrides AdminImportController.php so it can access the function. Link to comment Share on other sites More sharing options...
/rai Posted October 26, 2016 Author Share Posted October 26, 2016 You can't access the truncateTables function that way. If this code is only for your shop, you can simply change the code to make truncatedTables a public function instead of a protected function. If you are sharing this code with others, you'll need to copy the function to use it outside AdminImportController.php. Or you can create a class that overrides AdminImportController.php so it can access the function. OK thanks one more question: to import products, prestashop stores images in img / p Every time I import products creates the images, but does not erase the old. I have checked the option to delete images but only deletes in the database. if I delete everything in the folder before importing, would pass something? Link to comment Share on other sites More sharing options...
rocky Posted October 26, 2016 Share Posted October 26, 2016 As long as you're deleting all products and importing them all again, it should be fine to delete all the images starting with numbers in the img/p directories and its subdirectories. It's a bad idea if you're only importing new products, since you'd be losing images for existing products. You could write code that only deletes the images for products that are being added. Link to comment Share on other sites More sharing options...
/rai Posted October 26, 2016 Author Share Posted October 26, 2016 first delete all productsdelete folders 1,2,3,4,5,6,7,8 and 9 in img / pimport productsWould it work? Link to comment Share on other sites More sharing options...
rocky Posted October 26, 2016 Share Posted October 26, 2016 Yes, I would expect that to work. Link to comment Share on other sites More sharing options...
/rai Posted October 26, 2016 Author Share Posted October 26, 2016 Yes, I would expect that to work. works 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