Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Different search instances for different users
This topic contains 3 replies, has 2 voices, and was last updated by jens021 4 years, 2 months ago.
- AuthorPosts
- March 19, 2019 at 4:16 pm #21711
Hi
I have created two different search instances. I want one of them (B) to be used only if the page body contains the class “wholesale_customer”, that is a wholesale customer is logged in, otherwise the other instance (A) should be used. I have now put the search instance (A) in the page with a short code.
Greetings Stefan Elmgren
March 20, 2019 at 10:18 am #21717The only difference between the two search instances is that one instance (A) excludes one product category (product_cat)
//Stefan-
This reply was modified 4 years, 2 months ago by
jens021.
March 20, 2019 at 2:19 pm #21723Hi Stefan,
Actually, this might be doable simply, because of that body class. So I’m assuming that search instance ID=1 is the one for the non-wholesale, and ID=2 is for the wholesale customers. To solve this, place both search shortcodes into the same place, where you need them.
Then, use this custom CSS code:
.asp_m_2 { display: none !imporant; } .wholesale_customer .asp_m_1 { display: none !important; } .asp_m_2 { display: block !imporant; }
If you have different search bars with different IDs, then just change the numbers in the code.
This is also doable with a single search bar & a different custo mcode, if it is somehow possible to check programatically if the current customer is a wholesale customer, but I think this should work as well.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 25, 2019 at 4:10 pm #21776Thanks for your answer.
I solved it through JavaScript in a similar way.
——-
if (jQuery(‘body’).hasClass(‘wholesale_customer’) ){
jQuery(‘.asp_m_1’).css(‘display’, ‘none’);
jQuery(‘.asp_m_2’).css(‘display’, ‘block’);
}
——–
Greetings Stefan Elmgren -
This reply was modified 4 years, 2 months ago by
- AuthorPosts
You must be logged in to reply to this topic.