Jump to content

[SOLVED add custom field to manufactures


Recommended Posts

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 by zoro10 (see edit history)
Link to comment
Share on other sites

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

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:
G6FpSYU.png

Link to comment
Share on other sites

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

great! glad to hear that it works :) 

if you want to mark topic as solved, just follow instructions:

 

 

[sOLVED] Topic
If, 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

  • 2 years later...

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

  • 9 months later...

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

×
×
  • Create New...