You are here

function uc_attribute_node_update_index in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 uc_attribute/uc_attribute.module \uc_attribute_node_update_index()

Implements hook_node_update_index().

File

uc_attribute/uc_attribute.module, line 264
Ubercart Attribute module.

Code

function uc_attribute_node_update_index($node) {
  $output = '';
  $attributes = uc_product_get_attributes($node
    ->id());
  foreach ($attributes as $attribute) {
    $output .= '<h3>' . _uc_attribute_get_name($attribute) . '</h3>';
    foreach ($attribute->options as $option) {
      $output .= $option->name . ' ';
    }
    $output .= "\n";
  }
  $connection = \Drupal::database();
  $result = $connection
    ->query("SELECT model FROM {uc_product_adjustments} WHERE nid = :nid", [
    ':nid' => $node
      ->id(),
  ]);
  while ($model = $result
    ->fetchField()) {
    $output .= '<h2>' . $model . "</h2>\n";
  }
  return $output;
}