106 Posts
krkr
11 years ago
7
Topic

Hi

How to make?
Checkbox in backend, three different values A B C. When  checked is A then in frontend shows pictureA, when B then pictureB, when C then pictureC. Also on each picture should be link to search list of the exact type, already filtered.

But let's start with picture. I remember that in first SEBLOD 3 videos there was this feature mentioned, but unfortunately it didn't appear.

Thank you

Get a VIP membership
106 Posts
krkr
11 years ago
5
Level 1

Hi

Are there any news? Anything? Still reading all around in old forum, have no solution or clean example. Would be nice ...

Regards


11 years ago
4
Level 2

Hello,

For doing that you must use:

  • A plugin Link to link on your Search Type
  • A plugin Typo to display the image instead of the value
So first you have to create the checkbox like that:
  • A=my_image_a.jpg
  • B=my_image_b.jpg
  • C=my_image_b.jpg

then on the content view you will add to this field a plugin typo html (option 3) with code like that:

<img alt="my_alt" src="/mypath/*value*">

For the second point, you must add a plugin Link "List&Search" on the field, with parameters:

  • Search Type (List) : the desired list& Search
  • Menu Item : fixe on which menu item the list will be displayed
  • Field :
    • none : the field is not use in the search
    • Inherit : the value of this field will enter in the search
    • Custom : you can define an other field which is in the content view to enter in the search


If you want more fields to filter the search, you can add them in the "Custom Variables" textarea, like that:

var1=$cck->getValue('field_1');&var2=$cck->getValue('field2');....





Hope it will help.

Regards.
Lionel
106 Posts
krkr
11 years ago
0
Level 3

Hi Lionel.

Thanks for help. It helped, but with ... "tuning" and not completely.

Logo appears and works as it should, everything is nice. But then starts problems with search. 

1. This is not checkbox value in DB as "Type A", but picture path "/images/foo/type_a.png" in database, so search is not for nice named value, but for picture search. Client would laugh at this. But in that case I renamed pictures from "type_a.png" to just "Type A" and it solved problem, looks nice. Also in that case I do not need to make for checkbox syntax "Type A=type_a.png" but just "Type A". In DB it writes as "Type A". Let's call it "solved".

2. Next problem started as I needed this checkbox to be multi values, that just doesn't work out, pictures doesn't appear, I know that there is solution with explode (already checked), but then what to do with links to menu if there are more than one selection, i mean for each type there is different link/search type? 

Solved by making three separate checkboxes for each type. Anyone saw this solution with multiple values checkbox?

So at this moment I have 3 checkboxes in Admin, 3 pictures in front with linked search types for each, pointing to 3 different menu points, as I have menu with 3 preselected searches.

Now comes the hard part. Multilanguage ... and multilanguage search. Any ideas? To restrict search of product by language and to make these searches response to language where it is searched, so there doesn't appear the same products from/with wrong language in search, also what to do with these checkboxes as they point to one menu item, so it means one language too. Make 9 checkboxes? 3 for each language? not funny :(

I have no idea, as I do not fully understand how multilanguages work in SEBLOD. Got labels translated, clear idea with info input. 

Regards


10 years ago
2
Level 3

Hi,

I used this example for my website and it works well.

So i can display value of A,B and C as path to the image using HTML typo <img alt="my_alt" src="/mypath/*value*"> in content view.

But in my case, I have a multiple selection field. So more than one value may be checked.

If there is more than one value, when it's rendered in the front end it doesn't work, because it append all image path on the same image link.

Here is the result (source code of the page) :

... src="/mypath/image_A.png,image_B.png"

Is there any solution to display one image per value ?

Regards

Lionel

9 years ago
1
Level 4

Hello Lionel77,

the way I see for that, is to use the plugin field "Code" with the event "OnBeforeRender".

In the content view, you can add a field "OnBeforeRender" with for code, something like :`

$images = explode( ',', $fields['your_checkbox_field']->value );
$value = '';
foreach ( $images as $image ) {
  $value .= '<li><img src="/your_path/'.$image.'"/></li>';
}
$fields['your_checkbox_field']->value = '<ul>'.$value.'</ul>';

Hope i will help you.

Regards. Lionel

9 years ago
0
Level 5

Hi Lionel,

Many thanks for your answer. Yes it helps. 

It's good to have such example of use for code field and "OnBeforeRender" event. This is easier than to create custom template to deal with PHP after rendering.

Just a last question if possible : I want to make those keywords linked to a search. When i clic on a keyword, I want to display all articles related to that keyword.  How can I add a link to to a SEBLOD search.

As I'm in a "OnbeforeRendere", should I format the custom URL by mysely, or pass a parameter to an existing search list ?

Regards,

Lionel

10 years ago
0
Level 1
actually, lloking also for the opportunity to have a picture as option for an checkbox option (and optionally - option text + image)
Also I need this feature in Form view - brcause sometimes for user is easier to choose well recognizable image instead of readin "heavy text"

Basically, we can add some CSS with :before or :after for each option...but if I have ~20..100 options??? I would like to have also DYNAMIC CASCADE CHECKBOX (multiselectable) FIELD - can I buy this filed plugin in Seblod store?
Get a Book for SEBLOD