Is it possible to have the Combination Facets search reset to default when returning back to another page that it might appear on? It filters what is on the page and can be confusing (as in the customer may think what they see on the page is all there is).
Announcement
Collapse
No announcement yet.
Combination Facets Reset
Collapse
X
-
Combination Facets Reset
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Tags: None
-
By default Miva sets a cookie to store the YYM selected. You can however change the JS so the cookie is not set:
Change this:
combination_facet.Load_Cookie();
To this:
combination_facet.Initialize_NoCookieSet();
If using the Page Builder Combination Facet Component, you'll need to export the component to update the JS I believe.
-
Originally posted by Brennan View PostBy default Miva sets a cookie to store the YYM selected. You can however change the JS so the cookie is not set:
Change this:
combination_facet.Load_Cookie();
To this:
combination_facet.Initialize_NoCookieSet();
If using the Page Builder Combination Facet Component, you'll need to export the component to update the JS I believe.Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
Originally posted by Brennan View PostBy default Miva sets a cookie to store the YYM selected. You can however change the JS so the cookie is not set:
Change this:
combination_facet.Load_Cookie();
To this:
combination_facet.Initialize_NoCookieSet();
If using the Page Builder Combination Facet Component, you'll need to export the component to update the JS I believe.Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
lesliekirk
Here is a snippet that I shared with someone else which will reset the cookie and reload the current page if the button is selected.
HTML Code:<button id="clearFacet">Clear Combination-Facet Cookie</button> <script> document.getElementById('clearFacet') .addEventListener('click', () => { const payload = { Session_Type: "runtime", Store_Code: "STORE_CODE_HERE", Function: "Module", Module_Code: "combofacets", Module_Function: "Runtime_CombinationFacetAppliedValueList_Clear_Co okie", CombinationFacet_Code: "COMBINATION_FACET_CODE_HERE" }; fetch('/mm5/json.mvc', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) .then(res => { if (!res.ok) throw new Error(`HTTP ${res.status}`); return res.json(); }) .then(data => { console.log('Module call succeeded:', data); window.location.reload(); }) .catch(err => { console.error('Module call failed:', err); }); }); </script>
Nicholas Adkins
Technical Training Specialist / Miva, Inc.
[email protected]
https://www.miva.com/mivalearn
Comment
-
Originally posted by Nick View Postlesliekirk
You should be able to update the STORE_CODE_HERE and COMBINATION_FACET_CODE_HERE then add to any template for it to work. I would suggest optimizing the script and adding to the JS Resources but this is a good starting point to get the desired feature.
What I really want is something that would work behind the scenes and clear the selections when going to another page that has Combination Facets on it.Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
Originally posted by lesliekirk View Post
Can this be used as a replacement for the Facets Clear All (that doesn't work if you happen to go to the CTGY page that has been filtered by the Combination Facets Component)?
What I really want is something that would work behind the scenes and clear the selections when going to another page that has Combination Facets on it.
Nicholas Adkins
Technical Training Specialist / Miva, Inc.
[email protected]
https://www.miva.com/mivalearn
Comment
-
Originally posted by Nick View Post
You (ChatGPT) could modify the snippet to work that way. Bottom line is you can make a call to json.mvc and pass the Runtime_CombinationFacetAppliedValueList_Clear_Coo kie function and the facet information within a JSON payload to clear the Combination Facet cookie.Leslie Kirk
Miva Certified Developer
Miva Merchant Specialist since 1997
Previously of Webs Your Way (aka Leslie Nord leslienord)
Email me: [email protected]
www.lesliekirk.com
Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr
Comment
-
lesliekirk try feeding ChatGPT the Miva documentation pages. For example you could say something like ..
I am trying to clear a cookie when the user goes to a new category page. Here is the function in the Miva LSK that will clear the combination facet cookie, https://github.com/mivaecommerce/miv...ime.js#L49-L57, and here is an example of using the set combination facet cookie function, https://www.postman.com/mivamerchant...ion-set-cookie. Can you write JavaScript that will run this function for my store with the store code of ML and the combination facet code of YMM.
Then once it generates the code make sure to evaluate it and get a clear understanding of what it is doing so you can adjust as needed.Nicholas Adkins
Technical Training Specialist / Miva, Inc.
[email protected]
https://www.miva.com/mivalearn
Comment
Comment