123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <?php
- /**
- * @file
- * Views hooks for Ubercart products.
- */
- /**
- * Implements hook_views_data().
- */
- function uc_product_views_data() {
- $data['uc_products']['table']['group'] = t('Product');
- $data['uc_products']['table']['join'] = array(
- 'node' => array(
- 'left_field' => 'vid',
- 'field' => 'vid',
- ),
- 'node_revisions' => array(
- 'left_field' => 'vid',
- 'field' => 'vid',
- ),
- );
- $data['uc_products']['model'] = array(
- 'title' => t('SKU'),
- 'help' => t('The model number.'),
- 'field' => array(
- 'handler' => 'views_handler_field_node',
- 'click sortable' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_string',
- ),
- 'argument' => array(
- 'handler' => 'views_handler_argument_string',
- ),
- );
- $data['uc_products']['list_price'] = array(
- 'title' => t('List price'),
- 'help' => t("The manufacturer's suggested price."),
- 'field' => array(
- 'handler' => 'uc_product_handler_field_price',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- 'additional fields' => array(
- 'nid' => array(
- 'table' => 'node',
- 'field' => 'nid',
- ),
- ),
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- );
- $data['uc_products']['cost'] = array(
- 'title' => t('Cost'),
- 'help' => t('The cost of the product to the store.'),
- 'field' => array(
- 'handler' => 'uc_product_handler_field_price',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- 'additional fields' => array(
- 'nid' => array(
- 'table' => 'node',
- 'field' => 'nid',
- ),
- ),
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- );
- $data['uc_products']['sell_price'] = array(
- 'title' => t('Sell price'),
- 'help' => t('The price for which the product is sold.'),
- 'field' => array(
- 'handler' => 'uc_product_handler_field_price',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- 'additional fields' => array(
- 'nid' => array(
- 'table' => 'node',
- 'field' => 'nid',
- ),
- ),
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- );
- $data['uc_products']['display_price'] = array(
- 'title' => t('Display price'),
- 'help' => t('The price for which the product is sold, altered for display (e.g. with inclusive taxes).'),
- 'field' => array(
- 'handler' => 'uc_product_handler_field_display_price',
- 'real field' => 'nid',
- 'click sortable' => TRUE,
- ),
- );
- $data['uc_products']['weight'] = array(
- 'title' => t('Weight'),
- 'help' => t('The physical weight.'),
- 'field' => array(
- 'additional fields' => array(
- 'field' => 'weight_units',
- ),
- 'handler' => 'uc_product_handler_field_weight',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- );
- $data['uc_products']['length'] = array(
- 'title' => t('Length'),
- 'help' => t('The physical length.'),
- 'field' => array(
- 'additional fields' => array(
- 'field' => 'length_units',
- ),
- 'handler' => 'uc_product_handler_field_length',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_float',
- ),
- );
- $data['uc_products']['width'] = array(
- 'title' => t('Width'),
- 'help' => t('The physical width.'),
- 'field' => array(
- 'additional fields' => array(
- 'field' => 'length_units',
- ),
- 'handler' => 'uc_product_handler_field_length',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_float',
- ),
- );
- $data['uc_products']['height'] = array(
- 'title' => t('Height'),
- 'help' => t('The physical height.'),
- 'field' => array(
- 'additional fields' => array(
- 'field' => 'length_units',
- ),
- 'handler' => 'uc_product_handler_field_length',
- 'click sortable' => TRUE,
- 'float' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_float',
- ),
- );
- $data['uc_products']['pkg_qty'] = array(
- 'title' => t('Package quantity'),
- 'help' => t('The number of items that fit in the largest package.'),
- 'field' => array(
- 'handler' => 'views_handler_field_numeric',
- 'click sortable' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- );
- $data['uc_products']['ordering'] = array(
- 'title' => t('List position'),
- 'help' => t('The default sort criteria in the catalog.'),
- 'field' => array(
- 'help' => t("The product list position."),
- 'handler' => 'views_handler_field_numeric',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
- $data['uc_products']['shippable'] = array(
- 'title' => t('Shippable'),
- 'help' => t('Is the product shippable?'),
- 'field' => array(
- 'handler' => 'views_handler_field_boolean',
- 'click sortable' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_boolean_operator',
- ),
- );
- $data['uc_products']['is_product'] = array(
- 'title' => t('Is a product'),
- 'help' => t('Check for the fields provided by the Ubercart product module.'),
- 'group' => t('Node'),
- 'filter' => array(
- 'handler' => 'uc_product_handler_filter_product',
- 'label' => t('Is a product'),
- ),
- );
- $data['uc_products']['addtocartlink'] = array(
- 'title' => t('Add to cart form'),
- 'help' => t("Form to put the product in the customer's cart."),
- 'group' => t('Product'),
- 'field' => array(
- 'additional fields' => array(
- 'nid' => array(
- 'table' => 'node',
- 'field' => 'nid',
- ),
- 'type' => array(
- 'table' => 'node',
- 'field' => 'type',
- ),
- ),
- 'handler' => 'uc_product_handler_field_addtocart',
- 'element type' => 'div',
- ),
- );
- $data['uc_products']['buyitnowbutton'] = array(
- 'title' => t('Buy it now button'),
- 'help' => t('A button to add a product to the cart without quantity or attribute fields.'),
- 'group' => t('Product'),
- 'field' => array(
- 'table' => 'node',
- 'additional fields' => array(
- 'nid' => array(
- 'table' => 'node',
- 'field' => 'nid',
- ),
- ),
- 'handler' => 'uc_product_handler_field_buyitnow',
- 'element type' => 'div',
- ),
- );
- return $data;
- }
|