This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // REAL-TIME INVENTORY CHECK - V2 | |
| // CAN BE USED TO SUPPORT BOPIS AND INVENTORY THRESHOLD USE CASES | |
| // SAMPLE REQUEST WITH VARYING PRODUCTS + LOCATIONS | |
| // THIS VERSION IS NORMALIZED BY LOCATION | |
| { | |
| "quantityLocationQueries": [ | |
| { | |
| "locationID": "425", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // REAL-TIME INVENTORY CHECK | |
| // CAN BE USED TO SUPPORT BOPIS AND INVENTORY THRESHOLD USE CASES | |
| // SAMPLE REQUEST WITH VARYING PRODUCTS + LOCATIONS | |
| { | |
| "quantityLocationQueries": [ | |
| { | |
| "locationID": "425", | |
| "locationType": "store", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Displays the current items in the cart in the minicart panel. | |
| * The minicart only uses session.privacy.cartQty and not render all the contents; those would be loaded on hover | |
| */ | |
| function miniCartSimple() { | |
| // get total qty in basket and cache in session, this is updated on every calculation | |
| if(empty(session.privacy.cartQty)){ | |
| var cartModel = app.getModel('Cart').get(); | |
| if(cartModel){ | |
| session.privacy.cartQty = cartModel.getUnitCount(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var app = require('storefront_controllers/cartridge/scripts/app'); | |
| var guard = require('storefront_controllers/cartridge/scripts/guard.js'); | |
| var messageString = require('~/cartridge/scripts/messageString'); | |
| function show () { | |
| var msg = messageString.getMessage(); | |
| app.getView(msg).render('sometemplate'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var app = require('storefront_controllers/cartridge/scripts/app'); | |
| var guard = require('storefront_controllers/cartridge/scripts/guard.js'); | |
| function show () { | |
| var msg = getMessage(); | |
| app.getView(msg).render('sometemplate'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var client = new dw.net.HTTPClient(); | |
| var basicAuth = "Basic " + dw.util.StringUtils.encodeBase64(pdict.CurrentHttpParameterMap.clientID + ":" + pdict.CurrentHttpParameterMap.clientPassword); | |
| client.setRequestHeader("Authorization",basicAuth); | |
| client.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); | |
| client.setTimeout(2000); | |
| client.open("POST", "https://account.demandware.com/dw/oauth2/access_token"); | |
| client.send("grant_type=client_credentials"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //instead of `ismodule`s you could do | |
| ${pdict.includes.image(pdict.product)}` | |
| //in `image()` you can use `ISML.render()` to render the image | |
| //advantage: clean scopes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |