Hello,

I am setting up a Commerce Kickstart (non-demo) installation and need to bulk create variations based on field combinations.

I am using a "Shoes" product variation and combinations should be created based on color and size.

While the products are created, in the following screen I cannot select any Product Display Content type for the node to be created to reference these products.

I have the taxonomy sub-module enabled in order to be able to use the Color and Size vocabularies. Also, I have selected to have BPC present the user with the option of which Product Display Content type to use after generating the products.

Shoes, Dresses, Bags etc. have already been created as Product Display Content types, yet BPC does not show any of these types.

Marking as 'major' since the end result is that the user cannot create a Product Display node for the new Products and it's cumbersome to perform the association manually afterwards.

Comments

marktheshark’s picture

Additional problems detected:

  • Creation of a product display node appears to be working only if a default display node content type is selected in the CBPC settings
  • The new display node does not have the product references of the newly created product variations set

Would be most grateful if someone could confirm whether they are facing the same issues or not.

marktheshark’s picture

Is this module currently abandoned?

I have contacted the maintainer via email but have yet to get an answer on the status of this module.

sven.lauer’s picture

Sorry, Mark, for not having responded to your email promptly.

The module is not QUITE abandoned, but I don't have much time to work on it, including fixing the most pressing issues.

I have adjusted the status to "Seeking co-maintainers" (though perhaps, "Seeking new maintainer" might also be appropriate, given my constant lack of time).

For the near future, I cannot promise more than that I would review (and commit if appropriate, obv) patches to fix the current issues. If I find more time, obviously, I would invest the time to fix the issues preventing the module from working with current kickstarter versions first.

So, if someone is willing to step in and (co-)maintain, that would be great. If you don't think you are up for the commitment of maintainership, either, but want to help, consider picking an issue and working on a patch. I will try and support anyone who does this as much as possible.

marktheshark’s picture

Thanks for the response.

Lack of time is perfectly understandable, but since bulk product creation is a critical component for Commerce solutions, I thought I'd ask.

With regard to this particular issue, I'll try to look into the code and see why the product display types are not selectable when "Create products and product display" is clicked.

marktheshark’s picture

I assume this is the code that checks for commerce product reference fields:

/**
 * Determine the name of the product reference field (if any) on a node type.
 *
 * This is used, for example, to determine which field to prepopulate
 * in the node form after bulk creation.
 *
 * @param object $node_type
 *   The bundle name of the node type for which the product reference field
 *   is to be determined.
 *
 * @return string|NULL
 *   The machine name of the product reference field, if there is one,
 *   NULL otherwise.
 *
 * @todo
 *  Right now, we simply return the first product reference field we find.
 *  What is the best way to deal with multiple product reference fields?
 */
function _commerce_bpc_get_reference_field_name($node_type) {
  if ($fields = field_info_instances('node', $node_type)) {
    foreach ($fields as $name => $field) {
      $field_info = field_read_field($name);
      if ($field_info['type'] == 'commerce_product_reference') {
        return $name;
      }
    }
  }
}
el_reverend’s picture

I am running into the same problem. How can I help?

tchurch’s picture

I have the same problem. It's been months since the original issue was raised.

Any news?

dufferin’s picture

I understand the lack of time to maintain the module and nothing can be said since it's a contributed... but for the Commerce Guy is they really want to be serious with Commerce and not only target the 'on side' store, and the amount of variations can sometime create huge amount of sku's, they should dig in to fix that and make it efficient.
I myself have 2 to 3 projects that I haven't secured yet, but they're all about color and size variations, also price differences beyond a given size... and the bulk product creation is still stuck.

Since the first day of Commerce there is that issue that is still not fixed, WOW! That's a massive joke.

I don't know nothing about coding (if I knew that stuff would have been long done), but I know what a customer wants... and as of now, I don't know if I can really come to a client an tell him 'yeah Commerce is great, but only if you sell a mug or flash light... If you sell items with variations... use something else because the Commerce Guys are making money selling their expertise in partly done offer".

Sorry for the rant, but really that's not serious what's going on with Commerce.

Cheers and respect to you for the module.

maxchock’s picture

I agree with dufferin at #8, I've been suffering for the Bulk Product creation for months, still doesn't find a good solution yet.

flamedbeef’s picture

I too am in the process of setting up an online store, I really like drupal commerce but this bug with not being able to create a node is really making things hard. It's almost a deal breaker, Not Sven's fault, but be great if some more people or the commerce guys can look into this.

flamedbeef’s picture

In the mean time does anyone have a workaround to manually create a display product? If I use the bulk create tool to create all of the variations is there a manual way I can easily link them all to a display product?

marktheshark’s picture

The Drupal Commerce Display Manager has an up to date release that could suit your needs.

dddbbb’s picture

Just so it's clear to anyone reading this, the bug only appears if you configure BPC to allow the user to select a Product Display type once the product entities have been created. If you have a simple store that only uses a single Product Display type then you can just set this to be the default, skip the selection step and things should work as designed. That's not gonna satisfy any slightly more complex stores but it's certainly worth pointing out for people working on smaller scale sites. (see next comment for update).

@flamedbeef - can VBO be used to assign product entities to a product display? I honestly don't know if it can - just thought that could be a lead.

+1 for getting this fixed up though.

+10 for seeing another maintainer step in so that this very handy module doesn't slip any further than it should. Commerce Guys? Anyone? I'd step up but I don't think I have the chops ( I'd make it 100 times worse :D ).

dddbbb’s picture

I've just thought, my codebase isn't based on Kickstart, so it could be that I'm seeing slightly different results.

I did however notice that commerce_backoffice (included with Kickstart) does seem to remove access to the per product display type config that was introduced to BPC in rc1 (normally found at admin/commerce/products/types/[your_product_display_type]/commerce_bpc). Without this, you're left with just the global BPC config at admin/commerce/config/commerce_bpc where you'd naturally want to use the "user selects product display on next page" option if you have a site that deals with more than one product display type.

Stay with me. Workarounds ahead...

If you either...

a) temporarily disable commerce_backoffice
b) don't install commerce_backoffice until after you've set up your BPC config
c) just don't bother with commerce_backoffice (it does seem to make a bit of a mess of things)

...then you can successfully configure BPC per product display to use a default, negating the absolute need to configure it globally using the "user selects product display type on next page" feature (though I agree it'd be nice to have that working).

So, there's a possible work around for now, I think.

Question: Why is commerce_backoffice interfering that much with BPC in the first place? I know that commerce_backoffice likes to re-arrange things a bit - I assume that it's interfering by accident. Perhaps a patch/issue over in that direction would be in order and possibly simpler in the short term (it appears to be more maintained than BPC).

TajinderSingh’s picture

Solution found to display the selection.

In file commerce_bpc.module, for menu item:
$items['admin/commerce/products/add-bulk/' . $type . '/display/%']

change values for:
'page_callback' to 'drupal_get_form'
'page arguments' to array('commerce_bpc_create_bulk_form_display_node', $type, 6)

The issue is that Drupal failing to render the form correctly. The current page callback value is:
commerce_bpc_create_bulk_form_display_node

which doesn't render the form, but just return the $form array.

Along this, we also require to change below function:
function commerce_bpc_create_bulk_form_display_node($product_type, $bulk_creation_id)
to
function commerce_bpc_create_bulk_form_display_node($form, &$form_state, $product_type, $bulk_creation_id)

Now the further issue occurs in case we are using this module with Commerce Kickstart which as inline_entity_form, for this below can be referred:
* https://drupal.org/node/1645866

To allow per product editing of settings for BPC on Commerce Kickstart, in file commerce_bpc.module replace below:

foreach (commerce_product_types() as $type => $product_type) {
  if (commerce_bpc_valid_product_type($type)) {
    $items['admin/commerce/products/types/' . $type . '/commerce_bpc'] = array(
      'title' => 'Bulk product creation',
      'description' => 'Settings for the bulk product creation functionality',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('commerce_bpc_pattern_settings_form', $type),
      'access arguments' => array('configure commerce bpc'),
      'file' => 'commerce_bpc.admin.inc',
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );
    $items['admin/commerce/products/types/' . $type . '/commerce_bpc/patterns'] = array(
      'title' => 'Patterns',
      'access arguments' => array('configure commerce bpc'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );
    $items['admin/commerce/products/types/' . $type . '/commerce_bpc/display_nodes'] = array(
      'title' => 'Display node settings',
      'description' => 'Settings for the bulk product creation display node settings',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('commerce_bpc_display_node_settings_form', $type),
      'access arguments' => array('configure commerce bpc'),
      'file' => 'commerce_bpc.admin.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => 10,
    );

  }
}

with

if (module_exists('commerce_backoffice')) {
    foreach (commerce_product_types() as $type => $product_type) {
      if (commerce_bpc_valid_product_type($type)) {
        $items['admin/commerce/config/product-variation-types/' . $type . '/commerce_bpc'] = array(
          'title' => 'Bulk product creation',
          'description' => 'Settings for the bulk product creation functionality',
          'page callback' => 'drupal_get_form',
          'page arguments' => array('commerce_bpc_pattern_settings_form', $type),
          'access arguments' => array('configure commerce bpc'),
          'file' => 'commerce_bpc.admin.inc',
          'weight' => 10,
          'type' => MENU_LOCAL_TASK,
        );
        $items['admin/commerce/config/product-variation-types/' . $type . '/commerce_bpc/patterns'] = array(
          'title' => 'Patterns',
          'access arguments' => array('configure commerce bpc'),
          'type' => MENU_DEFAULT_LOCAL_TASK,
          'weight' => 0,
        );
        $items['admin/commerce/config/product-variation-types/' . $type . '/commerce_bpc/display_nodes'] = array(
          'title' => 'Display node settings',
          'description' => 'Settings for the bulk product creation display node settings',
          'page callback' => 'drupal_get_form',
          'page arguments' => array('commerce_bpc_display_node_settings_form', $type),
          'access arguments' => array('configure commerce bpc'),
          'file' => 'commerce_bpc.admin.inc',
          'type' => MENU_LOCAL_TASK,
          'weight' => 10,
        );
  
      }
    }
  }
  else {
    foreach (commerce_product_types() as $type => $product_type) {
      if (commerce_bpc_valid_product_type($type)) {
        $items['admin/commerce/products/types/' . $type . '/commerce_bpc'] = array(
          'title' => 'Bulk product creation',
          'description' => 'Settings for the bulk product creation functionality',
          'page callback' => 'drupal_get_form',
          'page arguments' => array('commerce_bpc_pattern_settings_form', $type),
          'access arguments' => array('configure commerce bpc'),
          'file' => 'commerce_bpc.admin.inc',
          'weight' => 10,
          'type' => MENU_LOCAL_TASK,
        );
        $items['admin/commerce/products/types/' . $type . '/commerce_bpc/patterns'] = array(
          'title' => 'Patterns',
          'access arguments' => array('configure commerce bpc'),
          'type' => MENU_DEFAULT_LOCAL_TASK,
          'weight' => 0,
        );
        $items['admin/commerce/products/types/' . $type . '/commerce_bpc/display_nodes'] = array(
          'title' => 'Display node settings',
          'description' => 'Settings for the bulk product creation display node settings',
          'page callback' => 'drupal_get_form',
          'page arguments' => array('commerce_bpc_display_node_settings_form', $type),
          'access arguments' => array('configure commerce bpc'),
          'file' => 'commerce_bpc.admin.inc',
          'type' => MENU_LOCAL_TASK,
          'weight' => 10,
        );
  
      }
    }
  }

Thanks :)

VVS’s picture

#15 thanks - all working!

discipolo’s picture