Shop provider

Version: 10.3

Connect introduces the concept of a shop provider. The role of the shop provider is to provide shop information to the service layer on every call.

The shop provider is configurable and you can introduce specific storefront implementations when necessary.

TheSitecore.Commerce.config file defines the following provider and shop entity configuration:

RequestResponse

<shopProvider type="Sitecore.Commerce.Providers.ShopProvider,
Sitecore.Commerce.Connect.Core" singleInstance="true"/>

<commerce.Entities>

    <Shop type="Sitecore.Commerce.Entities.Shop,
Sitecore.Commerce.Connect.Core" />

</commerce.Entities>

A shop provider implements the IShopProvider interface. You must implement the GetShop() method.

The ShopProvider class diagram.

Name

Description

shopName

When specified, the shop provider must return information for the given shopName. When <null>, it must return information about the current shop.

The default implementation returns an instance of the Shop class and populates the shopName property. The shopName property is by default taken from the Sitecore.Context.Site.Name value or an empty string if it is not specified. When given a shopName, it simply populates the returned shop information with this information. This should be adequate for most storefront implementations.

The base ServiceProviderRequest class exposes a Shop property and is populated by calling any service provider method.

The Shop class diagram.

Name

Description

Name

The name of the shop.

Since every service request now populates the Shop information, the shopName properties of existing requests are marked as obsolete. In order not to break any existing implementation of Connect, the ShopName properties of existing requests will keep working until we remove it in a future version. This means that all existing code that sets the shopName property explicitly will continue working until the property is removed from all requests.

Do you have some feedback for us?

If you have suggestions for improving this article,