Skip to main content

Posts

How to create dynamic urls without actually having sub-categories ?

How to create dynamic urls without actually having sub-categories ? By using only root categories, without sub categories and use search refinements to get desired results page. We can use dw.web.URLUtils class to create links from code. Use $url$ content link function to create links from content. Use Search-Show as controller route, add prefnX and prefvX parameters to apply the needed refinements where X is a number starting from 1
Recent posts

Response Structure coming from OCAPI

Is there anyway to change the response structure coming from OCAPI? There are hooks for certain OCAPI endpoints that you can use to modify the output.If need something more specific and it goes with use case ... create a custom controller to get what you need in a certain format.

What is the right way of adding jquery to the page?

What is the right way of adding jquery to the page? There is no "right" way. All depends on what you want to achieve or avoid. For example, SFRA exposes jQuery at the very beginning of JS execution like: window.jQuery = window.$ = require('jquery'); In that way, you have access to $ in any code you execute below without adding additional bundling mechanisms. The drawback is that you "ban" jQuery and $ names globally for yourself and should always remember it, especially when you use 3-rd party scripts, just controlling (while you can't do it fully) what they can do with this names. Also, there is no way to understand, if jQuery is used on a particular page or not, it always here, even when the page does not need it.

Product.getLastModified() is Not changing on price change

In cartridge code in SFCC, how to find if product price have changed recently. In case product.getLastModified() is not changing on price change. There is no built in way to do this. I suggest using ProductPriceInfo. You can get priceBook information for any product by Product.getPriceModel(), which returns a instance of ProductPriceModel. This class has a method getPriceInfo(), which will return a ProductPriceInfo class instance with attribute priceInfo : String, which you can use to store information about the date of change for a given price point for a product. Demandware Docs

Variation Group in SFCC

Variation Group in SFCC Technically a variant could be in multiple groups. One way to do this is to get the ProductVariationModel of that variant's master. Then you could set the selected value (setSelectedAttributeValue(String, String)) of the attribute your group is represented by. Finally you can get the collection of groups (getVariationGroups()) that share that selected value. Demandware Docs

How Browser Functions? And How Rendering Engine works in Browser ?

How Browser Functions? We use web browsers every day to display web pages but have you ever wondered what is happening behind the scenes? This is the basic flow of viewing the web page.  You send the request over the network to a server. It responds with the collection of web content (Html, CSS, and Images, etc) as a response. Your browser interprets the content returned and Displays the page. Let's Look at the High-level Structure of a browser and the components it uses to accomplish this. User Interface:  It is presented to user to interact with, It displays to you the address bar, back and forward Buttons at any other visual elements you can interact with such as tabs . Rendering Engine:  The browser has a Rendering engine that is responsible for displaying the visual representation of the webpage think of the rendering engine as a painter working on a blank canvas. It's his responsibility to construct the page by applying the right structures and colors. The engine ...