Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: newArrival attribute #207

Merged
merged 3 commits into from
Dec 5, 2024
Merged

feat: newArrival attribute #207

merged 3 commits into from
Dec 5, 2024

Conversation

sbellone
Copy link
Collaborator

@sbellone sbellone commented Dec 5, 2024

Today, we have a newArrivalsCategory attribute which contains hierarchical facets.
But displaying two hierarchical facets on the UI can create confusion and duplicates the information:

image

SFRA default UI uses a "New Arrival" checkbox.
This PR adds a newArrival boolean attribute, set to true when a product belongs to the newarrivals category, and a toggleRefinement widget that permits to show a simple refinement checkbox similar to SFRA:

image

Changes

  • Refactor the productModelCustomizer to also handle the newArrival attribute
  • Add a toggleRefinement widget on the UI, and the CSS to have the same look and feel than SFRA
    • Also added to SiteGenesis but with a simpler labelText and no custom CSS

How to test

  • Add newArrival to the Additional Product Attributes and run the product index job
  • Check the search results page

SFCC-406
SFCC-407

@sbellone sbellone requested a review from htuzel December 5, 2024 11:10
@sbellone sbellone self-assigned this Dec 5, 2024
newArrivalsCategory: function(productModel) {
if (!empty(productModel.categories)) {
for (var i = 0; i < productModel.categories.length; i += 1) {
var rootCategoryId = productModel.categories[i][productModel.categories[i].length - 1].id;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we give it a name as lastCategoryId as it refers to the ID of the last category in the chain

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sure, I went with topLevelCategoryId to match SFCC naming: isTopLevel()

@sbellone sbellone requested a review from htuzel December 5, 2024 15:45
@sbellone sbellone merged commit c36808c into develop Dec 5, 2024
5 checks passed
@sbellone sbellone deleted the feat/new-arrival-attribute branch December 5, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants