Show / Hide Table of Contents

    Extend the profile address

    Extend the Commerce Profile System

    More details how to extend the Commerce Profile System can be found here.

    Configure the Commerce Connect type

    Patch the Mercury.Commerce.Customers.config file. Provide the correct type for the class that is extended by patching the type attribute of the CustomerParty element in the commerce.Entities configuration section.

    Example

    <sitecore>
        <commerce.Entities>
            <CustomerParty>
                <patch:attribute name="type">
                    MyOrders.MyCommerceParty, MyOrders</patch:attribute>
            </CustomerParty>
          ...
        </commerce.Entities>
        ...
    </sitecore>
    

    Extend the translation of Commerce to Commerce Connect

    1. Create a new pipeline processor that derives from the TranslateCommerceAddressProfileToEntity pipeline processor.

      Example

      namespace MyOrders.Pipelines
      {
       public class MyTranslateCommerceAddressProfileToEntity : TranslateCommerceAddressProfileToEntity
       {
           public MyTranslateCommerceAddressProfileToEntity() : base()
           {
           }
           ...
       }
      
    2. Override the method TranslateToCommercePartyCustomProperties and call base method.

      Example

      protected virtual void TranslateToCommercePartyCustomProperties(Profile origin, MercuryCommerceParty destination)
      {
       base.TranslateToCommercePartyCustomProperties(origin, destination);
      }
      
    3. Extend the translation of Commerce to Commerce Connect entity.

      Example

      protected virtual void TranslateToCommercePartyCustomProperties(Profile origin, MercuryCommerceParty destination)
      {
       base.TranslateToCommercePartyCustomProperties(origin, destination);
      
       var myCommerceParty = destination as MyCommerceParty;
      
       myCommerceParty.POBox = Get<string>(origin, "GeneralInfo.pobox");
      }
      
    4. Patch the Mercury.Commerce.Customers.config file. Replace the Mercury pipeline processor with the extended pipeline processor in the pipeline translate.commerceAddressProfileToEntity configuration.

      Example

      <sitecore>
       <pipelines>
         <translate.commerceAddressProfileToEntity>
           <processor 
               type="Mercury.Account.Sitecore.Pipelines.Customers.TranslateCommerceAddressProfileToEntity, Mercury.Account">
             <patch:delete/>
           </processor>
           <processor 
               type="MyOrders.Pipelines.MyTranslateCommerceAddressProfileToEntity, MyOrders">
           </processor>
         </translate.commerceAddressProfileToEntity>
       ...
      </sitecore>
      

    Extend the translation of Commerce Connect to Commerce

    1. Create a new pipeline processor that derives from the TranslateEntityToCommerceAddressProfile pipeline processor.

      Example

      namespace MyOrders.Pipelines
      {
       public class MyTranslateEntityToCommerceAddressProfile : TranslateEntityToCommerceAddressProfile
       {
           public MyTranslateEntityToCommerceAddressProfile() : base()
           {
           }
           ...
       }
      
    2. Override the method TranslateCommerceCustomerPartyCustomProperties and call base method.

      Example

      protected virtual void TranslateCommerceCustomerPartyCustomProperties(MercuryCommerceParty origin, Profile destination)
      {
       base.TranslateCommerceCustomerPartyCustomProperties(origin, destination);
      }
      
    3. Extend the translation of Commerce Connect to Commerce.

      Example

      protected virtual void TranslateCommerceCustomerPartyCustomProperties(MercuryCommerceParty origin, Profile destination)
      {
       base.TranslateCommerceCustomerPartyCustomProperties(origin, destination);
      
       var myCommerceParty = origin as MyCommerceParty;
      
       destination["GeneralInfo.pobox"].Value = origin.POBox;
      }
      
    4. Patch the Mercury.Commerce.Customers.config file. Replace the Mercury pipeline processor with the extended pipeline processor in the pipeline translate.entityToCommerceAddressProfile configuration.

      Example

      <sitecore>
       <pipelines>
         <translate.entityToCommerceAddressProfile>
           <processor 
               type="Mercury.Account.Sitecore.Pipelines.Customers.TranslateEntityToCommerceAddressProfile, Mercury.Account">
             <patch:delete/>
           </processor>
           <processor 
               type="MyOrders.Pipelines.MyTranslateEntityToCommerceAddressProfile, MyOrders">
           </processor>
         </translate.entityToCommerceAddressProfile>
       ...
      </sitecore>
      

    Extend the translation of Connect to View model

    More information will be added when translate pipeline is added to Mercury.

    Extend the translation of View model to Connect

    More information will be added when translate pipeline is added to Mercury.

    See also

    • Extend the address entity
    • Extend the order address
    Advanced
    • Improve this Doc
    Back to top Copyright © 2015-2018 Aviva Solutions
    Generated by DocFX