Jump to content

Edit History

Anonymous No.2

Anonymous No.2


made clearer

I have PS 1.7.5.2. What is the proper way of adding custom fields to products, customers etc?

I have created my module and during installation I create new fields by executing some sql:

$sqlInstall="ALTER TABLE " . _DB_PREFIX_ . "product "
        . "ADD ext_id VARCHAR(20) NULL;";

I have added some hooks, for example, hookAdditionalCustomerFormFields. My new field appears in the backend and this is OK. But it does not appear in the api request http://localhost/prestashop/api/products/?schema=blank

until I add a class override

class Product extends ProductCore

..

Overrides seem to be not supported in 1.7, though I can see my new fields via api calls.

My question is: is overriding classes the proper way of adding custom fields and make them appear in the api calls? Or should I do something in my module instead (add some extra hook?) to appear custom fields in the api calls?

 

 

Anonymous No.2

Anonymous No.2

I have PS 1.7.5.2. What is the proper way of adding custom fields to products, customers etc?

I have created my module and during installation I create new fields by executing some sql:

$sqlInstall="ALTER TABLE " . _DB_PREFIX_ . "product "
        . "ADD ext_id VARCHAR(20) NULL;";

I have added some hooks, for example, hookAdditionalCustomerFormFields. My new field appears in the backend and this is OK. But it does not appear in the api request http://localhost/prestashop/api/products/?schema=blank

until I add a class override

class Product extends ProductCore

..

Overrides seem to be not supported in 1.7, though I can see my new fields on my PC via api calls, but not on the live installation with exactly the same version (this could be a problem with user rights on the server though).

My question is: is overriding classes the proper way of adding custom fields and make them appear in the api calls? Or should I do something in my module instead (add some extra hook?) to appear custom fields in the api calls?

 

 

×
×
  • Create New...