You are here

function uc_quote_taxonomy in Ubercart 5

Implementation of hook_taxonomy().

Save and delete manufacturer shipping locations.

File

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

Code

function uc_quote_taxonomy($op, $type, $object = null) {
  switch ($type) {
    case 'term':
      switch ($op) {
        case 'insert':
        case 'update':
          db_query("DELETE FROM {uc_quote_manufacturer_locations} WHERE tid = %d", $object['tid']);
          if ($object['street1']) {
            db_query("INSERT INTO {uc_quote_manufacturer_locations} (tid, first_name, last_name, company, street1, street2, city, zone, postal_code, country, phone) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', %d, '%s')", $object['tid'], $object['first_name'], $object['last_name'], $object['company'], $object['street1'], $object['street2'], $object['city'], $object['zone'], $object['postal_code'], $object['country'], $object['phone']);
          }
          uc_quote_set_shipping_type('manufacturer', $object['tid'], $object['shipping_type']);
          break;
        case 'delete':
          db_query("DELETE FROM {uc_quote_shipping_types} WHERE id_type = 'manufacturer' AND id = %d", $object['tid']);
          db_query("DELETE FROM {uc_quote_manufacturer_locations} WHERE tid = %d", $object['tid']);
          break;
      }
      break;
  }
}