commerce_price_handler_filter_commerce_price_amount.inc in Commerce Core 7
File
modules/price/includes/views/handlers/commerce_price_handler_filter_commerce_price_amount.inc
View source
<?php
class commerce_price_handler_filter_commerce_price_amount extends views_handler_filter_numeric {
function operators() {
$operators = parent::operators();
unset($operators['regular_expression']);
return $operators;
}
function option_definition() {
$options = parent::option_definition();
$options['currency'] = array(
'default' => commerce_default_currency(),
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['currency'] = array(
'#type' => 'select',
'#title' => t('Currency'),
'#description' => t('Pick a currency to use for this filter.'),
'#options' => commerce_currency_code_options_list(),
'#default_value' => $this->options['currency'],
);
}
function query() {
foreach ($this->value as $key => $value) {
if ($value) {
$this->value[$key] = commerce_currency_decimal_to_amount($value, $this->options['currency']);
}
}
parent::query();
}
}