2

I managed to installed Sitecore Habitat Home Commerce (9.0.2) and trying to extend some of the functionalities. I will need to customise checkout billing page to fit the requirement.

There are few questions I would like to check with the community after spending hours in researching how Commerce SXA components were implemented by Habitat Home Commerce demo.

I came across this section when viewing the showconfig and notice that we are required to register commerce models and js files in the config file.

<commerce.XA>   
   <javascripts>...</javascripts>
   <models>...</models>
</commerce.XA>

As for the registered Commerce SXA js files, can I assume Sitecore Commerce SXA module will include them in the page when rendering a Commrece SXA page? If it is not registered, Commerce SXA will not load them.

If that's the case for js files, but why do we need the Commerce models being registered?

  • Yes, they are different. As I have heard those products are developed by two different teams of developers. – Łukasz Skowroński Jan 3 at 12:06
2

So the hierarchy is as follow: SXA requires Sitecore, and Storefront Commerce (CXA) requires SXA.

CXA is using SXA as a platform and is using a lot of SXA features. They still have a lot of custom logic like for example usage of Knocout.js and the fact that they are registering their JavaScript filed and Models is related to those custom features.

Please write about which config section you are exactly asking about and I will update my answer with more details if needed.

  • Updated my question with the commerce section. – WenHao Jan 4 at 3:13
0

Theoretically you can extend models without extending repository, just register yours type for model, but it will work only for models that have virtual Initialize method, with necessary arguments for implement custom logic, unfortunately not all models have this. So you should use some decompiler (I use dotPeek) for browse commerce modules any way.

In most cases you will override repository and in this case do not have any sense register model and than create model object through IModelProvider, you can use "new". But I all time do it through IModelProvider for have similar working process with models everywhere in my solutions(I mean my code and OOTB code look the same).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.