Have enabled the coupon, coupon_ui and the basic_coupon modules.

Am required to flush the cache for the system to recognize that a coupon type has been created. This is true even for the basic_coupon that ships with the module.

CommentFileSizeAuthor
#5 commerce_coupon-cache-1191280-5.patch553 bytesimiksu

Comments

essbee’s picture

Title: Module states have not created any coupon types despite coupontypes being there » Cache flush required for module to pick up coupon types
imiksu’s picture

Confirmed. Same here..

liupascal’s picture

Subscribing

imiksu’s picture

To fix the problem, go edit your commerce_coupon.module file and change

62   $return['commerce_coupon_type'] = array(
63     'label' => t('Commerce Coupon Type'),
64     'entity class' => 'CommerceCouponType',
65  -  'controller class' => 'EntityAPIController',
66     'base table' => 'commerce_coupon_type',
67     'fieldable' => FALSE,

to

62   $return['commerce_coupon_type'] = array(
63     'label' => t('Commerce Coupon Type'),
64     'entity class' => 'CommerceCouponType',
65  +  'controller class' => 'EntityAPIControllerExportable',
66     'base table' => 'commerce_coupon_type',
67     'fieldable' => FALSE,

This change needs to be done when using Entity API version beta9, which included some API changes as described in http://drupal.org/node/1027908#comment-4610318

This might solve more issues than just this one.

I'll post a patch for this later..

imiksu’s picture

StatusFileSize
new553 bytes

Here you go. Use this patch if you're using commerce coupon with Entity API 1.0-beta9.

imiksu’s picture

Status: Active » Needs review
liupascal’s picture

Manually modified the .module file (as the change was simple) and it looks to work fine. It looks like it also fixes #1195476: Cannot create new coupon.
@iMiksu: does all the modules need to change from EntityAPIController to EntityAPIControllerExportable ?

imiksu’s picture

According to fago's comment:

Modules using the 'exportable' feature or a 'name' key have to use this one now.

In our case we're using entity key 'name', so we're required to use that entity controller class.

bojanz’s picture

Status: Needs review » Fixed

This is fixed in latest -dev.

hunziker’s picture

Status: Fixed » Closed (fixed)

I close this issue. If the problem occurs again, you're welcome to reopen it.