Reco-X Posted July 28, 2013 Share Posted July 28, 2013 (edited) I must the edit the import / export of the csv because i have custom fields in my products table, where can i do it?i know i must modify the file controlers/admin/adminimportcontroller.php but i don't know where exactly. Edited February 5, 2014 by Reco-X (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted July 28, 2013 Share Posted July 28, 2013 Maybe it helps if you can give an example of the extra fields (their value, their 'meaning' in words, any known 'match' with Prestashop Product attribute(i.e. where exactly INSIDE a product do you want it to be stored after import etc) Please add an example of your CSV rows. What PrestaShop version do you use? pascal Link to comment Share on other sites More sharing options...
Reco-X Posted July 28, 2013 Author Share Posted July 28, 2013 Here is a picture of the new fields that i created. My version is 1.5.4.1 but i can change for the last one beacuse the site isn't still in production. Link to comment Share on other sites More sharing options...
Reco-X Posted July 31, 2013 Author Share Posted July 31, 2013 . Link to comment Share on other sites More sharing options...
Reco-X Posted October 28, 2013 Author Share Posted October 28, 2013 any idea to do that? Link to comment Share on other sites More sharing options...
PascalVG Posted October 30, 2013 Share Posted October 30, 2013 This may help you: http://www.prestashop.com/forums/topic/157780-solved-import-custom-fields-through-csv-file/ pascal Link to comment Share on other sites More sharing options...
indesign47 Posted November 2, 2013 Share Posted November 2, 2013 (edited) My version is 1.5.4.1 but i can change for the last one because the site isn't still in production. Many improvement and many fix in the last version PS https://github.com/PrestaShop/PrestaShop/archive/development.zip i know i must modify the file controlers/admin/adminimportcontroller.php but i don't know where exactly. case $this->entities[$this->l('Products')]: self::$validators['image'] = array( 'AdminImportController', 'split' ); $this->available_fields = array( 'no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'active' => array('label' => $this->l('Active (0/1)')), 'name' => array('label' => $this->l('Name *')), 'category' => array('label' => $this->l('Categories (x,y,z...)')), 'price_tex' => array('label' => $this->l('Price tax excluded')), 'price_tin' => array('label' => $this->l('Price tax included')), 'id_tax_rules_group' => array('label' => $this->l('Tax rules ID')), 'wholesale_price' => array('label' => $this->l('Wholesale price')), 'on_sale' => array('label' => $this->l('On sale (0/1)')), 'reduction_price' => array('label' => $this->l('Discount amount')), 'reduction_percent' => array('label' => $this->l('Discount percent')), 'reduction_from' => array('label' => $this->l('Discount from (yyyy-mm-dd)')), 'reduction_to' => array('label' => $this->l('Discount to (yyyy-mm-dd)')), 'reference' => array('label' => $this->l('Reference #')), 'supplier_reference' => array('label' => $this->l('Supplier reference #')), 'supplier' => array('label' => $this->l('Supplier')), 'manufacturer' => array('label' => $this->l('Manufacturer')), 'ean13' => array('label' => $this->l('EAN13')), 'upc' => array('label' => $this->l('UPC')), 'ecotax' => array('label' => $this->l('Ecotax')), 'width' => array('label' => $this->l('Width')), 'height' => array('label' => $this->l('Height')), 'depth' => array('label' => $this->l('Depth')), 'weight' => array('label' => $this->l('Weight')), 'quantity' => array('label' => $this->l('Quantity')), 'minimal_quantity' => array('label' => $this->l('Minimal quantity')), 'visibility' => array('label' => $this->l('Visibility')), 'additional_shipping_cost' => array('label' => $this->l('Additional shipping cost')), 'unity' => array('label' => $this->l('Unity')), 'unit_price_ratio' => array('label' => $this->l('Unit price ratio')), 'description_short' => array('label' => $this->l('Short description')), 'description' => array('label' => $this->l('Description')), 'tags' => array('label' => $this->l('Tags (x,y,z...)')), 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), 'link_rewrite' => array('label' => $this->l('URL rewritten')), 'available_now' => array('label' => $this->l('Text when in stock')), 'available_later' => array('label' => $this->l('Text when backorder allowed')), 'available_for_order' => array('label' => $this->l('Available for order (0 = No, 1 = Yes)')), 'available_date' => array('label' => $this->l('Product available date')), 'date_add' => array('label' => $this->l('Product creation date')), 'show_price' => array('label' => $this->l('Show price (0 = No, 1 = Yes)')), 'image' => array('label' => $this->l('Image URLs (x,y,z...)')), 'delete_existing_images' => array( 'label' => $this->l('Delete existing images (0 = No, 1 = Yes)') ), 'features' => array('label' => $this->l('Feature(Name:Value:Position:Customized)')), 'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')), 'condition' => array('label' => $this->l('Condition')), 'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')), 'uploadable_files' => array('label' => $this->l('Uploadable files (0 = No, 1 = Yes)')), 'text_fields' => array('label' => $this->l('Text fields (0 = No, 1 = Yes)')), 'out_of_stock' => array('label' => $this->l('Action when out of stock')), 'advanced_stock_management' => array('label' => $this->l('Advanced stock management')), 'original_name' => array('label' => $this->l('Original name')), 'actors' => array('label' => $this->l('Actors')), 'director' => array('label' => $this->l('Director')), 'duration' => array('label' => $this->l('Duration')), 'country' => array('label' => $this->l('Country')), 'year' => array('label' => $this->l('Year')), 'shop' => array( 'label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.'), ) ); You have to add in classes/Product.php class ProductCore extends ObjectModel /** * @since 1.5.7 * @var string for movie */ public $original_name; public $actors; public $director; public $duration; public $country; public $year; public static $definition = array( /* Movie fields */ 'original_name' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'actors' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'director' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'duration' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'country' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'year' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), add to you csv file Original name Actors Director Duration Country Year Sleepy Hollow Johnny Deep Tim Burton 190 EN 20001231 Edited November 2, 2013 by indesign (see edit history) 1 Link to comment Share on other sites More sharing options...
indesign47 Posted November 5, 2013 Share Posted November 5, 2013 @Reco-X, Hello, Have you test my modification ? 1 Link to comment Share on other sites More sharing options...
Reco-X Posted November 5, 2013 Author Share Posted November 5, 2013 @indesign i don't try the modification yet, i think today in the nigth i'll sit to code it Link to comment Share on other sites More sharing options...
Reco-X Posted January 28, 2014 Author Share Posted January 28, 2014 Yes it work perfectly, also i have created an override for all the classes and controllers who i modified. I show the examples: <?php Class Product extends ProductCore { /*** @var string for movies */ public $original_name; public $actors; public $director; public $duration; public $country; public $year; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['actors'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255); self::$definition['fields']['director'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255); self::$definition['fields']['original_name'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255); self::$definition['fields']['duration'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255); self::$definition['fields']['country'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255); self::$definition['fields']['year'] = array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'size' => 4); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } ?> <?php class AdminImportController extends AdminImportControllerCore { public function __construct() { parent::__construct(); $this->available_fields += array( 'original_name' => array('label' => $this->l('Nombre Original')), 'actors' => array('label' => $this->l('Actores')), 'director' => array('label' => $this->l('Director')), 'duration' => array('label' => $this->l('Duracion')), 'country' => array('label' => $this->l('Pais')), 'year' => array('label' => $this->l('Año')) ); } } ?> And here is a very good tutorial who helps a lot. http://nemops.com/extending-prestashop-objects/#.UuglirTfNEY 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