You are here

function uc_file_cart_item in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_file/uc_file.module \uc_file_cart_item()

Implementation of hook_cart_item().

File

uc_file/uc_file.module, line 182
Allows products to be associated with downloadable files.

Code

function uc_file_cart_item($op, &$item) {
  switch ($op) {
    case 'can_ship':
      $files = db_query("SELECT shippable, model FROM {uc_file_products} as fp INNER JOIN {uc_product_features} as pf ON pf.pfid = fp.pfid WHERE nid = %d", $item->nid);
      while ($file = db_fetch_object($files)) {
        $sku = empty($item->data['model']) ? $item->model : $item->data['model'];
        if ($sku == $file->model || empty($file->model)) {
          return $file->shippable ? TRUE : FALSE;
        }
      }
      break;
  }
}