D
D
denism3002018-10-30 15:38:06
Joomla
denism300, 2018-10-30 15:38:06

How to make custom field in joomla component?

I am writing an extension for VirtueMart 3, there was a need to exclude some categories from processing.
To select these some categories, I want to add a field in the component settings in which you can select them.
at the moment there is an idea to create a category type field, but there is a problem how to transfer categories from the VM there - I can’t figure it out.
or the SQL field type, but there is a problem of selecting category names from the table.
The VM stores the category names in the table #__virtuemart_categories_ (here is the slug of the current language), for example, for Russian - #__virtuemart_categories_ru_ru,
as if for a specific language, you can stupidly make a field like this:

<field 
    name="exCAT" 
    type="sql"
    class="inputbox"
    key_field="virtuemart_category_id"
    value_field="category_name"
    query="SELECT virtuemart_category_id, category_name FROM #__virtuemart_categories_ru_ru"
    label="Выберите категории, которые нужно исключить" 
    description="" 
    multiple="true"
/>

but, then, if the user has a different language of the site, it will not work. question - how to choose from a table in this type of field that corresponds to the current language of the site?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Rekun, 2018-12-24
@denism300

The easiest way is to write your own field type. You can do whatever you want in it. Here is the manual https://docs.joomla.org/Creating_a_custom_form_fie...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question