Image filter in list view

vaughan

Member
Hello

Is there any way that the image filter shows the image or a Name and not the image url?
For example, I have a catalog of tires, brand (Michelin, Bridgestone ...) are images, but when I do I get a filter show in dropdown /images/marcas/bridgestone.jpg can I do to display the image or a Name and not the url?

Thanks!
 

Attachments

  • catalogo.jpg
    catalogo.jpg
    112.1 KB · Views: 283
  • Gestion-Pedidos.jpg
    Gestion-Pedidos.jpg
    57.8 KB · Views: 237
Possibly the best way is via a custom template.

Make a copy of your list template and then edit the default_filter.php file.


Rougly around line 33 replace:-

Code:
$c = 0;
    foreach ($this->filters as $filter) {
            $required = $filter->required == 1 ? ' notempty' : '';?>

With

Code:
$c = 0;
foreach ($this->filters as $key => $filter) {
    if ($key == '[B][COLOR=RoyalBlue]listname___elementname[/COLOR][/B]') {
            $filter->element = str_replace('[COLOR=Red][B]/images/marcus/[/B][/COLOR]', '', $filter->element);
                                    }
    $required = $filter->required == 1 ? ' notempty' : '';?>



Replace listname___elementname with you full listname and element name making sure the three underscores are in between.


/images/marcus/ This bit should be correct as per your screen shot.



 
Thanks for your help, but it doesn't work, it still looks the same as before

I replace the original code with your code:
Code:
$c = 0;
foreach ($this->filters as $key => $filter) {
    if ($key == 'catalogo___Marca') {
            $filter->element = str_replace('/images/marcas/', '', $filter->element);
                                    }
    $required = $filter->required == 1 ? ' notempty' : '';?>
 
I'm using default template in /components/com_fabrik/views/list/tmpl/default/default.php
And I replace the code in /components/com_fabrik/views/list/tmpl/default/default_filter.php
In list/layout/frontend template=default
 

Attachments

  • list.jpeg
    list.jpeg
    25.1 KB · Views: 241
Well ideally you should copy the template as any changes will get overwritten by an update. This however is not the issue right now.

We have one to many slashes change /images/marcus/ to images/marcus/ by removing the first slash.
 
Strange, it worked on my test setup.

Have you tried clearing the cache? If that doesn't work I don't know what else to advise as it's pretty hard to debug over a forum. :)
 
How I can do to make the filter displays data from another element? I thought of adding a new element with the name I want to display, and in the filter instead of appearing catalogo___Marca data, appear catalogo___Marca_detalle element. Is it possible?

I tried with this code but does not work either
Code:
$c = 0;
foreach ($this->filters as $key => $filter) {
    if ($key == 'catalogo___Marca') {
            $filter->element = str_replace('catalogo___Marca_detalle', '', $filter->element);
                                    }
    $required = $filter->required == 1 ? ' notempty' : '';?>
 
Probably not the best way forward, personally I would try and diagnose why my code doesn't work. I actively tested this so it should work.


Try

Code:
$c = 0;
foreach ($this->filters as $key => $filter) {
    echo 'Hello I am Marca'; exit;
    if ($key == 'catalogo___Marca') {

            $filter->element = str_replace('/images/marcas/', '', $filter->element);
                                    }
    $required = $filter->required == 1 ? ' notempty' : '';?>


This is the first stage to see if it is finding that column. The list should abort displaying the message. If that works correct then we can investigate the str_replace.

Is this a fileupload element?
 
thanks a lot for your help Felix.
It's a image element. ?work better with a fileupload element?
With this code will show Bridgestone.JPG, no? i need only show Bridgestone (for example) without extension.
 

Attachments

  • marca.jpeg
    marca.jpeg
    25.8 KB · Views: 207
thanks a lot for your help Felix.
It's a image element. ?work better with a fileupload element?
With this code will show Bridgestone.JPG, no? i need only show Bridgestone (for example) without extension.
i need only show Bridgestone (for example) without extension or image in the filter
 
Hi again
Maybe changing '/images/marcas/' with a <img src="some code"> into str_replace??
Or maybe too
Code:
foreach ($this->filters as $key => $filter) {
    if ($key == 'catalogo___Marca') {
            $filter->element = str_replace ('images/marcas/bridgestone.jpg', 'BRIDGESTONE', $filter->element);
                                    }
    $required = $filter->required == 1 ? ' notempty' : '';?>
I see too the html code an says:
<option value="images/marcas/continental.jpg">
Text - images/marcas/continental.jpg
Maybe cahnging the alt code in image plugin element??
 
For more explain, i attached this image with photoshop with i need
I Included this image in the first post
 

Attachments

  • Gestion-Pedidos.jpg
    Gestion-Pedidos.jpg
    57.8 KB · Views: 217
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top