Jump to content

Add new field in backoffice product combination tab


SRUTHI R BABU

Recommended Posts

I am working on a  Prestashop 1.7  and need to add a new field to combinations tab in back-office product details page . I was successful in adding the field to twig file and saving the data to product table ( via product class override ). Now I need to show the saved value in the said field in combination twig file. The field added is a dropdown. I am not sure what to do exactly although it seems like I need to do a controller override. Any ideas ?1425236117_Screenshot(9).thumb.png.8e51db3f2a59e5490d4b8a6a9d492ac0.png

Link to comment
Share on other sites

Hello,


Since this is a Symfony controller: https://devdocs.prestashop-project.org/1.7/modules/concepts/overrides/#service-overrides

However, I would advise against this approach of modifying the product page directly and encourage you to develop a custom module instead that uses the displayAdminProductsExtra hook or something similar. And instead of changing the product class and table, you could create an associative table using the product id to link to the new fields you want to add, for example, a ps_product_combinations_extra table with the columns id_product, special_quantities, another_new_field, etc., then you can query the new fields by using the product ID or even make JOIN queries.

If you are a developer working for the customer, I understand that the customer might say something like "But I want it on the combinations page", in that case, you can kindly explain to him/her that using this approach ensures that you can safely update to future versions of PrestaShop (PS 8.0 is right around the corner).

There is already an experimental version of the admin product page available for testing.

So all your changes made directly to the product page might need to be redone once the new version of the admin product page is released as well.

I hope you take my advice into consideration and wish you the best of luck!

 

Edited by artixweb
clickable link (see edit history)
  • Like 1
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...