You are here

public function OrderProductHasAttributeOption::orderedProductOptions in Ubercart 8.4

Returns an array of Attribute options.

Return value

array An array of attribute options names keyed by attribute aid.

File

uc_attribute/src/Plugin/Condition/OrderProductHasAttributeOption.php, line 82

Class

OrderProductHasAttributeOption
Provides 'Order has a product with a particular attribute option' condition.

Namespace

Drupal\uc_attribute\Plugin\Condition

Code

public function orderedProductOptions() {
  $options = [];
  $result = $this->database
    ->query("SELECT a.aid, a.name AS attr_name, a.ordering, o.oid, o.name AS opt_name, o.ordering FROM {uc_attributes} a JOIN {uc_attribute_options} o ON a.aid = o.aid ORDER BY a.ordering, o.ordering");
  foreach ($result as $option) {
    $options[$option->attr_name][$option->oid] = $option->opt_name;
  }
  return $options;
}