1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Additional field in admin / category form issue

Discussion in 'Customizations' started by jason1971, Feb 6, 2016.

  1. jason1971 Customer

    Hi all,

    I have added an additional field in admin/templates/default/categories/category_form.tpl (called {$xnear}), to use as an additional $cpromo field.

    All works well (surprisingly:) ) for adding plain text. However, my issue with it is, if I add a URL in the field EG:
    Code:
    <a href="https:www.google.com">Google</a>
    It shows up the whole URL link (as above) instead of just showing Google.

    I can't understand why I can add URLs in $cPromo which go on to show up correctly on the actual website side.

    This is how I setup {$xnear}
    I copied the {$cPromo} field in all the following locations:-
    category.php
    administration/category.php
    includes/classes/Kernel/Categories.php

    I have also added the field in phpMyAdmin under class_categories with the following settings
    Type= Text Collation=utf8_general_ci Null=Yes Default=NULL

    Have I missed something totally obvious or is it just not possible ?

    Cheers

    Jason
  2. Mike-N-Tosh Owner

    It's hard to say, without seeing the actual code in context.

    I would say, off the top of my head that it is most likely being filtered through the security features that are in place to protect the site against malicious code input.
    The $cPromo field uses the "Filter::safe_html($_POST['cPromo'])" to allow html in the field.
  3. jason1971 Customer

    I somehow thought it would not be that straight forward, but thank you for replying anyway.
  4. Mike-N-Tosh Owner

    In your category.php file where you added the field to the list of existing fields, just use the same filter code as the cPromo field. Just remember to do it in all places (I believe there are two, but possibly more).

Share This Page