+ Reply to Thread
Results 1 to 5 of 5

Thread: How to add an extra field to a category more correctly?

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Location
    Nizhny Novgorod, Russia
    Posts
    28

    How to add an extra field to a category more correctly?

    I need an additional field to the category so that I can implement the function:

    Related categories (@)...
    https://forum.flynax.com/showthread....categories-(-)

    I can do this without any problems by adding it directly to the base and changing the system files and template files.


    However, how correct is this approach?

    Maybe I should write a plugin that does this? I will not have to change the system kernel and there will be no problems with subsequent updates.

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    2,180
    Hello,

    Do you mean an additional field on the category add/edit form?

    so you need to modify two files:

    categories.inc.php from admin > controllers

    and categories.tpl - admin > tpl > controllers

  3. #3
    Junior Member
    Join Date
    Sep 2020
    Location
    Nizhny Novgorod, Russia
    Posts
    28
    > Do you mean an additional field on the category add/edit form?

    Yes

    Perhaps it is better to do this with plugins (rlHook) using hooks so as not to change the system kernel? After all, if there is a plugin, subsequent updates will be easier to do. In order not to lose your work with the update.

  4. #4
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    2,180
    You can add your hook via mysql request without using classes

    for category add/edit form you need to use a hook name apTplCategoriesForm like:

    PHP Code:
    Only registered members can view the code
    Where --PHP CODE-- - your php code

    or you can directly attach your custom tpl file from templates > your_template with smarty code inside using:

    PHP Code:
    Only registered members can view the code
    Last edited by Rudi; October 5, 2020 at 11:13 AM.

  5. #5
    Junior Member
    Join Date
    Sep 2020
    Location
    Nizhny Novgorod, Russia
    Posts
    28
    All is decided. Thank you very much.

+ Reply to Thread