简体   繁体   中英

Add new entities in OpenCart

I was wondering if I can add new entities (classes/tables) in OpenCart to store information that is not included in the default functionality. To be more precise, I would like to add subscription (3/6/12 months) related information, as described here: OpenCart subscription model (x months)

If yes, can I just add admin pages for the new class? Would something like: How to create a custom admin page in opencart? work?

You would need to create a

  1. Template file (.tpl)
  2. Controller file (.php)
  3. Model file (.php)
  4. Language file (.php)

All files are named the same with different extensions and located in their respective folders

You will also need to add more columns in the database named with the additional settings you ant to store.

In addition to your page specific setup you will also need to add a link to your page in the header file, in the menu.

You will use the model file to insert, update and delete data within the database. The controller controls what functions within the model are used.

Once created, In admin/ user group permissions you need to give access o the new pages

Take a look at the existing files to see how it works. Make a copy of one of the more simpler 4 files, rename, then start to modify them.

If you only want to add more settings to a existing page then you can add them to the existing 4 files and add columns in the database.

Hope that helps get you started, Good luck!

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