klox7 VIP
Total posts: 914
13 Jan 2015 10:01

Hi,

I would like to create custom filter module template which uses field template that I manually select - hardcode in template (and not the ones form field parameters).

If this is the code to display filters <?php echo $filters[$keys_by_id[18]]->onRenderFilter($section, TRUE); ?> how can I show this field with select template?

Regards

Last Modified: 06 Feb 2015

Tags Filters


Sergey
Total posts: 13,748
13 Jan 2015 11:48
$filters[$keys_by_id[18]]->params->set('params.template_filter_module', 'mytemplate.php');
$filters[$keys_by_id[18]]->onRenderFilter($section, TRUE);

But generaly in filter parameters you have different template for module and cobalt section. SO you can use 2 different templates.


klox7 VIP
Total posts: 914
13 Jan 2015 11:53

Sergey But generaly in filter parameters you have different template for module and cobalt section. SO you can use 2 different templates.

Already used. Thank you.


klox7 VIP
Total posts: 914
13 Jan 2015 12:51

One issue though. If you do this (ex. select.php template)

$filters[$keys_by_id[18]]->params->set('params.template_filter_module', 'select.php');
echo $filters[$keys_by_id[18]]->onRenderFilter($section, TRUE);  

then this template is assigned to all filter modules on same page.


Sergey
Total posts: 13,748
13 Jan 2015 15:24
$filter = $filters[$keys_by_id[18]];
$old_template = $filter->params->get('params.template_filter_module')
$filter->params->set('params.template_filter_module', 'select.php');
echo $filter->onRenderFilter($section, TRUE);  
$filter->params->set('params.template_filter_module', $old_template);

klox7 VIP
Total posts: 914
13 Jan 2015 16:35

Can I pass prefiltered link as option value for this?


Sergey
Total posts: 13,748
15 Jan 2015 09:47

You want result to be affected? Cannot get idea. Where to path prefiltered link and for what?


klox7 VIP
Total posts: 914
15 Jan 2015 09:56

At the moment I'm using html joomla module to custom create prefiltered links for cobalt. But this is not ideal because it does not add/remove values dynamically.

For the new thing I want to use filter module without search button but instead I want to use select oncahnge and pass field values as <option value="prefiltered link">. This way when user selects value from select it gives results from selected value.


Sergey
Total posts: 13,748
15 Jan 2015 10:11

klox7 For the new thing I want to use filter module without search button but instead I want to use select oncahnge and pass field values as

Then in custom filter module template add javascript that on change would submit the form.


klox7 VIP
Total posts: 914
15 Jan 2015 20:19

If I'm looking at option value of prefiltered link that I custom created it's like

<option value="index.php?option=com_cobalt&amp;task=records.filter&amp;clean=1&amp;section_id=1&amp;Itemid=134&amp;filter_name[0]=filter_kcefbce7024531e43eecec0b58c7a75ab&amp;filter_val[0]=CFV_APPROPRIATE_FAMILIES_TS">

but if I use echo $filters[$keys_by_id[18]]->onRenderFilter($section, TRUE); then the option value is

<option value="CFV_APPROPRIATE_FAMILIES_TS">

and if I submit this value nothing is filtered.


Sergey
Total posts: 13,748
16 Jan 2015 02:03

But if you click URL is it filtered?


klox7 VIP
Total posts: 914
16 Jan 2015 07:22

You mean this? If so yes, this is filtered.

index.php?option=com_cobalt&amp;task=records.filter&amp;clean=1&amp;section_id=1&amp;Itemid=134&amp;filter_name[0]=filter_kcefbce7024531e43eecec0b58c7a75ab&amp;filter_val[0]=CFV_APPROPRIATE_FAMILIES_TS

Sergey
Total posts: 13,748
19 Jan 2015 02:13

Anf who do you apply <option> value? Location through Javasript?


Sergey
Total posts: 13,748
20 Jan 2015 09:42

Are you ib subfolder? Try to put your link through JRoute

<option value="<?php echo JRoute::_('index.php?option.....') ?>">Text</value>

klox7 VIP
Total posts: 914
20 Jan 2015 11:27

Sergey Are you ib subfolder?

What subfolder? I'm doing this in filter module template.

Sergey Try to put your link through JRoute

Values are generated from this

$filter = $filters[$keys_by_id[ID]];
$old_template = $filter->params->get('params.template_filter_module')
$filter->params->set('params.template_filter_module', 'select.php');
echo $filter->onRenderFilter($section, TRUE);  
$filter->params->set('params.template_filter_module', $old_template);

I don't understand how to put option value here.


Sergey
Total posts: 13,748
20 Jan 2015 12:15

What is the field? You mean that echo $filter->onRenderFilter($section, TRUE); gives you <option value="index.php?.....?


klox7 VIP
Total posts: 914
20 Jan 2015 13:11

Hidden text

Sergey You mean that echo $filter-&gt;onRenderFilter($section, TRUE); gives you &lt;option value="index.php?.....?

No, echo $filter->onRenderFilter($section, TRUE); gives me <option value="LANGUAGE_CONSTANT"> since my values are as constants.


Sergey
Total posts: 13,748
20 Jan 2015 14:02

Then where is this from?

<option value="index.php?option=com_cobalt&task=records.filter&clean=1&section_id=1&Itemid=134&filter_name[0]=filter_kcefbce7024531e43eecec0b58c7a75ab&filter_val[0]=CFV_APPROPRIATE_FAMILIES_TS">

klox7 VIP
Total posts: 914
20 Jan 2015 19:09

This is if I custom create prefilter link, hardcoded.


Sergey
Total posts: 13,748
21 Jan 2015 08:41

Then why you need to use field template at all? Just hardcode it in filter module template.


klox7 VIP
Total posts: 914
21 Jan 2015 11:26

Sergey Then why you need to use field template at all? Just hardcode it in filter module template.

Beause of this

klox7 But this is not ideal because it does not add/remove values dynamically.

If I hardcode it and there are some empty values then user will get no results.

Powered by Cobalt