HCL Commerce Enterprise

Assigning a price rule by modifying the contract XML

The storefront asset store base for default contract of a B2C store is not viewable in HCL Commerce Accelerator. For this reason, you must edit the contract XML when you want to change the name of the assigned price rule. You can use this procedure to assign price rules to other types of contracts if you do not want to use HCL Commerce Accelerator. You can also use this procedure to set start and expiry dates for price rules, or to assign multiple price rules during different time frames.

You might need a site administrator to assist you with this task because it involves querying database tables and editing XML files.

Before you begin

Query the HCL Commerce database to obtain the following values for the price rule and contract:
priceRuleId
The ID for the price rule you want to assign. The price rule must belong to either the store that the contract belongs to or the related storefront asset store (for an extended site).
To find the priceRuleId, run the following SQL statement:
select * from pricerule;
storeId
The ID for the store to which the contract belongs.
To find the storeId, run the following SQL statement:
select * from storeent;
contractId
The ID for the contract you want to export.
To find the contractId, run the following SQL statement:
select * from contract;

Procedure

  1. To export the contract to which you want to assign the price rule, issue the following URL using the storeId and contractId:
  2. Open the exported contract XML in an editor.
  3. To determine whether the contract already has a price rule assigned, search for lines of code similar to the following example:
    <TermCondition type = "PriceRuleTC" mandatory = "false" changeable = "false">
         <Property name = "priceRuleId" value = "priceRuleId_value"/>
    </TermCondition>
  4. Complete one of these steps, whichever one applies:
    • If you found the lines of code in step 3, update the priceRuleId_value to the priceRuleId of the price rule you want to assign.
    • If you did not find the lines of code in step 3:
      1. Locate the </BuyerContract> element.
      2. Above the </BuyerContract> element, paste the three lines of code from step 3.
      3. Replace priceRuleId_value with the priceRuleId of the price rule you want to assign, for example, 10001.
  5. Search for the following string:

    minorVersionNumber

  6. Increase the value of minorVersionNumber by 1.
  7. Optional: You can assign start and expiry dates to price rules when you edit the contract XML. To do so, add a priceRuleBeginDate property, or a priceRuleExpiryDate property, or both, within the price rule <TermCondition> XML, as shown in this example:
    <TermCondition type = "PriceRuleTC" mandatory = "false" changeable = "false">
        <Property name = "priceRuleId"  value = "11111" />
        <Property name = "priceRuleBeginDate"  value = "2010-12-01 00:00:00.0" />
        <Property name = "priceRuleExpiryDate"  value = "2010-12-31 00:00:00.0" />
    </TermCondition>
    

    You can also assign multiple price rules to the same contract by specifying start and expiry dates. Keep in mind that only one price rule can be valid in a contract at a time, so the time frames you specify must not overlap. Here is an example that uses this technique correctly to assign three different price rules during different time frames:

    <TermCondition type = "PriceRuleTC" mandatory = "false" changeable = "false">
        <Property name = "priceRuleId"  value = "11111" />
        <Property name = "priceRuleExpiryDate"  value = "2011-01-01 00:00:00.0" />
    </TermCondition>
    <TermCondition type = "PriceRuleTC" mandatory = "false" changeable = "false">
        <Property name = "priceRuleId"  value = "22222" />
        <Property name = "priceRuleBeginDate"  value = "2011-01-01 00:00:00.0" />
        <Property name = "priceRuleExpiryDate"  value = "2011-02-01 00:00:00.0" />
    </TermCondition>
    <TermCondition type = "PriceRuleTC" mandatory = "false" changeable = "false">
        <Property name = "priceRuleId"  value = "33333" />
        <Property name = "priceRuleBeginDate"  value = "2011-02-01 00:00:00.0" />
    </TermCondition>

    In the previous example XML:

    • The price rule with ID "11111" expires on January 1, 2011.
    • The price rule with ID "22222" starts on January 1, 2011 and expires on February 1, 2011.
    • The price rule with ID "33333" starts on February 1, 2011 and has no expiry date set.
    Make sure your XML code meets following requirements or you will be unable to import the contract:
    • The priceRuleBeginDate value cannot be later than the priceRuleExpiryDate value.
    • The priceRuleExpiryDate value cannot be earlier than the contractStartTime value.
    • The priceRuleExpiryDate value cannot be earlier than the priceRuleBeginDate value.
    • The price rule cannot be expired, that is, the priceRuleExpiryDate value cannot be later than the current time.
    • If you specify more than one price rule, as shown in the previous example, the time frames you specify must not overlap. You can leave gaps between time frames; however, if you do, no pricing information is displayed and the customer cannot purchase the catalog entries (unless the contract inherits a price rule from another contract during the gap).
  8. Save and close the contract XML.
  9. Import the contract to HCL Commerce by issuing the following URL:

Results

The price rule is now assigned to the contract. Customers entitled to the contract see prices from the price rule on the storefront.