Jump to content

Recommended Posts

So, extending Product with custom field is easy. You override Product.php, extenidng ProductCore etc.

But what bothers me is that, in order to add custom field on Product, I also have to modify MySQL table for Product.

Is that the right procedure?

If yes, then won't there be an Prestashop update issue, where for example, you update core, but it's own product table is changed?

According to documentation, we should not alter PS tables:

https://devdocs.prestashop.com/1.7/modules/creation/good-practices/

https://www.prestashop.com/forums/topic/902131-create-your-own-tables-or-using-existing-ones/?tab=comments#comment-2969838

Is there a way to extend Product but without modifying it's table?

  • Like 1
Link to comment
Share on other sites

Yeah, there will be issues, and no, there is no other way. Unless you add a separate table, which you can also do, but you lose the benefits of a class property. Alternatively you can implement some code that loads and saves automatically from your extra tables, but it's a lot of work

  • Thanks 2
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...