Posts

Showing posts from December, 2024

Product Data Synchronization Between Solr and SAP Commerce (hybris)

Image
Requirement : The product data in SAP Commerce (Hybris) is always synchronized with the information stored in Solr. This means that any updates or changes made to product details in Solr are automatically reflected in SAP Commerce(Hybris) Database. It works by: Fetching product details (like product code, stock status, EAN, and manufacturer name) from Solr. Checking if the product already exists in the SAP Commerce database. If the product exists, it updates the existing record. If the product does not exist, it creates a new record in the database. This process ensures that the product information in SAP Commerce remains synchronized with the product data from Solr. Step 1: Define the Custom Item Type SolrExtractedItemType in /samplecore/resources/samplecore-items.xml You need to create a custom item type that will hold the product information fetched from Solr, such as the product code, stock status, EAN, and manufacturer name < itemtype code = "SolrExtractedItemType...

Renderer Classes for Backoffice Customization in SAP Commerce (Hybris)

Image
Requirement : Here we are developing custom renderer class to retrive and sort somecondition entities by precedence Format each condition as a string: code | precedence | Y/N (where Y/N (Yes or No) indicates the isAvailable flag) and Concatenate all conditions into a single string separated by commas (,) then display the formatted string in the backoffice list view. Step 1: Define two custom item types: SomeProductRule and SomeCondition . Location: /samplecore/resources/samplecore-items.xml < itemtype code = "SomeProductRule" autocreate = "true" generate = "true" > < description >Some Product Rules</ description > < deployment table = "someproductrules" typecode = "15788" /> < attributes > < attribute qualifier = "vendor" type = "java.lang.String" > < description >Vendor Identifier</ description ...

How to Add a New Navigation Node and Page in SAP Commerce (Hybris).

Image
Beside of "My Coupons" Navigation Node I want to create My Test Node ,then link it to new custom My Test Page Step 1 : Identitfy the Parent Node is MyAccountNavNode Take reference from location: /customercouponaddon/resources/customercouponaddon/import/contentCatalogs/electronicsContentCatalog/cms-responsive-content.impex (or) /customerinterestsaddon/resources/customerinterestsaddon/import/contentCatalogs/electronicsContentCatalog/cms-content.impex Step 2: Create a CMS Link Component because the CMS Link Component represents a clickable link on the storefront. $contentCatalog = electronicsContentCatalog $contentCV =catalogVersion(CatalogVersion.catalog(Catalog.id[default= $contentCatalog ]),CatalogVersion.version[default=Staged])[default= $contentCatalog :Staged] INSERT_UPDATE CMSLinkComponent ; $contentCV [ unique = true ] ; uid[ unique = true ] ; name ; url ; &linkRef ; target(code)[default= 'sameWindow' ] ...

POST OCC(WebServices) API for Creating B2C Store Details in Sap Commerce(Hybris) 2211

Image
Step 1: Create the b2CStoreDetails method in the SampleB2CStoreController . This method defines an endpoint to create new B2C Store details.It Receives the request and passes the store data to the facade. Location: /sampleocc/src/com/hybris/occ/controllers/SampleB2CStoreController.java Note: I'm adding the b2CStoreDetails method in SampleB2CStoreController of Step 14 in OCC Webservices in SAP Commerce (Hybris) 2211 – Part 2 import java.util.ArrayList; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.http.ResponseEntity; import com.hybris.simple.facades.B2CStoreData; import com.hybris.simple.facades.B2CStoreDataList; import com.hybris.simple.facades.B2CStoreDataListWSDTO; import com.hybris.simple.facades.B2CStoreDataWSDTO; @Controller @RequestMapping (value = "/{baseSiteId}") public cl...

Advanced Configurations of OCC Webservices in SAP Commerce 2211 Using YOCC Template – Part 2

Image
Go to Part 1 OCC: OCC Webservices in SAP Commerce (Hybris) 2211 – Part 1 Step 11: In this step, you are adding a bean definition for B2CStoreDataList in samplefacades-beans.xml This bean will hold a list of B2CStoreData objects, which are returned by passing a storeId . Location: /samplefacades/resources/samplefacades-beans.xml < bean class =" com.hybris.simple.facades.B2CStoreDataList "> < property name =" b2cstore " type =" java.util.List<com.hybris.simple.facades.B2CStoreData> " /> </ bean > Step 12: In this step, we will create the B2CStorePopulator to map data from the SampleB2CStoreModel to B2CStoreData . Location: /samplefacades/src/com/hybris/simple/facades/populators/B2CStorePopulator.java import de.hybris.platform.converters.Populator; import de.hybris.platform.servicelayer.dto.converter.ConversionException; import com.hybris.simple.core.model.SampleB2CStoreModel ; import com...