Jump to content

How to develop module that adds an additional field on product

Recommended Posts

Hi Folks,

Last hours I searched internet for tutorials or documentations on how to develop modules for PrestaShop.
I am running a PrestaShop and I try to understand how everything works.
I understand how to change existing pages,... But I try to do changements with a own module.

My idea to learn how it works is, to just add an simple field on back admin for products to set an value of 0-100 on a newly added database field.
I managed to set up the module and to modify the database

Db::getInstance()->Execute('ALTER TABLE `'._DB_PREFIX_.'product`  ADD `v_expiry` SMALLINT(3) NOT NULL AFTER `upc`');

But I wasn't able to understand how to add a new input field to the product administration page (options, where EAN,... are set)
I think it is on hook: hookDisplayAdminProductsExtra, right?

But how to add that field now? And how can I trigger that value in that field gets saved in database?


Does anyone have a link to a fitting Tutorial?
Or can explain it to me?

I'm sure that there will be an answer in world wide web - but I think I was to stupid to find it - sorry...




Share this post

Link to post
Share on other sites

Well, problem solved.

Meanwhile I've found this tutorial:

The script isn't realy working, but it helped me understanding how it works.

In addition with this list:
Needed hooks can be found...

At moment just strugling with showing content on displayProductExtraContent  (nothing appears).
But I will solve that 😉

EDIT: Well, also this problem solved. Just reseting Module dosn't update hooks on front end. Needed to deinstall and newly install it...

Edited by Chrigu
solved (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