You are here

function uc_roles_cart_item in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_roles/uc_roles.module \uc_roles_cart_item()

Implementation of hook_cart_item().

File

uc_roles/uc_roles.module, line 299
Grants roles upon accepted payment of products

Code

function uc_roles_cart_item($op, &$item) {
  switch ($op) {
    case 'can_ship':
      $roles = db_query("SELECT * FROM {uc_roles_products} WHERE nid = %d", $item->nid);
      while ($role = db_fetch_object($roles)) {
        $sku = empty($item->data['model']) ? $item->model : $item->data['model'];
        if ($sku == $role->model || empty($role->model)) {
          return $role->shippable ? TRUE : FALSE;
        }
      }
      break;
  }
}