I want to display one term reference field not in vertical tabs as "product catalog" but as ordinary field.
Is there any way how i can do it?
I was trying to do it with "form_alter" and "after_build", but haven`t succeed.
I was trying to find where it is controlled in "commerce" module, but I didn`t find it.
Will be very helpful for any information how to do it or where to find more information.

Comments

Project:Drupal Commerce» Commerce Backoffice
Version:7.x-1.4» 7.x-1.x-dev
Component:Developer experience» Code

Pretty sure this is coming from the Backoffice module.

Thanks a lot!

If someone will need to do the same thing - here is the way how to do it:

In your template.php file (because form_alter from template is called after all form_alters in modules, in my case my_module_form_alter was called before commerce_backoffice_product_form_alter) make a form_alter for required form with this code:

if (isset($form['#node_edit_form'])) {
    $product_node_types = commerce_product_reference_node_types();
    if (in_array($form['#node']->type, array_keys($product_node_types))) {
      foreach (field_info_instances('node', $form['#node']->type) as $field_name => $instance) {
        $field = field_info_field($field_name);
        //next line do all the work, just add required field_name
        if ($field['type'] == 'taxonomy_term_reference' && $field['field_name'] == 'field_to_unset_from_vertical_tabs') {
          unset($form[$field_name]['#fieldset']);
        }
      }
    }
  }

Maybe the module shoud provide a settings page so that the user can set it up

Category:support» feature
Status:Active» Needs review
StatusFileSize
new1.71 KB

here is a patch that should provide a solution for this issue.

- it adds new settings for the Term references field of the Product Displays content types.
- with this setting the field will be not included in Product Catalog vertical tab.
this means the default is in.

has the patch been added?

No. This issue would be marked "fixed" if it had.

Status:Needs review» Needs work
StatusFileSize
new20.97 KB

#4 Works for me.

One small issue:
The vertical tab for "Product catalog" should be hidden when it is empty.Product Catalog vertical tab

Status:Needs work» Needs review
StatusFileSize
new2.99 KB

indeed, the tab is displayed no matter if there are term reference fields or not and it's not strictly related with the previous patch.

however here is a new patch that includes solution for this "new" issue.

Status:Needs review» Reviewed & tested by the community

Patch in #8 appears to work as it says it does. Thanks for that.

While I'm here, and related to this subject, as a new user of this module I am rather surprised about how much it assumes about how I want to set up the admin experience of my store; this 'Product catalog' issue being a good example. There are a number of other features that I've had to 'un-override' in order to get them back to how I think I'd like them. In fact, I'm pretty sure I'm only in it for the Quick edit / Mega view functionality (which I think is great and am truly thankful for). Is this a common view?

#8 works for me. Thanks vasike.

Status:Reviewed & tested by the community» Fixed
StatusFileSize
new3.01 KB

I committed a slightly different patch, the checkbox label is now "Used for categorizing products", and the approach is now to explicitly uncheck the checkbox if you want to hide a taxonomy field from the tab.

Status:Fixed» Closed (fixed)

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

#11 worked for me! Nice, thanks!

Why does this patch assume variation type machine name is exact match to content type's machine name ?

I have spent quite a lot of time looking for this checkbox and it appears it will never show if you try to name things your way. In my opinion naming variation type (entity) to 'exactly' match content type (node) creates confusion (a lot of it). Since user has full control over machine names modules should not assume mirrored names will always be the case.

in_array($form['#instance']['bundle'] - variation type edited...

array_keys(commerce_product_reference_node_types() node types...