You are here

function uc_product_node_type_update in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_product/uc_product.module \uc_product_node_type_update()

Implements hook_node_type_update().

Ensure product class names and descriptions are synchronised if the content type is updated.

File

uc_product/uc_product.module, line 270
The product module for Ubercart.

Code

function uc_product_node_type_update($info) {
  $existing_type = !empty($info->old_type) ? $info->old_type : $info->type;
  db_update('uc_product_classes')
    ->fields(array(
    'pcid' => $info->type,
    'name' => $info->name,
    'description' => $info->description,
  ))
    ->condition('pcid', $existing_type)
    ->execute();

  // Reset static variable data and load new info.
  uc_product_node_info(TRUE);
}