Jump to content

proper way of adding custom fields to PS 1.7

Anonymous No.2

Recommended Posts

I have PS 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?



Edited by Anonymous No.2
made clearer (see edit history)

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More