zoro10 Posted November 5, 2013 Share Posted November 5, 2013 (edited) hi, I'm tryng to add new custom field on the manufactures registry page in the back office. I used the guide in this topic http://www.prestashop.com/forums/topic/246888-add-custom-field-products-15/ but it can't do the all because I need to insert the new value into the db exactly in the table of the manufacturer. I use prestashop 1.5.6.0. thanks for help. Edited November 12, 2013 by zoro10 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 5, 2013 Share Posted November 5, 2013 hello you will need to extend manufacturer object and modify back office theme file related to manufacturer page. you can follow guides here: http://www.prestashop.com/forums/topic/285258-how-to-add-new-text-field-to-a-product-which-will-only-be-available-from-the-bo/?do=findComment&comment=1438506 but instead of products, modify: 1) table related to manufacturer (ps_manufacturer) 2) instead of classes/product.php modify the manufacturer.php file 3) instead of products controller .tpl file, modify manufacturers controller .tpl file effect will be the same Link to comment Share on other sites More sharing options...
zoro10 Posted November 5, 2013 Author Share Posted November 5, 2013 thanks vekia I'm trying it Link to comment Share on other sites More sharing options...
zoro10 Posted November 5, 2013 Author Share Posted November 5, 2013 at point 3 I can't recognize where add the code Link to comment Share on other sites More sharing options...
vekia Posted November 5, 2013 Share Posted November 5, 2013 in this case you need to define field in controllers/admin/AdminManufacturersController.php file, you will see there object definition: $this->fields_form = array(... ... ... ... ); just add there your field array, something like: array( 'type' => 'text', 'label' => $this->l('Field:'), 'name' => 'field', 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), effect: Link to comment Share on other sites More sharing options...
zoro10 Posted November 5, 2013 Author Share Posted November 5, 2013 ok done all but I have an error: error during creation . manufacturer (Unknown column 'add_partita_iva' in 'field list') Link to comment Share on other sites More sharing options...
zoro10 Posted November 5, 2013 Author Share Posted November 5, 2013 the error is in : 'add_partita_iva' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'), because if I comment this raw the error doesn't appear but not record Link to comment Share on other sites More sharing options...
vekia Posted November 5, 2013 Share Posted November 5, 2013 have you got this field in database? (manufacturers table) Link to comment Share on other sites More sharing options...
zoro10 Posted November 5, 2013 Author Share Posted November 5, 2013 no error now (wrong name in the table, sorry) but not record anymore... Link to comment Share on other sites More sharing options...
zoro10 Posted November 6, 2013 Author Share Posted November 6, 2013 any ideas for the not recording in the db? Link to comment Share on other sites More sharing options...
vekia Posted November 6, 2013 Share Posted November 6, 2013 let's clarify. 1) you created new field in database named for example: new_field 2) then in manufacturers class file (classes/Manufacturers.php) you added this field (new_field) to object definition (both in variables and object definition) 3) then created field with the same name (new_field) in controller object fieldlist (controllers/adminManufacturersCOntroller.php) that's right? Link to comment Share on other sites More sharing options...
zoro10 Posted November 7, 2013 Author Share Posted November 7, 2013 yes i have done all you say Link to comment Share on other sites More sharing options...
zoro10 Posted November 7, 2013 Author Share Posted November 7, 2013 any ideas? Link to comment Share on other sites More sharing options...
zoro10 Posted November 11, 2013 Author Share Posted November 11, 2013 I have to qualify some permission? Link to comment Share on other sites More sharing options...
vekia Posted November 11, 2013 Share Posted November 11, 2013 i followed instructions that i suggested to use, everything works. and database: make sure that you f ollowed instructions well. Link to comment Share on other sites More sharing options...
zoro10 Posted November 12, 2013 Author Share Posted November 12, 2013 SOLVED!!!! thanks vekia. how can I, in modify, show the field before the modify? Link to comment Share on other sites More sharing options...
vekia Posted November 12, 2013 Share Posted November 12, 2013 great! glad to hear that it works if you want to mark topic as solved, just follow instructions: [sOLVED] TopicIf, after posting a topic, you find a solution to your problem, please indicate it in your post and describe the solution.Furthermore if you are the author of the topic for which a solution has been found, please edit your topic title to mark it as [sOLVED].To mark a topic as [solved] :- Edit the first post of your topic by clicking on the "Edit" button,- Click on the "Use full editor" button,- Add the "[solved]" string at the beginning of your topic title and click on the "Submit Modified Post" button. Link to comment Share on other sites More sharing options...
zoro10 Posted November 12, 2013 Author Share Posted November 12, 2013 done 1 Link to comment Share on other sites More sharing options...
zoro10 Posted November 12, 2013 Author Share Posted November 12, 2013 I have a bug when I show, in modify, the fields, one remaing blank and the others load the value from the table. any ideas? I've done 3 custom field but the first doens't wont appear Link to comment Share on other sites More sharing options...
vekia Posted November 12, 2013 Share Posted November 12, 2013 you created 3 new fields ? and one of them doesn't work well? Link to comment Share on other sites More sharing options...
zoro10 Posted November 14, 2013 Author Share Posted November 14, 2013 now all works well thanks! Link to comment Share on other sites More sharing options...
vekia Posted November 14, 2013 Share Posted November 14, 2013 hello, thank you for information. may i know what was wrong? Link to comment Share on other sites More sharing options...
PizzaPie Posted February 18, 2016 Share Posted February 18, 2016 Hi, i'm gonna try to create new custom fields to manufacturers too... but first I would like to know just a small thing: what happens to my new fields when I upgrade prestashop? Have I to redo all the changes for each update? Is there the risk of losing data? Link to comment Share on other sites More sharing options...
pablobuendiaelvira Posted November 30, 2016 Share Posted November 30, 2016 Hello, Sorry for my awful English. I know the theme is closed but I need to add a new select field (drop down) and then save the selected element to the bbdd. Can you advise me? Thank you! Hello, Sorry for my awful English. I know the theme is closed but I need to add a new select field (drop down) and then save the selected element to the bbdd. Can you advise me? Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts