Event Listeners

Listening for Smart Search Events

Quick View

Init

The init event is the first event that is triggered when Smart Search Quick View settings found.

document.addEventListener('rebuy:smartsearch.quickview.init', (event) => {
   console.log(event.detail.smartSearchQuickView, "Quickview init");
})

Before Ready

The before ready event is triggered when Smart Search quick view instance about to be ready or not.

document.addEventListener('rebuy:smartsearch.quickview.beforeReady', () => {
     console.log("Quickview before ready");
})

Ready

The ready event is triggered when Smart Search Quick View instance is ready.

document.addEventListener('rebuy:smartsearch.quickview.ready', (event) => {
     console.log(event.detail.smartSearchQuickView, "Quickview is ready");
})

Open

This event is triggered when the Quick View Search opens.

document.addEventListener('rebuy:smartsearch.quickview.open', (event) => {
     console.log(event.detail.smartSearchQuickView, "Quickview open");
})

Close

This event triggers when the Quick View Search closes.

document.addEventListener('rebuy:smartsearch.quickview.close', (event) => {
     console.log(event.detail.smartSearchQuickView, "Quickview close");
})

Before Add

The before add event event is triggered when a product is about to be added from Smart Search Quick View.

document.addEventListener('rebuy:smartsearch.quickview.beforeAdd', (event) => {
     console.log(event.detail.product);
     console.log(event.detail.smartSearchQuickView);
     console.log("Quickview before add");
})

Add

The add event event is triggered when a product is added from Smart Search Quick View.

document.addEventListener('rebuy:smartsearch.quickview.add', (event) => {
     console.log(event.detail.product);
     console.log(event.detail.smartSearchQuickView);
     console.log("Quickview add");
})

View

The view event is triggered when user clicks on a product or "Learn More" link from the Smart Search Quick View. This could be clicking the product image, title or an actual learn more button/link.

document.addEventListener('rebuy:smartsearch.quickview.view', (event) => {
     console.log(event.detail.product);
     console.log(event.detail.smartSearchQuickView);
     console.log("Quickview view");
 })

Before Products Change

The before products change event is triggered when products are about to be changed based on search term.

document.addEventListener('rebuy:smartsearch.quickview.beforeProductsChange', (event) => {
      console.log(event.detail.products);
      console.log(event.detail.smartSearchQuickView);
      console.log("Quickview beforeProductsChange");
})

Products Change

The products change event is triggered when new products being returned from entered search term.

document.addEventListener('rebuy:smartsearch.quickview.productsChange', (event) => {
     console.log(event.detail.products);
     console.log(event.detail.smartSearchQuickView);
     console.log("Quickview productsChange");
})

Results Page

Init

The init event is the first event that is triggered when Smart Search Results Page settings found.

document.addEventListener('rebuy:smartsearch.resultsPage.init', (event) => {
   console.log(event.detail.smartSearchResultsPage, "Results Page init");
})

Before Ready

The before ready event is triggered when Smart Search Results Page instance about to be ready or not.

document.addEventListener('rebuy:smartsearch.resultsPage.beforeReady', () => {
    console.log("Results Page before ready");
 })

Ready

The ready event is triggered when Smart Search Results Page instance is ready.

 document.addEventListener('rebuy:smartsearch.resultsPage.ready', (event) => {
     console.log(event.detail.smartSearchResultsPage, "Results Page ready");
 })

Before Add

The before add event event is triggered when a product is about to be added from Smart Search Results Page.

document.addEventListener('rebuy:smartsearch.resultsPage.beforeAdd', (event) => {
     console.log(event.detail.product);
     console.log(event.detail.smartSearchResultsPage);
     console.log("Results Page beforeAdd");
})

Add

The add event event is triggered when a product is added from Smart Search Results Page.

document.addEventListener('rebuy:smartsearch.resultsPage.add', (event) => {
     console.log(event.detail.product);
     console.log(event.detail.smartSearchResultsPage);
     console.log("Results Page Add");
 })

View

The view event is triggered when user clicks on a product or "Learn More" link from the Smart Search Results Page. This could be clicking the product image, title or an actual learn more button/link.

document.addEventListener('rebuy:smartsearch.resultsPage.view', (event) => {
     console.log(event.detail.product);
     console.log(event.detail.smartSearchResultsPage);
     console.log("Results Page View");
})

Before Products Change

The before products change event is triggered when products are about to be changed based on search term.

 document.addEventListener('rebuy:smartsearch.resultsPage.beforeProductsChange', (event) => {
      console.log(event.detail.products);
      console.log(event.detail.smartSearchResultsPage);
      console.log("Results Page beforeProductsChange");
 })

Products Change

The products change event is triggered when new products being returned from entered search term.

document.addEventListener('rebuy:smartsearch.resultsPage.productsChange', (event) => {
     console.log(event.detail.products);
     console.log(event.detail.smartSearchResultsPage);
     console.log("Results Page productsChange");
})