Support » Plugin: Smart Grid-Layout Design for Contact Form 7 » Posts filter dynamically by term selection in taxonomy field

  • Resolved liranrak

    (@liranrak)


    Hi,

    I Love your plugin!!!

    I’ll be happy if you’ll kindly help me filter the posts source dynamically by term selection in taxonomy field.
    I’ve created 2 fields: taxonomy terms and posts, so I wish to display the user only the posts from the term he selected.

    Could you please help me achieve this functionality?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    I Love your plugin!!!

    thank you. kindly leave a review when you have a moment to spare.

    Could you please help me achieve this functionality?

    I’ll be happy to give you a general idea. I don’t do code specific support, if you don’t know how to code you’ll need to either learn or hire someone 🙂

    I’ve created 2 fields: taxonomy terms and posts, so I wish to display the user only the posts from the term he selected.

    for the post field I recommend you use dynamic checkbox tag rather than the dropdown. In the dynamic checkbox you can convert the field into a HybridDropdown (see this tutorial). The plugin will add term classes to each post entry for which the post is associated with.

    The HybridDropdown is a JavaScript plugin that allows you to dynamically filter the options visible. So when your dynamic term field changes, you will need to filter the post hybrid dropdown according to the class for that term.

    Thread Starter liranrak

    (@liranrak)

    Hi Vrata,

    Thank you so much for your replay!
    I will certainly submit a review!

    I know how to code, but I couldn’t understand how to connect the posts filter to the taxonomy field.

    I did used the dynamic checkbox tag for the terms (as treeview), and also for the posts (as imagegrid).
    Unfortunately, my posts does have a class with all theirs taxonomies terms BUT ONE taxonomy – which is the one I need…. ):

    Please help

    • This reply was modified 7 months, 3 weeks ago by liranrak.
    Thread Starter liranrak

    (@liranrak)

    Hi Vrata,

    I’ve been trying but can’t filter the list options….
    This is the code I’ve wrote, but I get an error that list_options.refresh isn’t a function….
    https://ibb.co/Jqpn0PK

    The field is already a HybridDropdown so I don’t need to create one, just refresh an existing field with posts by their classes.

    I’m sure it just something in the refresh function that is missing:
    ` list_options.refresh(
    {
    ‘listOption’:function(o,i){ //filter the options based on the new value selected.
    if(o.classList == $term) return true;
    return false;
    }
    });

    Hoping and waiting for clarification from you…
    sincerely,
    Liran

    Plugin Author Aurovrata Venet

    (@aurovrata)

    The field is already a HybridDropdown so I don’t need to create one, just refresh an existing field with posts by their classes.

    if you look at the example, you have to call the refresh method on the HybridDdropdown instance, which are not doing in your code.

    Just because your form field is a HybridDropdown doesn;t mean you can use it in your script without accessing the actual HDD object.

    However, the the hybrid object is available on a DOM element that has been converted.

    Thread Starter liranrak

    (@liranrak)

    Hi Vrata,

    I see, so I tried to do as you say: https://ibb.co/rGBcP1L but now I have another error: “o.classList is undefined” https://ibb.co/THvVTZB

    I’ve also tried to modify the excising HybridDropdown with the super easy snippet code in the panel (custom options) with no success…. https://ibb.co/Pw6mtvR

    What am I missing?
    I was so excited when I discovered your plugin, but I’ve spent a lot of time trying (and struggling) to make it work as I you say it can…..

    Really wishing to understand what I’m doing wrong 🙁

    Liran

    Plugin Author Aurovrata Venet

    (@aurovrata)

    What am I missing?

    difficult to say. If you website online for me to take a look?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    this example on the Hybrid documentation page uses the refresh method in a similar way to what you are trying to achieve.

    Maybe you can inspect it and see where you went wrong.

    I was so excited when I discovered your plugin, but I’ve spent a lot of time trying (and struggling) to make it work as I you say it can…..

    I hope we can work this one out. It’s quite possible there is a mistake in the plugin code that prevents you from getting it to work. I don’t have time to test all possible configurations of the code and as a result I rely on users like you to probe issue and help me iron them out.

    So I would be grateful if you do find a mistake in plugin.

    Thread Starter liranrak

    (@liranrak)

    difficult to say. If you website online for me to take a look?

    Yes please! I have a website for development only where I’m testing and trying to work with new plugins I don’t know…..
    https://dev.myfastweb2.net/t/

    https://ibb.co/bs2Q9T1 – here you can see that the event trigger work’s fine and and I got the value, the issue is with the Hybrid function specifically.
    https://ibb.co/m4DwtZj – here you can see (with the html) the only item that should be visible after filter.

    I directed you to the point issue and be happy to work with you and give you access, but surely I can’t myself go thorough all your plugin’s functions, structures and hooks to find where is the mistake and to fix it…

    I would appreciate if you could support me with this issue attentively.
    Best Regards,
    Liran

    • This reply was modified 7 months, 2 weeks ago by liranrak.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    thanks for putting it online, I realise where the documentation is erroneous! The plugin constructs the hybrid field using the dataSet option, and the options are custom constructs to include all the option element attributes included by the plugin.

    Hence the documentation that states to build a custom list with the following listOption settings

    
    'listOption':function(o,i){ //filter the options based on the new value selected.
        if(o.classList.contains($term)) return true;
        return false;
     }
    

    only works for hybrid fields built using <select/> fields.

    In this case you want to use,

    
    'listOption':function(o,i){ //filter the options based on the new value selected.
        if(o[1].label[3].indexOf($term) >=0)) return true;
        return false;
     }
    

    as the option o is actually an array and not an element.

    see if that works for you.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    but surely I can’t myself go thorough all your plugin’s functions, structures and hooks to find where is the mistake and to fix it…

    no, I don’t, but a little debugging doesn’t cost you much time either.

    You can either participate in the open-source effort that I and others plugin developers expand on the repository and improve the quality for all of us, or you can purchase licensed form plugins (plenty of them out there) and essentially pay others to do that 🙂

    Thread Starter liranrak

    (@liranrak)

    Thank you SO VERY MUCH, Vrata!

    Lots of appreciation for your replay and assistant in understanding and working with your plugin and it’s documentation. 🌺🌺🌺

    Best Regards,
    Liran

    • This reply was modified 7 months ago by liranrak.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    Hi Liran,

    glad you got it to work properly. Thank you for your patience in getting to the bottom of the teething issues.

    There is planned video tutorial on the advance usage of the hybrid field which hopefully will make things a lot clearer for other users too in the future.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Posts filter dynamically by term selection in taxonomy field’ is closed to new replies.