I love this module but I am having trouble getting the taxonomy terms that are on the individual product variations to populate the "Product Category" list on [admin/commerce/config/mailchimp]. I have several term reference fields on my product variation and all that is showing up in the drop down filter is -None-

I have read all of the documentation and it looks like it should populate this drop down list with all term references on the product variation entity.

Is there something special to be done during setup or is this a bug?

Comments

silkogelman’s picture

Component: Documentation » Code

It looks like the taxonomy term fields of custom product variations (product types) are not apearing correctly.
Could you confirm this by adding a Term Reference field to the default Drupal Commerce Product variation (Machine name: product)?
The fields from the 'product' product vatiation will probably show up for every product variation now.
That is not supposed to happen. Every product variation should list its own Term Reference Fields.

The problem probably has to do with the query in
commerce_mailchimp_admin.inc

foreach (commerce_product_types() as $type => $product_type) {
    $instances = field_info_instances('commerce_product', 'product');
    $options = array('' => '- None -');
    foreach ($instances as $instance) {
      $field_info = field_info_field($instance['field_name']);
      if ($field_info['type'] == 'taxonomy_term_reference') {
        $options[$instance['field_name']] = $instance['label'];
      }
    }
    $form['order']['product']['commerce_mailchimp_category_field_' . $type] = array(
      '#type' => 'select',
      '#title' => $product_type['name'],
      '#options' => $options,
      '#default_value' => variable_get('commerce_mailchimp_category_field_' . $type, ''),
    );
  }
hibersh’s picture

Status: Active » Fixed
StatusFileSize
new664 bytes

Thanks!
This is a bug. Here's the patch. And it's committed.

silkogelman’s picture

Tested the patch: it works perfectly with different term reference fields on multiple product variations.
Thanks Hibersh.

hibersh’s picture

Status: Fixed » Closed (fixed)