function commerce_registration_order_product_types_allowed in Commerce Registration 7
Condition callback.
Checks the commerce order to see if the line items have products that are in the allowed products list.
Parameters
$order: The Commerce Order whose line items will be reviewed.
$types: Array of machine names of allowed product types.
Return value
Boolean FALSE if any product type is not in the allowed products list.
Related topics
1 string reference to 'commerce_registration_order_product_types_allowed'
File
- ./
commerce_registration.rules.inc, line 311 - Commerce Registration rules file.
Code
function commerce_registration_order_product_types_allowed($order, $types) {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
$type = $line_item_wrapper->commerce_product->type
->value();
if (!in_array($type, $types)) {
return FALSE;
}
}
return TRUE;
}