Hello.

After upgrading Commerce Kickstart to 2.0 the Discount Module that brings Kickstart is the dev version.

When I try to add a Discount I can´t see the field for adding the fixed amount or the percentage. See CommerceDiscountBug.png attached.

The Discount Module version is 7.x-1.0-alpha1+11-dev

Comments

amorales@drupal.org.es’s picture

Uninstalled Dev version and installed again 7.x-1.0-alpha1 and still not working. So the problem is not caused by the dev version.

Here is the HTML where should be the form field missed:

<div id="commerce-discount-fields-wrapper">
	<div></div>
	<div id="edit-commerce-discount-fields-commerce-discount-offer--3" class="field-type-entityreference field-name-commerce-discount-offer field-widget-inline-entity-form form-wrapper">
		<div id="inline-entity-form-132">
			<div class="form-wrapper" id="edit-commerce-discount-fields-commerce-discount-offer-und--3"><div id="edit-commerce-discount-fields-commerce-discount-offer-und-actions--3" class="container-inline form-wrapper"></div>
			</div>
		</div>
	</div>
</div>

Could it be caussed by the Inline entity form module?
Inline Entity form - 7.x-1.0
Entity Reference - 7.x-1.0

amorales@drupal.org.es’s picture

Need to say that if I try to create a discount without the amount / percentage field I get this warning:

Notice: Undefined index: en commerce_discount_default_rules_configuration() (línea 26 de /var/www/kabula/portal/sites/all/modules/commerce_discount/commerce_discount.rules_defaults.inc).

The rule that create Commerce Discount has an error with "Unknown action".

If anyone is having this issue the discount can be added by using the Import tool.

I have another Kickstart demo site where I can set the Discount and export it.

bojanz’s picture

I suggest not using Discount until this is fixed.

We need to add an update function that converts the inline entity form for offers to the new widget (since IEF 1.0 renamed them)

amorales@drupal.org.es’s picture

Thanks for the advice Bojanz.

I'll use Discounts with Taxes then.

garphy’s picture

Here's a patch that perform the widget type update.
Edit: Wrong Patch. See below

nicodh’s picture

Status: Active » Needs review

@garphy : your patch seems to be made for commerce invoice module ??

I've tested to add an hook_update and this seems to work (added at the end of the .install file, and then run update.php) :

/**
 * Change widget for commerce_discount_offer fields.
 */
function commerce_discount_update_7000(&$sandbox) {
  foreach (commerce_discount_types() as $type => $value) {
    if ($instance = field_read_instance('commerce_discount', 'commerce_discount_offer', $type, array('include_inactive' => TRUE))) {
      $instance['widget'] = array(
          'module' => 'inline_entity_form',
          'type' => 'inline_entity_form_single',
        );
      field_update_instance($instance);
    }
  }
}
garphy’s picture

My Bad. Wrong Patch.
Here's the correct one.

checker’s picture

Patch #7 works (needs the latest version of inline entity form)

kevster’s picture

patch in #7 needs to be run against latest dev version not alpha1. Thx for patch in #6 - fixed issue in alpha1 and also sorted the rule issue where the action was broken ;-)

bojanz’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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

Status: Closed (fixed) » Needs work

The last submitted patch, 5: implement-new-callback-based-method-1728106-4.patch, failed testing.

joelpittet’s picture

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