Hi,
in my web I want to do this:
www.jumpin.com
consult
from (heme address) until (where it goes date)
I can not see how to do this, Please someone know? Thank you!!!
Hello. Can you help me? I did code absolutely same as in example about filtering, but when I press “preview” I see that dropdown list is not clickable. I can only do the search and as a result of searching I see the right picture in a gallery and right answer in the dropdown but I can’t choose and filter that using the dropdown list. So, what’s my problem? Thanks in advance.
Since it’s not working, you most probably did not “code absolutely same…”. When creating your own project you need to ensure that the code matches the component IDs that you use.
If you continue to have problems, please post the editor URL of your site. Only authorized Wix personnel can get access to your site in the editor.
I don’t know the coding. Can you help to remove “All continent” option?
I try but error…
Thanks for your help.
My English is not good
@Yisrael (Wix)
Hi is it possible to get this code when continent is a category with multiple reference. I know that i ask a lot but maybe it will be usefull for more people. Lots of people use categories as multiple reference. In Your example continent is only value in articel. But what happen when i use reference there. Thank You for help
There is one problem with the example Wix page. In the Wix user input box, when you enter text into into it, it displays an X on the right to allow you to erase the contents of the input box by clicking with the mouse, without using keystrokes. If the user does a search and then clicks the X to delete the keyword, the word erases, but the filtered search results don’t reset themselves because there has been no keystroke to trigger the function. I added some trigger code to the onMouseOut, onClick, and other events, so at least when the user then clicks off of the search box then the results reset themselves. However it’s not a perfect solution as the user would expect the search results to clear themselves right when the search box is cleared.
Hi thanks for the code and tuto. But Im trying to add a new filter, but can’t make it work. This is the code I’m using, I want to filter the results by country or continent
import wixData from “wix-data”;
$w.onReady(() => {
loadContinents()
loadCountries();
});
let lastFilterTitle;
let lastFilterContinent;
let lastFilterCountries;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iTitle’).value, lastFilterContinent,lastFilterCountries);
}, 500);
}
export function iContinent_change(event, $w) {
filter(lastFilterTitle, $w(‘#iContinent’).value);
}
function filter(title, continent, countries) {
if (lastFilterTitle !== title || lastFilterContinent !== continent || lastFilterCountries !== countries) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains(‘articleTitle’, title);
if (continent)
newFilter = newFilter.contains(‘continent’, continent);
if (countries)
newFilter = newFilter.contains(‘countries’, countries);
$w(‘#dataset1’).setFilter(newFilter);
lastFilterTitle = title;
lastFilterContinent = continent;
lastFilterCountries= countries;
}
}
function loadContinents() {
wixData.query(‘Continents’)
.find()
.then(res => {
let options = [{“value”: ‘’, “label”: ‘Toutes les villes’}];
options.push(…res.items.map(continent => {
return {“value”: continent.title, “label”: continent.title};
}));
$w(‘#iContinent’).options = options;
});
} export function iCountries_change_1(event, $w) {
filter(lastFilterTitle, $w(‘#iCountries’).value);
}
function loadCountries() {
wixData.query(‘Countries’)
.find()
.then(res => {
let options = [{“value”: ‘’, “label”: ‘Tous les domaines’}];
options.push(…res.items.map(countries => {
return {“value”: countries.title, “label”: countries.title};
}));
$w(‘#iCountries’).options = options;
});
}
Hi,
Your filter function has three parameters:
function filter(title, continent, countries)
And in both places where you call filter() you are only using two parameters:
filter(lastFilterTitle, $w(’ #iContinent ').value);
filter(lastFilterTitle, $w(’ #iCountries ').value);
The filter function can check which parameter is being used (continent or country) and the create the filter using that parameter. Or, you might just want to create two filters, one for country and one for continent. In any case, you will need to correct your code to properly call the filter function with the correct parameters.
Good luck
@yisrael-wix Oh I see the problem now. I’m not a pro at coding. Thank you so much it’s working now
Hi Yisrael, Can you (or anyone! ) please tell me how to use my existing product database with this code?
In my databases area there exists two databases generated from my making product listings with collections…
The system has put them in subcategories under one it generated called store- there is a store/products and a store/collections. I have almost 200 products and will soon be adding 100+ more, so the thought of creating a third database to work with a repeater is a little daunting. I’ve been trying so hard for over a week to use this tutorial code and also have tried Code Queen’s tutorial and code, to no avail. How do I handle this store/etc within this code? Am I even able to?
Obviously I am not a coder, and the support sent me to this post and video that they know I am already having major trouble understanding. (right brain person here who is a complete code newbie)
To reiterate what I was asking support about, the supplied add on-pay after 100 searches apps are not working right at all for me, hence the need to code one that works for what I need.
I desperately have to get this store up but right now it’s not easy for anyone to navigate once they get past the general categories in the menu. I will shamelessly disclose that today is my birthday, and my birthday wish is a coded wix search bar that works perfectly in my wix store… praying lol.
Thank you in advance!!!
We are unable to provide full code solutions. Wix provides many resources to help users learn how to get the most out of Wix Code. We encourage users to take advantage of these resources which include video tutorials, full app examples (which can be loaded into the user’s editor), API documentation, and a wealth of articles describing a wide range of topics - from beginner to advance.
If you are interested in coding this yourself, I would suggest visiting the following sites for information on programming in Wix Code and Javascript:
https://support.wix.com/en/wix-code/wix-code-basics
https://www.w3schools.com/js/default.asp
https://javascript.info
Also, there are lots of examples:
https://support.wix.com/en/article/wix-code-index-of-examples
https://www.wix.com/code/home/examples
https://www.grampsworkbench.com/examples
You may also want to check out the WixArena - it’s a hub where you can look for Wix Code (and other) experts for hire.
@yisrael-wix Thanks, I think. I do appreciate your getting back to me… but this is really frustrating from a customer standpoint I must say. I don’t need lots of examples for other things, I need an example of a search working with a Wix generated store/products database.
In fact I cannot find a single one example of this. All I can find is this same exact tutorial for a double search bar using a repeater box, or people on youtube doing just a few things and using repeater boxes. It should not be this hard to connect my existing database generated by Wix as I make products to link to a site search. I really do love wix in a lot of ways, but there is a lot to be desired for a larger ecommerce solution or genuine support.
At least that is one lesson I’ve solidly now got coded into my brain.
Again, I genuinely appreciate you getting back to me, but I also have begun to genuinely regret choosing Wix for my business.
@yisrael-wix I have looked and looked, there was an example of having search box and two drop downs. Trying to do this or a search box, dropdown and buttons.
Look to the code I’ve posted in my previous comment. It’s working for the double dropdown and searc box. You just have to correct the export founctions in this code like this:
export function iContinent_change(event, $w) { filter(lastFilterTitle, $w(’ #iContinent ').value, lastFilterCountries); }
export function iCountries_change_1(event, $w) { filter(lastFilterTitle, lastFilterContinent, $w(’ #iCountries ').value); }
@dnassik link to your site?
@kayapalebluedot I will defend Wix on this. I tear things apart A LOT (sometimes in frustration). While like any company, some parts of the click and build need some adjustments, for the most part it is a very good product…with a few fixes, it will be a GREAT product. As to coding…that is not a service that is part of their offering. The ability for a customer to use code to update their site is the service being provided. It is up to us, the customer, to implement the coding.
It can get very frustrating to run into a wall on coding for us newbies to coding. And there are some folks in the forums, like everywhere, that are ones to avoid…and others that will walk you through items detail by detail.
Coding is a world that expands differently for every person and every need. So it can take a full day of digging through here and other places on the net to get one simple line that workS for you.
Every person has to deterimine if it is worth it for them. For me, I see a great future for using the product because of the ability to plug and build and use code in the mix.
I am in search of building this same style of search, as are others, so I am sure that some code help will pop up in that regard.
@jeff-haskins haha I hear you Jeff, I definitely got frustrated on this one but only after trying to patiently to keep at it for a while with the information I could find, and figure things out for myself.
Like I said in my other post there really is a lot of things I love about Wix, part of my frustration is that there is a little bit of deceptive advertising for the package upgrade to ecommerce (free search bar app add on) and while it is true there is a ‘free search bar’, the reality of that search bar (doesn’t even really work until you pay app people “starts at??” 5 a month (my brain sees 60+ a year) and the free part is 30 searches that don’t work. I have paid for a year of ecommerce wix with their bells and whistles, and their platform will be just fine for my other project I can finally get to after I get this one done, where I have about 20 things, and don’t have 300+ products I need organize as I need to do for this particular store.
I don’t mind waiting for solving things, except I just don’t have any more extra time. I need to have money coming in, and if that means having to pay extra right now at a different platform that can get me up and running with all the things without any hassle, searches, etc, I just don’t have the luxury of waiting for a code person while my wix subscription months tick away.
Anyway! I do love the front end design part of Wix better than anywhere else I’ve looked, everywhere has their strong points I guess. IMHO if Wix made their site do with quick ease these capabilities that a larger ecommerce catalog needs - they would blow everyone else out of the water. At any rate, I don’t hold on to frustration or bad feelings for anything! I’ve already moved on for a solution and will be back to Wix soon with happy energy to begin on a project that will work here! Hope all you and all the forum peeps out there are having a wonderful week!
Not getting the code to work. Here is what I have, a couple errors showing and the sorting databases Category and ProfileCategories are not loading to the drop down menus on live site.
Have added onchange for the two dropdowns (I thought Wix had changed to where _change and _onchange were same, but I changed both to _onchange anyway). keypress for the search box
import wixData from “wix-data”;
$w.onReady(() => {
loadCategory();
loadProfileCategories();
});
let lastFilterCombination
let lastFilterCategory
let lastFilterSection;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iTitle’).value, lastFilterCategory, lastFilterSection);
}, 500);
}
export function iCategory_change(event, $w) {
filter(lastFilterCombination, $w(“#iCategory”).value), lastFilterSection;
}
export function iSection_change_(event, $w) {
filter(lastFilterCombination, lastFilterCategory, $w(‘#iSection’).value);
}
function filter(combination, category, section) {
if (lastFilterCombination !== combination || lastFilterCategory !== category || lastFilterSection !== section) {
let newFilter = wixData.filter();
if (combination)
newFilter = newFilter.contains(‘combination’, combination);
if (category)
newFilter = newFilter.contains(‘category’, category);
if (section)
newFilter = newFilter.contains(‘section’, section);
$w(‘#dataset7’).setFilter(newFilter);
lastFilterCombination = combination;
lastFilterCategory = category;
lastFilterSection= section;
}
function loadCategory() {
wixData.query(‘Category’)
.find()
.then(res => {
let options = [{“value”: ‘’, “label”: ‘ALL CATEGORIES’}];
options.push(…res.items.map(category => {
return {“value”: category.title, “label”: category.title};
}));
$w(‘#iCategory’).options = options;
});
}
function loadProfileCategories() {
wixData.query(‘ProfileCategories’)
.find()
.then(res => {
let options = [{“value”: ‘’, “label”: ‘ALL SECTIONS’}];
options.push(…res.items.map(section => {
return {“value”: section.title, “label”: section.title};
}));
$w(‘#iSection’).options = options;
});
}}