You are here

function hook_commerce_product_valid_pre_calculation_rule in Commerce Core 7

Lets modules invalidate a particular rule configuration during the sell price pre-calculation process.

Because the price table can very quickly accumulate millions of rows on complex websites, it is advantageous to prevent any unnecessary rule configurations from the pre-calculation process. Each additional rule configuration exponentially increases the amount of rows necessary for each product whose sell price is pre-calculated.

This hook allows modules to prevent pre-calculation for individual rule configurations, which is especially useful when it is known that certain rule configurations will never affect the prices of products featured in Views or other displays that sort or filter based on a calculated price.

Parameters

$rule: A rule configuration belonging to the commerce_product_calculate_sell_price event.

Return value

TRUE or FALSE indicating whether or not the rule configuration is valid.

See also

hook_commerce_product_valid_pre_calculation_product()

1 function implements hook_commerce_product_valid_pre_calculation_rule()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_product_pricing_ui_commerce_product_valid_pre_calculation_rule in modules/product_pricing/commerce_product_pricing_ui.module
Implements hook_commerce_product_valid_pre_calculation_rule().
1 invocation of hook_commerce_product_valid_pre_calculation_rule()
commerce_product_valid_pre_calculation_rule in modules/product_pricing/commerce_product_pricing.module
Determines if a given rule configuration meets the requirements for price pre-calculation.

File

modules/product_pricing/commerce_product_pricing.api.php, line 59
Hooks provided by the Product Pricing module.

Code

function hook_commerce_product_valid_pre_calculation_rule($rule) {

  // TODO: Use the implementation specced in http://drupal.org/node/1020976 as
  // an example here.
}