function uc_termsofservice_condition_product_class in Ubercart Terms of Service 6
Same name and namespace in other branches
- 7 uc_termsofservice.rules.inc \uc_termsofservice_condition_product_class()
 
Checks that an order has a product of the selected class.
See also
uc_termsofservice_condition_product_class_form()
2 string references to 'uc_termsofservice_condition_product_class'
- uc_termsofservice_ca_condition in ./
uc_termsofservice.ca.inc  - Implements hook_ca_condition().
 - uc_termsofservice_ca_predicate in ./
uc_termsofservice.ca.inc  - Implements hook_ca_predicate().
 
File
- ./
uc_termsofservice.ca.inc, line 80  - Conditional Actions hooks and functions for the terms of service panes.
 
Code
function uc_termsofservice_condition_product_class($cart, $settings) {
  foreach ($cart as $cart_item) {
    if ($cart_item->nid) {
      $type = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $cart_item->nid));
      if (in_array($type, array_values($settings['class']), TRUE)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}