You are here

function uc_coupon_purchase_entity_property_info_alter in Ubercart Discount Coupons 7.3

File

uc_coupon_purchase/uc_coupon_purchase.module, line 572

Code

function uc_coupon_purchase_entity_property_info_alter(&$info) {
  $r = db_query('SELECT name, label from {uc_attributes}');
  foreach ($r as $row) {
    $entry = array(
      'type' => 'text',
      'label' => $row->name,
      // Use the name, because the label can differ among products.
      'description' => $row->label,
      'getter callback' => 'uc_coupon_purchase_attribute_property_getter',
    );
    foreach (array(
      'uc_order_product',
      'uc_cart_item',
    ) as $type) {
      if (isset($info[$type]) && !isset($info[$type]['properties'][$row->name])) {
        $info[$type]['properties'][$row->name] = $entry;
      }
    }
  }
}