You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What are you trying to accomplish? Please describe.
We want to display products under a specific category in the search results page when user enters category name in the search bar. What have you tried so far?
Added 'vtex.search-result' as dependency in manifest.json.
Added the Search Result to page templates.
"store.search": {
"blocks": ["search-result-layout"]
}
Defined how the search query data should be fetched
"store.search#category": {
"blocks": ["search-result-layout"],
"props": {
"context": {
"skusFilter": "FIRST_AVAILABLE",
"simulationBehavior": "skip"
}
}
},
Additional info
Code Sample (flex-layout.row#category-content-block", "flex-layout.row#recommended-category-heading", "flex-layout.row#recommended-category-block" are custom blocks):
"rich-text#recommended-category-heading": {
"props": {
"text": "Other categories you may also like",
"blockClass": "recommended-category-head-text"
}
},
What are you trying to accomplish? Please describe.
We want to display products under a specific category in the search results page when user enters category name in the search bar.
What have you tried so far?
"store.search": {
"blocks": ["search-result-layout"]
}
"store.search#category": {
"blocks": ["search-result-layout"],
"props": {
"context": {
"skusFilter": "FIRST_AVAILABLE",
"simulationBehavior": "skip"
}
}
},
Additional info
Code Sample (flex-layout.row#category-content-block", "flex-layout.row#recommended-category-heading", "flex-layout.row#recommended-category-block" are custom blocks):
{
"store.search": {
"blocks": ["search-result-layout", "back-to-top-button"],
"props": {
"context": {
"skusFilter": "ALL",
"simulationBehavior": "skip"
}
}
},
"store.search#brand": {
"blocks": ["search-result-layout"],
"props": {
"context": {
"orderByField": "OrderByReleaseDateDESC",
"hideUnavailableItems": true,
"maxItemsPerPage": 10,
"skusFilter": "ALL",
"simulationBehavior": "skip"
}
}
},
"store.search#department": {
"blocks": ["search-result-layout"],
"props": {
"context": {
"skusFilter": "ALL",
"simulationBehavior": "skip"
}
}
},
"store.search#category": {
"blocks": ["search-result-layout", "flex-layout.row#category-content-block", "flex-layout.row#recommended-category-heading", "flex-layout.row#recommended-category-block", "back-to-top-button"],
"props": {
"context": {
"skusFilter": "ALL",
"simulationBehavior": "skip"
}
}
},
"store.search#subcategory": {
"blocks": ["search-result-layout", "flex-layout.row#category-content-block", "flex-layout.row#recommended-category-heading", "flex-layout.row#recommended-category-block", "back-to-top-button"],
"props": {
"context": {
"skusFilter": "ALL",
"simulationBehavior": "skip"
}
}
},
"flex-layout.row#recommended-category-heading": {
"children": ["rich-text#recommended-category-heading"],
"props": {
"blockClass": "recommended-category-heading"
}
},
"rich-text#recommended-category-heading": {
"props": {
"text": "Other categories you may also like",
"blockClass": "recommended-category-head-text"
}
},
"search-result-layout": {
"blocks": [
"search-result-layout.desktop",
"search-result-layout.mobile",
"search-not-found-layout"
]
},
"search-result-layout.desktop": {
"children": [
"flex-layout.row#searchbread",
"flex-layout.row#searchtitle",
"flex-layout.row#result",
"search-blog-articles-list.wordpress"
],
"props": {
"pagination": "show-more",
"preventRouteChange": false,
"defaultGalleryLayout": "grid"
}
},
"flex-layout.row#searchbread": {
"children": ["breadcrumb.search"],
"props": {
"preserveLayoutOnMobile": true,
"fullWidth": true,
"blockClass": "breadcrumb"
}
},
"flex-layout.row#searchtitle": {
"children": ["search-title.v2"],
"props": {
"blockClass": "search-title"
}
},
"flex-layout.row#result": {
"children": [
"flex-layout.col#filter",
"flex-layout.col#content"
],
"props": {
"preventHorizontalStretch": true,
"fullWidth": true,
"blockClass": "search-result"
}
},
"flex-layout.col#filter": {
"children": ["filter-navigator.v3"],
"props": {
"blockClass": "filterCol"
}
},
"flex-layout.col#content": {
"children": [
"flex-layout.row#searchinfo",
"flex-layout.row#fetchprevious",
"flex-layout.row#products",
"flex-layout.row#fetchmore"
],
"props": {
"width": "grow",
"preventVerticalStretch": true,
"blockClass": "right-content"
}
},
"flex-layout.row#searchinfo": {
"children": ["flex-layout.col#productCount", "flex-layout.col#orderByAndSwitcher"],
"props": {
"blockClass": "orderByAndSwitcher"
}
},
"flex-layout.col#orderByAndSwitcher": {
"children": ["order-by.v2", "gallery-layout-switcher"],
"props": {
"horizontalAlign": "right",
"preventHorizontalStretch": true,
"blockClass": "orderByAndSwitcher",
"colGap": 3
}
},
"flex-layout.col#order": {
"children": ["order-by.v2"],
"props": {
"blockClass": "orderBy"
}
},
"flex-layout.col#switcher": {
"children": ["gallery-layout-switcher"],
"props": {
"blockClass": "Switcher"
}
},
"flex-layout.col#productCount": {
"children": ["total-products.v2"],
"props": {
"blockClass": "productCountCol"
}
},
"flex-layout.row#fetchprevious": {
"props": {
"marginBottom": 3
},
"children": ["search-fetch-previous"]
},
"flex-layout.row#fetchmore": {
"props": {
"marginTop": 3
},
"children": ["search-fetch-more"]
},
"flex-layout.row#products": {
"children": ["search-content"]
},
"search-content": {
"blocks": ["gallery", "not-found"]
},
"search-result-layout.mobile": {
"children": [
"flex-layout.row#searchbread",
"flex-layout.row#searchinfomobile",
"flex-layout.row#productCountMobile",
"flex-layout.row#fetchprevious",
"flex-layout.row#contentmobile",
"flex-layout.row#fetchmore"
],
"props": {
"pagination": "show-more",
"mobileLayout": {
"mode1": "small",
"mode2": "normal"
},
"defaultGalleryLayout": "grid"
}
},
"flex-layout.row#contentmobile": {
"children": ["search-content"],
"props": {
"preserveLayoutOnMobile": true
}
},
"flex-layout.row#searchinfomobile": {
"children": [
"flex-layout.row#searchtitle",
"flex-layout.col#orderByMobile",
"flex-layout.col#filterMobile"
],
"props": {
"preserveLayoutOnMobile": true,
"colSizing": "auto",
"colJustify": "around",
"blockClass": "searchinfomobile"
}
},
"flex-layout.col#orderByMobile": {
"children": ["order-by.v2"],
"props": {
"blockClass": "orderByMobileCol"
}
},
"flex-layout.row#productCountMobile": {
"children": ["total-products.v2", "flex-layout.col#switcherMobile"],
"props": {
"blockClass": "productCountMobileRow"
}
},
"flex-layout.col#filterMobile": {
"children": ["filter-navigator.v3"],
"props": {
"blockClass": "filterMobileCol"
}
},
"flex-layout.col#switcherMobile": {
"children": ["gallery-layout-switcher"],
"props": {
"verticalAlign": "middle"
}
},
"search-not-found-layout": {
"children": ["flex-layout.row#searchbread", "flex-layout.row#notfound-searchblocks"]
},
"flex-layout.row#notfound": {
"children": ["not-found"],
"props": {
"fullWidth": true
}
},
"flex-layout.row#notfound-searchblocks": {
"children": ["rich-text#search-not-found", "rich-text#search-again", "flex-layout.row#searchbarnotfound", "rich-text#suggestions_heading", "rich-text#suggestions"],
"props": {
"blockClass": "notfound-searchblocks"
}
},
"flex-layout.row#searchbarnotfound": {
"children": ["search-bar"],
"props": {
"blockClass": "no-result-searchbar"
}
},
"rich-text#search-not-found": {
"props": {
"text": "Sorry, no results found",
"textPosition": "CENTER",
"textAlignment": "CENTER",
"font": "t-heading-3",
"blockClass": "no-result-heading"
}
},
"rich-text#search-again": {
"props": {
"text": "Search Again",
"textPosition": "CENTER",
"textAlignment": "CENTER",
"font": "t-heading-6",
"blockClass": "search-again-heading"
}
},
"rich-text#suggestions_heading": {
"props": {
"text": "Suggestions",
"textPosition": "CENTER",
"textAlignment": "CENTER",
"font": "t-heading-6",
"blockClass": "suggestions-heading"
}
},
"rich-text#suggestions": {
"props": {
"text": "- Make sure all words are spelled correctly.\n- Try different keywords.\n- Try more general keywords.",
"textPosition": "CENTER",
"textAlignment": "CENTER",
"font": "t-heading-6",
"blockClass": "suggestion-list"
}
},
"breadcrumb": {
"props": {
"showOnMobile": true,
"homeIconSize": 20,
"caretIconSize": 10
}
},
"breadcrumb.search": {
"props": {
"showOnMobile": true,
"homeIconSize": 20,
"caretIconSize": 10
}
},
"gallery": {
"props": {
"layouts": [
{
"name": "grid",
"component": "GridSummary",
"itemsPerRow": {
"(min-width:1300px)": 4,
"desktop": 4,
"tablet": 3,
"phone": 2
}
},
{
"name": "list",
"component": "ListSummary",
"itemsPerRow": 1
}
],
"ListSummary": "product-summary.shelf#listLayout",
"GridSummary": "product-summary.shelf"
}
},
"gallery-layout-switcher": {
"children": [
/*
* For accessbility to work properly,
* It's important to define the options in the same order as the layouts
*/
// "gallery-layout-option#grid",
// "gallery-layout-option#list"
]
},
"gallery-layout-option#grid": {
"props": {
"name": "grid"
},
"children": [
"icon-grid",
"responsive-layout.desktop#textOptionGrid"
]
},
"gallery-layout-option#list": {
"props": {
"name": "list"
},
"children": [
"icon-inline-grid",
"responsive-layout.desktop#textOptionList"
]
},
"responsive-layout.desktop#textOptionGrid": {
"children": [
"rich-text#option-grid"
]
},
"responsive-layout.desktop#textOptionList": {
"children": [
"rich-text#option-list"
]
},
"rich-text#option-grid": {
"props": {
"text": "Grid",
"textColor": "c-auto",
"blockClass": "layout-option"
}
},
"rich-text#option-list": {
"props": {
"text": "List",
"textColor": "c-auto",
"blockClass": "layout-option"
}
},
"flex-layout.row#category-content-block": {
"children": ["flex-layout.col#category-content-block"],
"props": {
"blockClass": "category-content-block"
}
}
}
The text was updated successfully, but these errors were encountered: