uc_coupon_handler_field_product_type.inc 606 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * @file
  4. * Views handler for coupon applicable product type
  5. */
  6. /**
  7. * List the product types applicable to this coupon
  8. */
  9. class uc_coupon_handler_field_product_type extends views_handler_field_prerender_list {
  10. function pre_render($values) {
  11. $this->items = array();
  12. foreach ($values as $value) {
  13. $cid = $value->{$this->field_alias};
  14. $data = unserialize($value->{$this->aliases['data']});
  15. if (isset($data['product_types'])) {
  16. $this->items[$cid] = $data['product_types'];
  17. }
  18. else {
  19. $this->items[$cid] = array(t('Any'));
  20. }
  21. }
  22. }
  23. }