Recuperar el XML de tiempo de ejecución para un tipo de promoción

Puede recuperar de la base de datos el XML de tiempo de ejecución para cualquier promoción activa de la tienda. Si crea un tipo de promoción personalizado, puede utilizar el XML de tiempo de ejecución de un tipo de promoción existente como modelo para diseñar el XML para el nuevo tipo.

Por qué y cuándo se efectúa esta tarea

Los ejemplos de XML De promoción de tiempo de ejecución pueden proporcionar un punto de partida para crear tipos de promoción personalizados para la tienda. Utilice el XML de promoción de tiempo de ejecución para un tipo de promoción parecido al tipo de promoción personalizado que está creando. Puede recuperar el XML de promoción de tiempo de ejecución para una promoción existente de la base de datos. El XML de promoción de tiempo de ejecución se almacena en la columna XMLPARAM de la tabla de base de datos PX_PROMOTION. Asegúrese de elegir una promoción que ya esté activada. Hasta que se activa una promoción creada en el Centro de gestión, en la columna XMLPARAM sólo se almacena XML marcador de posición, que se visualiza como PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.AlwaysFalsePurchaseCondition".

Para extraer el XML de tiempo de ejecución para un tipo de promoción predeterminado, siga estos pasos:

Procedimiento

  1. Open the Promotions tool.
  2. Cree una promoción basada en un tipo de promoción existente. Seleccione un tipo de promoción que sea similar al tipo de promoción personalizado que desea crear.
    Para obtener más información sobre cómo crear una promoción, consulte Crear promociones
  3. Active la nueva promoción. Al activar la promoción se genera el XML de tiempo de ejecución de la promoción. Para obtener más información sobre cómo activar una promoción, consulte Activar o desactivar promociones.
  4. En la vista del explorador, pulse el directorio de promociones. Se mostrará la lista de promociones disponibles en el área de trabajo principal. En la tabla de la vista de lista de promociones, configure las columnas para visualizar la columna de ID exclusivo. Anote el ID exclusivo para el tipo de promoción que ha creado.
    Para obtener más información sobre cómo visualizar las columnas ocultas, consulte Utilizar vistas de tabla.
  5. Abra una conexión de base de datos.
  6. Ejecute la consulta siguiente para recuperar el XML de tiempo de ejecución para la promoción.
    Select XMLPARAM from PX_PROMOTION where PX_PROMOTION_ID=yourPromotionUniqueId

    Donde yourPromotionUniqueId es el ID que ha anotado en el paso 3. El resultado de la consulta devuelve el XML de tiempo de ejecución para la promoción. Por ejemplo, el código de ejemplo siguiente es el XML de tiempo de ejecución para una promoción que ofrece un regalo para pedidos de más de 2000 dólares:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <!-- This promotion does the following: Purchase over $2000 USD, receive free gift. -->
    
    <Promotion impl="com.ibm.commerce.marketing.promotion.DefaultPromotion">
    
      <!-- this identifies the promotion -->
      
      <PromotionKey>
        
        <-- Name of the promotion -->
        
        <PromotionName>Free gift with selected orders</PromotionName>
        
        <!-- The store that owns this promotion. Store key is defined as the combination of the 
             DN of the organization that owns this store and a store name --> 
        <StoreKey>
          <DN>ou=elite,o=seller organization,o=root organization</DN>
          <Identifier>Elite</Identifier>
        </StoreKey>
        
        <!-- Versions of a promotion. Statistics are associated with the
             version number,promotions with the same promotion key and version 
             number but different revision are considered different revisions of
             the same promotion.  Promotions with the same key but different 
             version numbers are considered distinct promotions. -->
        
        <Version>1</Version>
        <Revision>3</Revision>
      </PromotionKey>
      
      <!-- Promotions are group by groups, and groups are scoped by store, 
           refer to promotion organization for details on what a group is, its role 
           and the default groups -->
      
      <PromotionGroupKey>
        <GroupName>OrderLevelPromotion</GroupName>
        <StoreKey>
          <DN>ou=elite,o=seller organization,o=root organization</DN>
          <Identifier>Elite</Identifier>
        </StoreKey>
      </PromotionGroupKey>
      
      <!-- Various descriptions of the promotion -->
      
      <TypedNLDescription impl="com.ibm.commerce.marketing.promotion.TypedNLDescription">
        <DefaultLocale>en_US</DefaultLocale>
        <Description locale="en_US" type="admin">Order Discount - Free Gift with orders over $2000 USD</Description>
        <Description locale="en_US" type="long">Spend over $2000 USD and get a free passenger vehicle battery.</Description>
        <Description locale="en_US" type="short">Spend over $2000 USD and get a free gift!</Description>
      </TypedNLDescription>
      
      <!-- Priority of the promotion the higher the more important
      
      <Priority>250</Priority>
      
      <-- Exclusiveness of the promotion. Possible values are:  
          0: not exclusive at all 
          1: exclusive at the group level 
          2: exclusive at a global level 
          3: a backward compatibility mode that mimics the combinability 
             of order level promotions with product level promotions in 
             previous releases 
          4: This promotion can be stacked on top of other promotions in the same promotion group
      -->
          
      <Exclusive>0</Exclusive>
      
      <!-- For future use, always empty for now -->
      
      <ExemptPolicyList/>
      
      <!-- For future use, always empty for now -->
      
      <ExplicitlyAppliedPolicyList/>
      
      <!-- Status of the promotion: 
           0: inactive
           1: active
           2: deleted
           3: suspended 
           4: obsolete
      -->
      
      <Status>1</Status>
      
      <!-- Audit trail, last update time and last person who updated the promotion -->
      <LastUpdate>18-06-2011 15:53:46</LastUpdate>
      <LastUpdateBy>
        <CustomerKey>
          <LogonId>wcsadmin</LogonId>
        </CustomerKey>
      </LastUpdateBy>
      
      <!-- How many times this promotion can be applied to the current order, 
           possible values are:  
           -1:              unlimited
           positive number: the limit 
      -->
      
      <PerOrderLimit>-1</PerOrderLimit>
      
      <!--How many times this promotion can be applied to a shopper, 
          possible values are:  
          -1:              unlimited,
          positive number: the limit 
      
          This value is only valid for a registered shopper, for none registered 
          shoppers there is no way to control how many times a shopper can redeem a 
          promotion. 
      -->
      
      <PerShopperLimit>1</PerShopperLimit>
      
      <!-- How many times this promotion can be redeemed overall.
           Possible values are:
           -1:              unlimited,
           positive number: the limit 
      -->
      <ApplicationLimit>-1</ApplicationLimit>
      
      <TargetSales>0.00000</TargetSales>
      <CorrespondingRBDTypeName>OrderLevelFreeGift</CorrespondingRBDTypeName>
      
      <!-- Schedule information of this promotion -->
      
      <Schedule impl="com.ibm.commerce.marketing.promotion.schedule.PromotionSchedule">
        <DateRange impl="com.ibm.commerce.marketing.promotion.schedule.DateRangeSchedule">
          <Start inclusive="true">01-01-2004 12:00:00</Start>
          <End inclusive="true">31-12-9999 12:00:00</End>
        </DateRange>
        <TimeWithinADay impl="com.ibm.commerce.marketing.promotion.schedule.TimeRangeWithinADaySchedule">
          <Start inclusive="true">00:00:00</Start>
          <End inclusive="true">23:59:59</End>
        </TimeWithinADay>
        <Week impl="com.ibm.commerce.marketing.promotion.schedule.WeekDaySchedule">
          <WeekDay>SUNDAY</WeekDay>
          <WeekDay>MONDAY</WeekDay>
          <WeekDay>TUESDAY</WeekDay>
          <WeekDay>WEDNESDAY</WeekDay>
          <WeekDay>THURSDAY</WeekDay>
          <WeekDay>FRIDAY</WeekDay>
          <WeekDay>SATURDAY</WeekDay>
        </Week>
      </Schedule>
      
      <!-- Type of promotion:
          0: targeted
          1: private, that is, a coupon promotion 
      -->
      <PromotionType>0</PromotionType>
      
      <!-- Whether a code is required to redeem this promotion. -->
      
      <PromotionCodeRequired>false</PromotionCodeRequired>
      
      <!-- When a promotion code is entered, should the target condition be checked -->
      
      <SkipTargetingConditionOnProperPromotionCodeEntered>false</SkipTargetingConditionOnProperPromotionCodeEntered>
      
      <!-- Check the target condition or not -->
      
      <CheckTargetingConditionAtRuntime>true</CheckTargetingConditionAtRuntime>
      
      <!-- Do not change this element -->
      
      <PromotionCodeCondition impl="com.ibm.commerce.marketing.promotion.condition.PromotionCodeCondition"/>
      
      <!-- Targeting condition --> 
      
      <Targeting impl="com.ibm.commerce.marketing.promotion.condition.TargetingCondition">
      </Targeting>
      
      <!-- Custom condition for the promotion can be added here -->
      
      <CustomConditions/>
      
      <!-- This is core of a promotion definition -->
      
      <PurchaseCondition impl="com.ibm.commerce.marketing.promotion.condition.PurchaseCondition">
        
        <!-- Matches the pattern targeted by the current promotion: the following 
             pattern matches the entire order, for details refer to the promotion 
             purchase condition model document 
        -->
        
        <Pattern impl="com.ibm.commerce.marketing.promotion.condition.Pattern">
          
          <!-- A pattern is made up of multiple constraint, each specifying a 
               list of items that make up part of the pattern. There must be no 
               cross-sections between constraints 
          -->
          
          <UniqueConstraints>false</UniqueConstraints>
          <Constraint impl="com.ibm.commerce.marketing.promotion.condition.Constraint">
            
            <!-- Quantity requirement of this constraint -->
            
            <WeightedRange impl="com.ibm.commerce.marketing.promotion.condition.WeightedRange">
              
              <!-- minimum number of item is 1 -->
              
              <LowerBound>1</LowerBound>
              
              <!--  Maximum number of item is not limited  -->
              
              <UpperBound>-1</UpperBound>
              
              <-- Match as many as items that satisfy the criteria defined in the filter chain next
              
              <Weight>1</Weight>
            </WeightedRange>
            
            <!-- Selection criteria -->    
            
            <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
              
              <!-- Multiple filters can be specified, the are applied in a contiguous fashion, 
                   that is, connected using a logical "and". The dummy filter returns anything 
                   passed to it, it effectively selects anything 
              -->
              
              <Filter impl="com.ibm.commerce.marketing.promotion.condition.DummyFilter"/>
            </FilterChain>
            
            <!-- The combination of the quantity requirement and the filter chain would return 
                 everything present in the shopcart as one big matched pattern 
            -->   
          </Constraint>
        </Pattern>
        
        <!-- Once pattern is matched, rewards are assigned, for details refer to the 
             purchase condition model document 
        -->
        
        <Distribution impl="com.ibm.commerce.marketing.promotion.reward.Distribution">
          
          <!-- A volume based distribution on the spending total is performed, 
               spending total is measure in USD -->
          
          <Type>Volume</Type>
          <Base>Cost</Base>
          <Currency>USD</Currency>
          
          <!-- First range 2000 <= spending -->
          
          <Range impl="com.ibm.commerce.marketing.promotion.reward.DistributionRange">
            <UpperBound>-1</UpperBound>
            <LowerBound>2000</LowerBound>
            <UpperBoundIncluded>false</UpperBoundIncluded>
            <LowerBoundIncluded>true</LowerBoundIncluded>
            
            
            <RewardChoice>
                
                <!-- This reward, if the spending total of ALL matched patterns falls into the range of over 2000 -->
                
              <Reward impl="com.ibm.commerce.marketing.promotion.reward.DefaultReward">
                <AdjustmentFunction impl="com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction">
                  
                  <!--  Reward can be associated with a sub set of the items that make up the pattern,
                        the input of this filter chain will be one matched pattern, and a sub set of 
                        items that make up that pattern is returned and adjustments are associated with 
                        the returned items also known as affected items
                  -->
                  <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
                    <Filter impl="com.ibm.commerce.marketing.promotion.condition.DummyFilter"/>
                  </FilterChain>
                  
                  <!--  the adjustment  -->
                  <Adjustment impl="com.ibm.commerce.marketing.promotion.reward.DefaultChoiceOfFreeGiftAdjustment">
                    <RewardSpecification impl="com.ibm.commerce.marketing.promotion.choice.gift.FreeGiftSpecification">
                      <MaxQuantity>1</MaxQuantity>
                      <GiftItem impl="com.ibm.commerce.marketing.promotion.choice.gift.CatalogEntryGiftItem"> 
                        <Quantity>1</Quantity>
                        <CatalogEntryKey>
                          <SKU>A0000736</SKU>
                          <DN>ou=elite,o=seller organization,o=root organization</DN>
                        </CatalogEntryKey>
                      </GiftItem>
                    </RewardSpecification>
                    <RewardChoice impl="com.ibm.commerce.marketing.promotion.choice.gift.FreeGiftChoice">
                      <GiftItem impl="com.ibm.commerce.marketing.promotion.choice.gift.CatalogEntryGiftItem">
                        <Quantity>1</Quantity>
                        <CatalogEntryKey>
                          <SKU>A0000736</SKU>
                          <DN>ou=elite,o=seller organization,o=root organization</DN>
                        </CatalogEntryKey>
                      </GiftItem>
                    </RewardChoice>
                    
                    <!-- This adjustment is applied to the entire order, 
                         possible values are: (case insentitive)
                         wholeOrder:  The entire order, that is, $15 dollars off 
                                      an entire order
                         AllAffectedItems: Affected items returned by the filter 
                                       chain defined above, that is, $15  dollars 
                                       off all of the affected items as a whole.
                         IndividualAffectedItems: Adjustments are applied to 
                                       affected items individually, that is, $15 
                                       dollars off each and every affected item.
                    -->
                    <AdjustmentType>AllAffectedItems</AdjustmentType>
                  </Adjustment>
                </AdjustmentFunction>
                <RewardPolicy>ALL</RewardPolicy>
              </Reward>
            </RewardChoice>
          </Range>
          <PatternFilter impl="com.ibm.commerce.marketing.promotion.condition.DummyPatternFilter"/>
        </Distribution>
      </PurchaseCondition>
    </Promotion>
  7. Copie los datos del resultado y péguelos en un documento. Guarde este documento como documento XML. Puede obtener una vista previa de este documento en un navegador web para facilitar la lectura.