Hi there - very useful module, I was using the previous version which seemed to work ok. I have now updated to a more recent commerce discount (7.x-1.0-alpha3, also tried latest dev) and want to use the 7.x-2 coupon version as it integrates with discounts.

I cannot get the coupons to work for anonymous users - I get "Unable to redeem this code." error message.

I checked the permissions for coupons and noticed that anonymous did not have "redeem any coupon" or "redeem any discount coupon coupon" so I tried to set these but they cannot be set? Again no error message but when I go back to check permissions they are not set.

If I try the coupon as logged in admin user I get this:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'commerce_line_item-367-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_commerce_unit_price} (entity_type, entity_id, revision_id, bundle, delta, language, commerce_unit_price_amount, commerce_unit_price_currency_code, commerce_unit_price_data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => commerce_line_item [:db_insert_placeholder_1] => 367 [:db_insert_placeholder_2] => 367 [:db_insert_placeholder_3] => shipping [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 390 [:db_insert_placeholder_7] => GBP [:db_insert_placeholder_8] => a:1:{s:10:"components";a:4:{i:0;a:3:{s:4:"name";s:28:"flat_rate_domestic_1st_class";s:5:"price";a:3:{s:6:"amount";d:0;s:13:"currency_code";s:3:"GBP";s:4:"data";a:0:{}}s:8:"included";b:1;}i:1;a:3:{s:4:"name";s:7:"tax|vat";s:5:"price";a:3:{s:6:"amount";d:0;s:13:"currency_code";s:3:"GBP";s:4:"data";a:1:{s:8:"tax_rate";a:12:{s:4:"name";s:3:"vat";s:13:"display_title";s:3:"VAT";s:11:"description";s:0:"";s:4:"rate";s:4:"0.20";s:4:"type";s:3:"vat";s:15:"rules_component";s:21:"commerce_tax_rate_vat";s:23:"default_rules_component";s:1:"1";s:15:"price_component";s:7:"tax|vat";s:20:"calculation_callback";s:27:"commerce_tax_rate_calculate";s:6:"module";s:15:"commerce_tax_ui";s:5:"title";s:3:"VAT";s:10:"admin_list";b:1;}}}s:8:"included";b:1;}i:2;a:3:{s:4:"name";s:28:"flat_rate_domestic_1st_class";s:5:"price";a:3:{s:6:"amount";i:325;s:13:"currency_code";s:3:"GBP";s:4:"data";a:0:{}}s:8:"included";b:1;}i:3;a:3:{s:4:"name";s:7:"tax|vat";s:5:"price";a:3:{s:6:"amount";d:65;s:13:"currency_code";s:3:"GBP";s:4:"data";a:0:{}}s:8:"included";b:1;}}} ) in field_sql_storage_field_storage_write() (line 451 of /mnt/web/www/sites/[site-name]/html/modules/field/modules/field_sql_storage/field_sql_storage.module).

Discounts work fine on thier own.

I have tried the usual - clearing caches, ran updatedb etc. Any help appreciated.

Comments

dpolant’s picture

Status: Active » Postponed (maintainer needs more info)

Re permissions: What do you mean "these cannot be set"? The two perms you mentioned are the ones that you need.

I could not reproduce this: what kind of discount is your coupon referencing?

The error looks like it is screwing up while trying to add a shipping line item. I have never seen a problem with coupons+shipping before. When exactly does the error message you posted occur?

czigor’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)