You are here

function uc_order_is_shippable in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_is_shippable()
  2. 7.3 uc_order/uc_order.module \uc_order_is_shippable()

An order can be shipped if any of its products can be shipped.

6 calls to uc_order_is_shippable()
uc_order-customer.tpl.php in uc_order/templates/uc_order-customer.tpl.php
This file is the default customer invoice template for Ubercart.
uc_order_condition_is_shippable in uc_order/uc_order.ca.inc
Check that the order is shippable.
uc_order_pane_ship_to in uc_order/uc_order.order_pane.inc
Handles the "Ship to" order pane.
uc_paypal_ec_review_form in payment/uc_paypal/uc_paypal.pages.inc
uc_paypal_wpp_charge in payment/uc_paypal/uc_paypal.module
Processes a credit card payment through Website Payments Pro.

... See full list

File

uc_order/uc_order.module, line 1572

Code

function uc_order_is_shippable($order) {
  if (!is_array($order->products) || empty($order->products)) {
    return FALSE;
  }
  foreach ($order->products as $product) {

    // Return FALSE if the product form specifies this as not shippable.
    if (empty($product->data['shippable'])) {
      $results[] = FALSE;
      continue;
    }

    // See if any other modules have a say in the matter...
    foreach (module_list() as $module) {
      $function = $module . '_cart_item';
      if (function_exists($function)) {

        // $product must be passed by reference to hook_cart_item.
        $can_ship = $function('can_ship', $product);
        if (!is_null($can_ship)) {
          $result[] = $can_ship;
        }
      }
    }

    // Return TRUE by default.
    if (empty($result) || in_array(TRUE, $result)) {
      $results[] = TRUE;
      continue;
    }
    $results[] = FALSE;
  }
  return in_array(TRUE, $results);
}