You are here

function uc_usps_node_update in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 shipping/uc_usps/uc_usps.module \uc_usps_node_update()

Implements hook_node_update().

1 call to uc_usps_node_update()
uc_usps_node_insert in shipping/uc_usps/uc_usps.module
Implements hook_node_insert().

File

shipping/uc_usps/uc_usps.module, line 61
United States Postal Service (USPS) shipping quote module.

Code

function uc_usps_node_update($node) {
  if (uc_product_is_product($node)) {
    if (isset($node->usps)) {
      $usps_values = $node->usps;
      $connection = \Drupal::database();
      if (!$node
        ->isNewRevision()) {
        $connection
          ->delete('uc_usps_products')
          ->condition('vid', $node
          ->getRevisionId())
          ->execute();
      }
      $connection
        ->insert('uc_usps_products')
        ->fields([
        'vid' => $node
          ->getRevisionId(),
        'nid' => $node
          ->id(),
        'container' => $usps_values['container'],
      ])
        ->execute();
    }
  }
}