You are here

function uc_quote_get_default_shipping_address in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 shipping/uc_quote/uc_quote.module \uc_quote_get_default_shipping_address()
  2. 5 shipping/uc_quote/uc_quote.module \uc_quote_get_default_shipping_address()
  3. 6.2 shipping/uc_quote/uc_quote.module \uc_quote_get_default_shipping_address()

Gets a product's default shipping address.

Parameters

$nid: A product node id.

Return value

An address object containing the product's default shipping address, or the store's shipping address if the product's is not set.

3 calls to uc_quote_get_default_shipping_address()
uc_shipping_package_load in shipping/uc_shipping/uc_shipping.module
Loads a package and its products.
uc_ups_quote in shipping/uc_ups/uc_ups.module
Callback for retrieving a UPS shipping quote.
_uc_usps_package_products in shipping/uc_usps/uc_usps.module
Organizes products into packages for shipment.

File

shipping/uc_quote/uc_quote.module, line 436
The controller module for fulfillment modules that process physical goods.

Code

function uc_quote_get_default_shipping_address($nid) {
  $address = db_query("SELECT first_name, last_name, company, street1, street2, city, zone, postal_code, country, phone FROM {uc_quote_product_locations} WHERE nid = :nid", array(
    ':nid' => $nid,
  ))
    ->fetchObject('UcAddress');
  if (empty($address)) {
    $address = variable_get('uc_quote_store_default_address', new UcAddress());
  }
  return $address;
}