Hi,

I'm using this module to provide decimal quantities for my Line Items.

I'm also using Inline Entity form for my order admin to edit line items.
The problem is that in edit mode, there is no support for decimal quantities...

Is it possible to provide integration with the Inline Entity module?
=> I also posted this issue in the Inline Entity issue cue: https://www.drupal.org/node/2221615

Thanks!

Comments

guy_schneerson’s picture

Hi @maxplus and thanks for reporting this.
Ill try and look into this and hopefully its an easy fix.

vincentdemers’s picture

Hi!

I have been able to achieve this by creating an custom hook_inline_entity_form_entity_form_alter function such as this one:

function mymodule_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) {
  if(isset($entity_form['quantity'])) {
    $entity_form['quantity']['#datatype']='numeric';
    $line_item=$entity_form['#entity'];
    $entity_form['quantity']['#default_value']=$line_item->quantity;
  }
}

Might be useful for someone!

guy_schneerson’s picture

Hi sorry this dropped off my radar, will try and look at it in the next few weeks.

  • guy_schneerson committed b664046 on 7.x-1.x
    Issue #2301695 by vincentdemers, maxplus, guy_schneerson: Line items...
guy_schneerson’s picture

Title: Integration with Inline Entity form » Line items integration with Inline Entity form
Status: Active » Fixed

Thanks @maxplus for reporting and @vincentdemers for the code.
Pushed this feature with one small change: Added a condition to check that the entity type is a line item, as users may have other quantity fields on other entities that are not of numeric type.

maxplus’s picture

Hi Guy,
I immediately start using this on a production site

Thanks, works great for me!

guy_schneerson’s picture

Thanks maxplus for reporting back, A 7.x-1.1 release should follow shortly.

Status: Fixed » Closed (fixed)

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