I am trying to build a ad website and stuck at implementing the side filters on the sidebar navigation that are displayed based on the selected category.
1 : https://www.pigiame.co.ke/cars
2 : https://www.pigiame.co.ke/mobile-phones
Notice the different filters that appear on the sidebar based on the category selected on the main menu. Need help with showing the different filters.
The simplest form would be something like the following
Assuming you have a product_features tables, your query should look something like this:
SELECT DISTINCT(`feature`) `feature_name` FROM `product_features` `pf`
INNER JOIN `products` `p` ON `p`.`id` = `pf`.`product_id`
WHERE `p`.`category_id` = ?
this should give you all the features for a category, you can then make your menu based on your category_id which you pass to the menu
Related
I have tried to create quick filters using the same methods as Shopware uses for their filter panel, but I've run into some problems. I want to have the 'colors' property filter both in the sidebar and in a slider above the product listing block. This is the design I've got in mind for the slider:
I am able to get this working by adding another filter panel and filtering unused properties out, but everything breaks when trying to select one of the colors. You can try this out yourself by adding two filter blocks to a category page. I don't think having multiple filter panels is supported the way filters are setup at the moment. I have tried adding support for this but there is a lot of code to edit to make that work.
Check these files together with it's parent classes to see how most of the filtering proces works:
vendor/shopware/storefront/Resources/app/storefront/src/plugin/listing/filter-property-select.plugin.js
vendor/shopware/storefront/Resources/app/storefront/src/plugin/listing/listing.plugin.js
Can this be achieved in another way?
I have implemented the similar but not color, I added new filter on top of listing that link to existing in sidebar filter https://bike-resale.de/E-Bikes
I created js plugin to listen on input changed, then find the sidebar filter by ID and dispatch change event on it that will trigger filter on listing. You can try this way.
...
_updateFilterValue(value) {
this._filterInput.value = value;
this._filterInput.dispatchEvent(new Event('change'));
}
...
I'm trying to incorporate something like this: https://infra.clarin.eu/content/libs/DataTables-1.10.6/examples/api/show_hide.html into my R Shiny application.
I'm unfamiliar with how to incorporate the JS into R, but showing/hiding columns doesn't necessarily need to function like this. It could be a drop down (selectInput) with the column headers where the user could select multiple choices in order to hide those specific columns. Or even check boxes to hide/show them.
Just looking for a way for the user to have control over what columns are hidden in a DT.
My options would look like this: options=list(columnDefs = list(list(visible=FALSE, targets=columns2hide))), just need a way to fill columns2hide.
See: Hide certain columns in a responsive data table using DT package
I would like to develop a similar navigation to this website: http://www.enjukuracing.com/categories/nissan
They are on the BigCommerce platform and I like how their side navigation displays the categories and subcategories. Essentially I would like to know the logic in displaying something like this as well as what components in BigCommerce I would need to do this.
I’d like to point out a few things about this example that aren’t ideal to what we want.
This site seems to be suffering from multiple locations of the same link (if you
look at the source, one link appears 4 times - my site is trying to avoid this because of upwards of 800+ internal links and also because of site load times to generate the navigation)
Each subcategory is generated for all the categories and different menu appearances—this is why they appear 4 times each
So ultimately, we’d want a navigation that does these things:
Know what category we are currently in
Display parent categories leading up to current category
Display sibling categories to current category
Display subcategory/children categories to current category
Expand down upon click to display children categories
I know the Category API can tell me the hierarchy of the categories, but I feel making AJAX calls to a PHP file on each page of my website might be counter-intuitive to making my website more speedy. Is there any simple object that I can access with JS that I can manipulate on a page-level?
I just did something like this using JS to figure out what categories to show/hide and which to have open/closed. First, include the category tree in your sidebar and hide it.
function formatCustomSideBar(){
var cats = [];
$("ul.breadcrumbs > li").each(function(){
if($(this).hasClass("is-active")){
var name = $(this).find("span").text();
cats.push(name);
} else {
var name = $(this).find("a").text();
cats.push(name);
}
});
console.log(cats);
$(".custom-nav li a").each(function(){
var subCat = $(this).text();
if( $.inArray(subCat, cats) !== -1 ){
$(this).parent("li").addClass("active-category");
}
});
};
formatCustomSideBar();
Next, add all breadcrumb values into an array because the breadcrumb always tells us where we are on the site. Then loop the navigation tree, and add a class of active-category to the list item if it is present in the breadcrumb array. Using the active-category class and CSS, you can style the feature.
To add the toggling functionality, I would add an additional few lines to the end of my function to loop list items with the active-category class, and check if they have a child <ul> to find out if they have children categories, and add a class like has-children from there.
Hope this helps.
I need to make a grid display data that a user selects based on a dropdown menu using knockout. If for example my dataset is:
{"Data":[{"Avg. Number of Insects":9, "Percent of Damage to Leaves":67.5},{"Avg. Number of Insects":8, "Percent of Damage to Leaves":33.9},{"Avg. Number of Insects":10, "Percent of Damage to Leaves":10.4},{"Avg. Number of Insects":10, "Percent of Damage to Leaves":21.6}]}
and I have drop down menus for the student to select which variables they want to work with (normally there would be more than two) and want to display the actual data based on which variables they have selected. I tried starting with simpleGrid but it doesn't seem to respond to the header and row changing.
Here is the JSFiddle: http://jsfiddle.net/anyaejohnson/z2cma7ya/7/
To populate your header simply follow the example here: http://knockoutjs.com/examples/cartEditor.html but instead of using the data from category to populate product, use category to populate an observable array of which you bind to the header
I have 2 column page the first column :
I want to create 2 drop down menus. The first contains the categories and the second has the posts that are related to the category.
With a meaning that when someone chooses the category (laptops) in the second menu only the laptops would appear. And when choosing both options and clicking submit the posts on the the other column would filter to only the product that he selected.
can you please help me with either one of them and your help would be appreciated.
Follow this example (Nested Combos):
http://www.prodiven.com/jcombo/