简体   繁体   中英

How to add custom field into product in opencart 2.0

My question may be duplicate but read carefully before voting down, as my problem is different.

I am developing a public module for opencart in which i want to add some attributes for all products. Attribute will be same for all type of products for all categories. Attribute may be select box, check box, text.

For example

1) Length - text box

2) Category - select box

As i want these in my module so don't want to modify core files, so is there any option available or how i can override product edit form to add more custom fields.

If i understand your question correct, you want "Attributes" for all products for all categories and don't want to override core files.

Then you can do it using 2 ways without overriding core files

1st - add attributes and groups form Opencart default then using that module, connect those attributes to products.
Every thing is game of entry in database table like when admin edit any product and want to add product attribute then what will he do, he will go to attribute tab and then select attributes and then save product means save attribute entry to database for that product that it, so you need to add those entries using your module for products.

2nd way - I will add attribute groups and attribute create entry in my module (if you want every thing in your module) and other part will be same like 1st way.

So next time when you edit any product then you will see these attributes selected in your product already.

Note
- admin can add attributes value form module or have to edit product for that, you have to manage that.
- how you manage duplicate entries for same attributes for product, you have to check that in your code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM