This blog is in continuation of the previous blog. I write this blog with the below version of the Sitecore.
Since we are done with the creation of new property on the XC side, let’s import the same in XP to rendered on the website as well. Go back to the Sitecore experience platform’s content editor and from ribbon select Update Data templates.
Once the update gets completed, verify that your template is generated under the
with your new one so that you can see your property in the catalog item of the content tree. Commerce Product template is responsible for displaying product property to the content tree.
Note: In case if your property data is not displayed, then make sure that this sellable item corresponding entity version is published on the XC side.
For the next, we have to extend the SXA rending to display this newly added entity on the page. Create a new Feature project in your solution, for the purpose of simplicity I had only create a single project solution.
You would require below mention dependencies within your solution.
Now let’s perform coding for creating a new SXA component.
Create a model for the new product property –
Create the repository for fetching the data and binding –
Create a controller for binding with View –
Create a View for controller –
We have to create the initiator for dependency injections –
We do have to create the config file for the initiator as well –
Publish the code into your Sitecore instance, and gets let’s start setting up the rendering in Sitecore, I have created a new controller Rendering as below –
Now make it available your rendering to commerce sxa tool in experience editor. First of all I had created a new container named Commerce Customization –
Now add the controller rendering into the container –
Now add open your product Item in Experience editor. The new container will be available in the toolbox drag and drop the rendering below to your Product details section. Save and Publish the page.
Open the page on the site, your new property will be available.