When you save a new discount, this notice is displayed:

Notice: Undefined index: #value in number_field_widget_validate() (line 373 of modules/field/modules/number/number.module).

Comments

steven_kropp’s picture

I have the same issue... any resolution yet???

giuvax’s picture

I'm having this error, Discounts work but I want to understand what is this and how to solve it before publishing website.

kevster’s picture

StatusFileSize
new16.75 KB

I am having the same issue also - using the latest dev module. I noticed I have no access to change the available setting (shows 50 available on the discounts list) and also no text showing under offer column (see attached). I havent got coupon switched on, using drupal 7.22 and commerce 1.5 kickstart2.

I updated to entityref latest dev.

EDIT:
I can see the discount in the cart but when I go to checkout and try to hit /checkout/755/checkout I get
"Error The website encountered an unexpected error. Please try again later. "

checking the log I see:
php -
Notice: Undefined index: #value in number_field_widget_validate() (line 373 of /mnt/web/www/sites/xxxx/html/modules/field/modules/number/number.module).

rules -
Unable to get a data value. Error: Unable to get the data property type as the parent data structure is not set.

rules -
Unable to evaluate condition commerce_shipping_compare_shipping_service.

commerce_order -
EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of /mnt/web/www/sites/xxxx/html/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

php -
EntityMetadataWrapperException: Unable to get the data property commerce_total as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 442 of /mnt/web/www/sites/xxxx/html/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

If I turn off discount I can check out ok. Hope the above is enough info to debug?

tmsimont’s picture

Priority: Minor » Major

it's releated to the quantity field... if you set "unlimited" on the "quantity" then it fires off this error.

if you have discount usage installed, it reads "50 available" even though you've set it to "unlimited" quantity.

tmsimont’s picture

Title: Notice on saving a discount » Not able to set "max uses" to unlimited, and a Notice is shown on saving a discount
tmsimont’s picture

Title: Not able to set "max uses" to unlimited, and a Notice is shown on saving a discount » Notice is shown on saving a discount

sorry my issue with max uses is not related.. this notice comes from the overwrite of the field with this code:

  // Show uses as readonly on edit, hide completely on add.
  $uses[LANGUAGE_NONE][0]['value']['#type'] = 'item';
  $uses[LANGUAGE_NONE][0]['value']['#markup'] = $uses[LANGUAGE_NONE][0]['value']['#default_value'];
  if ($form_state['op'] == 'add') {
    $uses['#access'] = FALSE;
  }
  $uses[LANGUAGE_NONE][0]['value']['#title'] = t('Times used:');

You can't re-write the type of the field because it breaks the validation, yielding the notice everyone is seeing... why not use the "disabled" field property?

tmsimont’s picture

Priority: Major » Minor
tmsimont’s picture

Status: Active » Needs review
StatusFileSize
new1.21 KB

how about this?

karlmc15’s picture

Status: Needs review » Active

Thanks @tmsimont
It's working for my site: shopyeucon.net

pcambra’s picture

Status: Active » Needs review
jtibbles’s picture

Status: Needs review » Fixed

Yes that patch works for me too, thanks.

pcambra’s picture

Status: Fixed » Needs review

Please don't mark it as fixed until is actually included in the module

jkuma’s picture

Works for me as well.

jkuma’s picture

Status: Needs review » Fixed

Committed in 7.x-1.x-dev branch. Thanks for your fix tmsimont.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status: Closed (fixed) » Needs work
joelpittet’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)