- Posts: 98
- Thank you received: 2
Filters customization (assign new classess and JS)
So imagine I got a price filter. And i'm using Bootstrap 3. And I want to wrap it onto the popover like here:
getbootstrap.com/javascript/#popovers-examples (CTRL+F "popover on bottom")
Using JS or CSS. I'm kinda fluent in it, but I got no idea where to assign those needed classes for the filters?
In the source code I got something like this:
What I want to know, what should I edit to insert the bootstrap's stuff into the code:
or using <scrypt> for the JS
Could you please clarify it since I'm very weak in the php stuff and there's nothing similar to in in the documentation.
Please Log in or Create an account to join the conversation.
Indeed it's a bit tricky since the code generating filters is in the class. You can find this class in administrator/components/com_hikashop/classes it's named filter. There you should be able to retrieve the spans and div of the filters and add whatever you want.
You can also take a look at the view filter in Display>Views and add some stuff here.
For the JS, something like that should work:
You have to place it in the view.
Please Log in or Create an account to join the conversation.
Eliot wrote: Hi there,
Indeed it's a bit tricky since the code generating filters is in the class. You can find this class in administrator/components/com_hikashop/classes it's named filter. There you should be able to retrieve the spans and div of the filters and add whatever you want.
You can also take a look at the view filter in Display>Views and add some stuff here.
For the JS, something like that should work:Code:<?php $js="your JS"; $doc = JFactory::getDocument(); $doc->addScriptDeclaration( $js); ?>
You have to place it in the view.
Well. Let me come with an easier example. I wan't to place an icon of cart into your Hikashop Cart Module.
I go to Hikashop > Views > showcart view (of the required template, of course)
And I see that on the front-end the place, name of the class, where I want to assign the icon to named:
Could you please write a guide or manual for how to do the stuff like that for its very hard to customize the site through CSS only without editing the HTML structure
Please Log in or Create an account to join the conversation.
As the values may differ according to your configuration, it cannot simply be in a view or modified with CSS.
So the solutions I gave you are actually the only ones for your case.
I hope I didn't misunderstood what you want to do but if you still want to do the thing you posted first, looking at the class is the solution. As I said, filters are a particular case.
Please Log in or Create an account to join the conversation.
Eliot wrote: Filters are a bit particular since they are generated by the class.
As the values may differ according to your configuration, it cannot simply be in a view or modified with CSS.
So the solutions I gave you are actually the only ones for your case.
I hope I didn't misunderstood what you want to do but if you still want to do the thing you posted first, looking at the class is the solution. As I said, filters are a particular case.
Well, I was trying very hard to find something in the
But I really need to get this done so I'll provide the real example.
I want a filter to collapse on toggle.
Here is the working fiddle for this.
jsfiddle.net/Q4PUw/2/
I tried to look at the "views" of the filter in the Back-End and in the administrator folder "filter.php" via FTP, and as far as I could see, because of this code
In the HTML markup here's something similar to what I want to see to get this jsFiddle working:
I refuse to believe there's no way to make this kind of particular customization. There must be a way, easy or not, maybe depending on some patches from you, or writing some documentation.
Please, I really need to do something like this. Help me a bit.
What file should I be editing, how exactly, etc.
Thank you in advance.
Or, here's another workaround.
For example I have 6 filters
Filters from 1 to 3 are default, filters from 4-6 are optional.
I want filters 4-6 to be shown only when a user wants it.
So I do like that:
And onClick the user gets displayed filters from 4 to 6.
God, if it has been the Bootstrap with the Smarty php engine, I would have done it myself.
But it's Joomla & Hikashop and I got no freaking idea how to customize and who else is supposed to help me since this software is yours
Please Log in or Create an account to join the conversation.
In order to do that, there is no need to modify the filter class file.
Just edit the file "filter" of the view "product" via the menu Display>Views and change the code which echo the html of the filters in order to add your additional HTML div around the filters you want and then you can also add your toggle JS code in that file.
Here is the line which displays the filter div in that file:
Please Log in or Create an account to join the conversation.
nicolas wrote: Hi,
In order to do that, there is no need to modify the filter class file.
Just edit the file "filter" of the view "product" via the menu Display>Views and change the code which echo the html of the filters in order to add your additional HTML div around the filters you want and then you can also add your toggle JS code in that file.
Here is the line which displays the filter div in that file:Code:echo '<div class="hikashop_filter_'.$filters[$count]->filter_namekey.'">'.$html[$count].'</div>';
Im afraid u didnt understand me right.
As far as I understand, if I add new class to that lane you provided, the class will be applied to all filters I have, from 1 to 13, but I only need this class to be applied on filters 7,8,9.
How to reach that?
Please Log in or Create an account to join the conversation.
As I told you it's gonna be tricky but here is how you should process.
Open the filter.php class and find the displayFilter function.
This function call a specific functions for each display (each type of filters).
What you can do is add some code here to display your additional div (admitting that you won't add any filter or change the order).
so here the code and what you could do:
it's a suggestion but it could definitely work
Please Log in or Create an account to join the conversation.
Eliot wrote: Hi there,
As I told you it's gonna be tricky but here is how you should process.
Open the filter.php class and find the displayFilter function.
This function call a specific functions for each display (each type of filters).
What you can do is add some code here to display your additional div (admitting that you won't add any filter or change the order).
so here the code and what you could do:
Code:function displayFilter($filter, $divName, &$parent, $datas=''){ $html =''; if($filter->filter_type=='text' || $filter->filter_type=='singledropdown' || $filter->filter_type=='multipledropdown' || $filter->filter_type=='radio' || $filter->filter_type=='list' || $filter->filter_type=='checkbox' || $filter->filter_type=='cursor' || $filter->filter_type=='instockcheckbox'){ $classType = 'hikashop'.ucfirst($filter->filter_type).'Class'; $class = new $classType(); $html = $class->display($filter, $divName, $parent, $datas); if($filter->filter_name=='thefirstfilteryouwannahide') $html = '<div class="yourdiv">'.$html; if($filter->filter_name=='thelasttfilteryouwannahide') $html .= '</div>'; }else{ JPluginHelper::importPlugin( 'hikashop' ); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger( 'onFilterDisplay', array( & $filter ,&$html, &$divName, &$parent, &$datas) ); } return $html; }
it's a suggestion but it could definitely work
I am sorry but nothing seems to work here. No additional "<div>" is applied.
Here's the code:
Maybe I shall provide you a link? Maybe I'm missing smth?
dstest.atservers.net/katalog
I want to reveal-on-toggle filters from 5 to 7
As far as I can see I added the names right but it still doesnt work.
Please Log in or Create an account to join the conversation.
You put hikashop_filter_filter_6, but your filter is not called hikashop_filter_filter_6, it is called Производитель as far as I can see.
Please Log in or Create an account to join the conversation.