Hi
Thank you for this module, it's very useful.
I'm trying to merge commerce 'add product' with content 'product display'.

In product display form i have a field set i created with field group module.
It works fine with field that is not in field group, But it doesn't show fields that in field group.

I searched in google about this issue but i don't find anything.

please help me
thanks

Comments

mahyarsbt’s picture

commerce_apd_form_commerce_product_ui_product_form_alter in file commerce_apd.module used "field_attach_form()" for attach product display node form to product entity form.

I think this function not support fieldset or 'field group' module.

mahyarsbt’s picture

I can fix my problem with using field group fieldsets but i don't know this is a good solution or not.

in function commerce_apd_form_commerce_product_ui_product_form_alter(&$form, &$form_state, $form_id)

I added new code before and after second field_attach_form for support field_group module:

    // Attach the product display form to product creation variable.
    field_attach_form('node', $node, $form, $form_state);

to

		if (module_exists('field_group')) {
			$groups = $form2['#groups'];
			$fieldgroups = $form2['#fieldgroups'];
			$group_children = $form2['#group_children'];
			unset($form2['#groups']);
			unset($form2['#fieldgroups']);
			unset($form2['#group_children']);
		}
		
    // Attach the product display form to product creation variable.
    field_attach_form('node', $node, $form, $form_state);
		
		if (module_exists('field_group')) {
			$form['#groups'] = array_merge($form['#groups'], $groups);
			$form['#fieldgroups'] = array_merge($form['#fieldgroups'], $fieldgroups);
			$form['#group_children'] = array_merge($form['#group_children'], $group_children);
			$form['#pre_render'] = array_unique($form['#pre_render']);
		}

it works for me, and show my field set i made with field group.

only when 'Show product display form automatically' set no in configuration
fieldsets not showing in 'Create product display' fieldset.

i hope help for path

thanks

bogeyman’s picture

Thank you for your response, I will evaluate your code.

achikas’s picture

Issue summary: View changes

i also need fieldgroups, but there are none.

i added your solution, but that doesnt give me my fieldgroups back.

would be great to have a solution.

khiminrm’s picture

Hi! I had the same bug. I've investigated that after field_attach_form('node', $node, $form, $form_state); the variable $form losts information about fieldgroups. I fixed it so:
to the begining of function commerce_apd_form_commerce_product_ui_product_form_alter I've inserted such code:

  $groups = $form['#groups'];
  $fieldgroups = $form['#fieldgroups'];
  $group_children = $form['#group_children'];
  $pre_render = $form['#pre_render'];

and to the end of current function:

    $form['#groups']  = $groups;
    $form['#fieldgroups'] = $fieldgroups;
    $form['#group_children'] = $group_children;
    $form['#pre_render'] = $pre_render;

Hope it will help somebody. Good luck!

vhin0210’s picture

Version: 7.x-1.4 » 7.x-1.6
StatusFileSize
new1.99 KB

Updated the version to 7.x-1.6 and created the patch based on #2

vhin0210’s picture

Status: Active » Needs review
vhin0210’s picture

StatusFileSize
new1.99 KB
bogeyman’s picture

Category: Support request » Bug report

I think this could be related to : https://www.drupal.org/node/1993614
I change the way the module displayed the form field. Please test the 7.x-1.x.

bogeyman’s picture

Status: Needs review » Fixed
bogeyman’s picture

Status: Fixed » Closed (fixed)