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 . 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 . 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
- 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
-
To export the contract to which you want to assign the price rule, issue the following URL
using the
storeId
andcontractId
: - Open the exported contract XML in an editor.
-
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>
-
Complete one of these steps, whichever one applies:
- If you found the lines of code in step 3, update the
priceRuleId_value
to thepriceRuleId
of the price rule you want to assign. - If you did not find the lines of code in step 3:
- Locate the
</BuyerContract>
element. - Above the
</BuyerContract>
element, paste the three lines of code from step 3. - Replace
priceRuleId_value
with thepriceRuleId
of the price rule you want to assign, for example,10001
.
- Locate the
- If you found the lines of code in step 3, update the
-
Search for the following string:
minorVersionNumber
-
Increase the value of
minorVersionNumber
by 1. - 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 apriceRuleExpiryDate
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 thepriceRuleExpiryDate
value. - The
priceRuleExpiryDate
value cannot be earlier than thecontractStartTime
value. - The
priceRuleExpiryDate
value cannot be earlier than thepriceRuleBeginDate
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).
- The price rule with ID
- Save and close the contract XML.
- Import the contract to by issuing the following URL: