vendetta V Posted January 4, 2016 Share Posted January 4, 2016 I want to synchronize (import) automatically from the FTP.As PrestaShop module allows to import only manually and a few tables, which interests me categories, customers, products and directions. But then I want a table called apart ps_specific_price used for discounts of each product to each customer. And this is not specified in prestashop module when imported manually. Because I say this? It's the script that I will then table If this would be the same in the script that the boards of the modules? I found this script for version 1.5.4.1 and wondered what would be done to adapt to 1.6.1 <! - COMPATIBLE WITH VERSION 1.5.4.1 PRESTASHOP Script to import products and categories in Prestashop SOURCE: http://programadorphp.es/script-para-importar-productos-y-categorias-en-prestashop More data: http://www.prestashop.com/forums/topic/74735-importar-productos-desde-cvs-con-script-no-sube-imagenes/page__p__429097__hl__loadproductspost__fromsearch__1#entry429097 http://www.prestashop.com/forums/topic/117001-adminimport-y-script-de-importacion/page__hl__loadproductspost__fromsearch__1 Here I leave the code script, located in the part of the store, launches a CSV file import products (pro.csv) or categories (cat.csv), as directed by GET ['entity'] The CSV files to be imported must be in the directory /adminxxx/import/pro.csv while our script must be located /adminxxx/script_import.php directory in Prestashop. Call script: http://www.midominio.com/admin123/script_import.php?entity=1 SOLUTIONS: * Sino matter images, add these lines in AdminImportController.php, within the "public function productImport ()" function, Before: if (isset ($ product-> image) && is_array ($ product-> image) && count ($ product-> image)) Add ye this: if (! is_array ($ product-> image)) $ Product-> image = explode ("", $ product-> image); * If "Fatal error: Can not redeclare class ..." comment line // include_once '../controllers/admin/AdminImportController.php'; -> <?php echo "loading.gif"; ob_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'; if (!isset($_GET['entity'])) die(); set_time_limit(0); //$import = New AdminImportControllerCore(); //para version 1.5.4.1 $import = New AdminImportController(); switch ($_GET['entity']) { case 0: loadCategoriesPost(); $import->categoryImport(); break; case 1: loadProductsPost(); $import->productImport(); break; case 2: loadCombinacionesPost(); $import->attributeImport(); break; case 5: loadManufacturersPost(); $import->manufacturerImport(); break; case 6: loadSuppliersPost(); $import->supplierImport(); break; default: die(); break; } exit(); //window.location=”http:script.javascript.”; function loadCategoriesPost() { $_POST = array ( 'tab' => 'AdminImport', 'skip' => '0', 'csv' => 'categories_import.csv', 'convert' => '1', 'entity' => '0', 'separator' => ';', 'multiple_value_separator' => ',', 'forceIDs' => '1', 'import' => 'Importar datos CSV', 'type_value' => array ( 0 => 'id', 1 => 'active', 2 => 'name', 3 => 'parent', 4 => 'root_category', 5 => 'description', 6 => 'meta_title', 7 => 'meta_keywords', 8 => 'meta_description', 9 => 'url_rewrite', 10 => 'image', 11 => 'shop', ), ); } function loadProductsPost() { $_POST = array ( 'tab' => 'AdminImport', 'skip' => '0', 'csv' => 'products_import.csv', 'convert' => '1', 'entity' => '1', 'separator' => ';', 'multiple_value_separator' => ',', 'forceIDs' => '1', 'import' => 'Importar datos CSV', 'type_value' => array ( 0 => 'id', 1 => 'active', 2 => 'name', 3 => 'category', 4 => 'price_tin', 5 => 'tax_rate', 6 => 'wholesale_price', 7 => 'on_sale', 8 => 'reduction_price', 9 => 'reduction_percent', 10 => 'reduction_from', 11 => 'reduction_to', 12 => 'reference', 13 => 'supplier_reference', 14 => 'supplier', 15 => 'manufacturer', 16 => 'ean13', 17 => 'upc', 18 => 'ecotax', 19 => 'weight', 20 => 'quantity', 21 => 'description_short', 22 => 'description', 23 => 'tags', 24 => 'meta_title', 25 => 'meta_keywords', 26 => 'meta_description', 27 => 'link_rewrite', 28 => 'available_now', 29 => 'available_later', 30 => 'available_for_order', 31 => 'date_add', 32 => 'show_price', 33 => 'image', 34 => 'delete_existing_images', 35 => 'features', 36 => 'enabled_internet', 37 => 'state', 38 => 'shop', ), ); } function loadManufacturersPost() { $_POST = array ( 'tab' => 'AdminImport', 'skip' => '0', 'csv' => 'manufacturers_import.csv', 'convert' => '1', 'entity' => '5', 'separator' => ';', 'multiple_value_separator' => ',', 'forceIDs' => '1', 'import' => 'Importar datos CSV', 'type_value' => array ( 0 => 'id', 1 => 'active', 2 => 'name', 3 => 'description', 4 => 'short_description', 5 => 'meta_title', 6 => 'meta_keywords', 7 => 'meta_description', 8 => 'shop', ), ); } function loadSuppliersPost() { $_POST = array ( 'tab' => 'AdminImport', 'skip' => '0', 'csv' => 'suppliers_import.csv', 'convert' => '1', 'entity' => '6', 'separator' => ';', 'multiple_value_separator' => ',', 'forceIDs' => '1', 'import' => 'Importar datos CSV', 'type_value' => array ( 0 => 'id', 1 => 'active', 2 => 'name', 3 => 'description', 4 => 'short_description', 5 => 'meta_title', 6 => 'meta_keywords', 7 => 'meta_description', 8 => 'shop', ), ); } function loadCombinacionesPost() { $numero = count($_POST); $_POST = array ( 'tab' => 'AdminImport', 'skip' => '1', 'csv' => 'combinaciones.csv', 'convert' => ”, 'entity' => '2', 'separator' => ';', 'multiple_value_separator' => ',', 'import' => 'Importar datos CSV', 'u' => ”, 'type_value' => array ( 0 => 'id_product', 1 => 'group', 2 => 'attribute', ), ); } ?> Link to comment Share on other sites More sharing options...
shacker Posted January 5, 2016 Share Posted January 5, 2016 you get here https://www.prestashop.com/forums/topic/286410-how-to-allow-csv-import-of-specific-prices/ Link to comment Share on other sites More sharing options...
vendetta V Posted January 7, 2016 Author Share Posted January 7, 2016 (edited) you get here https://www.prestashop.com/forums/topic/286410-how-to-allow-csv-import-of-specific-prices/ So the only solution is to update the tables directly in the database? I think chooses to try this application https://www.prestashopmanager.com/free-download/ I understand you can do all the things I want Edited January 7, 2016 by vendetta V (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