diff --git a/commerce_coupon.info.inc b/commerce_coupon.info.inc index 18866a6..1043bc0 100644 --- a/commerce_coupon.info.inc +++ b/commerce_coupon.info.inc @@ -64,6 +64,7 @@ function commerce_coupon_entity_property_info() { 'label' => t('Times used'), 'description' => t('Number of times that the coupon has been used.'), 'setter callback' => 'entity_property_verbatim_set', + 'schema field' => 'times_used', ); // Add metadata anpit coupon type properties. diff --git a/includes/views/commerce_coupon.views.inc b/includes/views/commerce_coupon.views.inc index 01c9878..82bfdc7 100644 --- a/includes/views/commerce_coupon.views.inc +++ b/includes/views/commerce_coupon.views.inc @@ -24,14 +24,5 @@ function commerce_coupon_views_data_alter(&$data) { 'handler' => 'commerce_coupon_handler_field_coupon_granted_amount', ), ); - // Expose the number of times the coupon has been used. - $data['commerce_coupon']['times_used'] = array( - 'title' => t('Times used'), - 'help' => t('Number of times that the coupon has been used.'), - 'field' => array( - 'handler' => 'commerce_coupon_handler_field_times_used', - 'click sortable' => TRUE, - ), - ); } } diff --git a/includes/views/handlers/commerce_coupon_handler_field_times_used.inc b/includes/views/handlers/commerce_coupon_handler_field_times_used.inc deleted file mode 100644 index 5984177..0000000 --- a/includes/views/handlers/commerce_coupon_handler_field_times_used.inc +++ /dev/null @@ -1,21 +0,0 @@ -additional_fields['coupon_id'] = 'coupon_id'; - } - - function query() { - $this->ensure_my_table(); - $this->add_additional_fields(); - } - - function render($values) { - $coupon_id = $this->get_value($values, 'coupon_id'); - return commerce_coupon_get_number_of_uses($coupon_id); - } -}