Jump to content

trying to add some fields into prestashop admin app


plaszma

Recommended Posts

Hello,
I want to add a new field into catalog->info tab of the admin part of prestashop.For doing that, I must understand how it's made update for one product from php behind.I introduced those fields that interested me, but I don't know where (in which file) is made the update of product (in my case).I add those properties (the new fields) in constructor of Product class.If someone understand better the structure of Prestashop (at least admin part), please tell me how it's made updating of product but at php level.

Many thanks,

Link to comment
Share on other sites

  • 2 weeks later...

1. add the field to the table 'ps_product_lang'
2. add the field to the form on the file 'tabs/adminproducts.php', and don't forget to name it properly e.g. technology_1
3. change the file 'classes/product.php' like this (my new field is called technology):

4.at around line 60 add: public $techonology;
5. at around line 194 add to the $fieldsValidateLang array: 'techonology' => 'isCleanHtml'
6. at around line 274 add: at around line 274 add: $fields[$language['id_lang']]['techonology'] = (isset($this->techonology[$language['id_lang']])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this->techonology[$language['id_lang']], true)) : '';

Link to comment
Share on other sites

1. add the field to the table 'ps_product_lang'
2. add the field to the form on the file 'tabs/adminproducts.php', and don't forget to name it properly e.g. technology_1
3. change the file 'classes/product.php' like this (my new field is called technology):

4.at around line 60 add: public $techonology;
5. at around line 194 add to the $fieldsValidateLang array: 'techonology' => 'isCleanHtml'
6. at around line 274 add: at around line 274 add: $fields[$language['id_lang']]['techonology'] = (isset($this->techonology[$language['id_lang']])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this->techonology[$language['id_lang']], true)) : '';


with version 1.3.1 you have to change the point number 5 into:
'techonology' => 'isString'


and work perfectly

Thx oren
Link to comment
Share on other sites

  • 4 months later...

hi, I added a field to my products but now browing them the table is larger than the page. How to resize coloumns for item fields? [sOLVED: adding the field in the AdminProduct page you can specify the width of the field to be displayed]

[EDIT] Another issue is that on duplicating a product, that field is left empty.

Thanks

Link to comment
Share on other sites

Ok,
But I need to add some fields to implement shipping custs, that will use Wide x height x depth of the product.

So I'm developing a module, is it inconsistent I sell the module and ask to the user do all of this changes, don't you think?

With the module, I can:
1. add the field to the table ‘ps_product_lang’

But I don't know how can I do that without overwrite those files.
2. add the field to the form on the file ‘tabs/adminproducts.php’, and don’t forget to name it properly e.g. technology_1
3. change the file ‘classes/product.php’ like this (my new field is called technology):
4.at around line 60 add: public $techonology;
5. at around line 194 add to the $fieldsValidateLang array: ‘techonology’ => ‘isCleanHtml’
6. at around line 274 add: at around line 274 add: $fields[$language[‘id_lang’]][‘techonology’] = (isset($this->techonology[$language[‘id_lang’]])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this->techonology[$language[‘id_lang’]], true)) : ‘’;

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...