You are here

function uc_file_cart_item in Ubercart 6.2

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

Implements hook_cart_item().

File

uc_file/uc_file.module, line 576

Code

function uc_file_cart_item($op, &$item) {
  switch ($op) {
    case 'can_ship':

      // Check if this model is shippable as well as a file (;/)
      $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)) {

        // If the model is 'any' then return.
        if (empty($file->model)) {
          return $file->shippable;
        }
        else {

          // Use the adjusted SKU, or node SKU if there's none.
          $sku = empty($item->data['model']) ? $item->model : $item->data['model'];
          if ($sku == $file->model) {
            return $file->shippable;
          }
        }
      }
      break;
  }
}