If your sites use time-based pricing, a price list may have multiple prices for a given product or SKU, with the active price differing depending on when the item is purchased. For example, a product may sell for $100.00 until December 25, and then sell for $50.00 after that.
To control which price values appear in indexed records, the ActivePriceCalculator
class enables you to specify a time in the future to use as the effective time for determining prices. For instance, in the example mentioned above, if you run an indexing job on December 24 that uses an effective time of noon on December 26 for pricing, the record generated for the product will include a price value of $50.00.
You can specify the effective time for determining prices either as an explicit time or as an offset from the indexing start time. The /atg/search/repository/BulkLoader
and /atg/search/repository/IncrementalLoader
components determine the time when an indexing job is started, and store this value in the atg.repository.search.indexing.Context
object. The effective time for determining prices is calculated relative to this indexing start time. The indexing start time remains unchanged throughout the entire indexing job, to ensure that the prices in all of the generated records reflect the same effective time, regardless of how long the indexing job takes.
ActivePriceCalculator
provides two properties for specifying the effective time for determining the prices in an indexing job:
indexingTimeOffsetInHours
Specifies the effective time as a number of hours after the time when the indexing job is started. For example, if the value of this property is 53.5, the effective time for pricing will be two days plus five and a half hours later than the start time of the indexing job.
indexingTimeCalendarString
Specifies the effective time for pricing as an explicit time (for example, January 6, 2056, at 3:00 am) or series of times (for example, the 1st and 15th of each month, at 5:00 pm). The value of this property is a string that uses theCalendarSchedule
syntax described in the Scheduler Services section of the Platform Programming Guide. For example, the following specifies the effective times as the 1st and 15th of each month, at 3:05 pm:indexingTimeCalendarString=* 1,15 . . 15 5
Note that if indexingTimeCalendarString
is set to a series of times, the effective time used for pricing for an individual indexing job is the first time in the series after the indexing start time. For example, if you use the indexingTimeCalendarString
value above and you start an indexing job on the 8th of a month, the effective time will be the 15th of that month at 3:05 pm. If you start an indexing job on the 16th of a month, the effective time will be the 1st of the following month at 3:05 pm.
The indexingTimeOffsetInHours
and indexingTimeCalendarString
properties are mutually exclusive. If both properties are set, the value of indexingTimeCalendarString
is used, and indexingTimeOffsetInHours
is ignored. If neither property is set, the indexing start time is used as the effective time for determining prices.
For more information about time-based pricing, see the Core Commerce Programming Guide.