I have a product with 3 attributes to select from (term references), all optional. The attribute select lists display based on individual products set up via the inline entity form.

ISSUE: for some reason when there is a product choice that has three available attributes, a 4th select lists shows up with the label "Select a product" (see sceenshot #1). Once I select another option form the 3rd attribute, the select list goes away and everything functions normal again (see screenshot #2). Why does this select list (Select a Product), only display randomly, and at all?

Comments

rszrama’s picture

Category: bug » support
Status: Active » Closed (works as designed)

It's just showing up because you have multiple products on the form that share the same attribute field values. It lets you drill down a single product from that set of matching products to add to the cart. It doesn't show up for other combinations because there's only one matching product.

nelslynn’s picture

StatusFileSize
new46.12 KB
new41.55 KB
new50.01 KB
new46.92 KB

These are all unique products. None share all 3 of the same attributes. I don't need the "Select a product" to select a unique product. Plus the 'select a product' only shows up the first time when selecting this certain combo of three attributes. When I select another set of attributes, then come back to the same combo causing the "Select a product" to show, it doesn't show up.

See the series of screenshots as to how the "Select a product" shows up, and then doesn't.

Thanks,

nelslynn’s picture

Status: Closed (works as designed) » Needs review

forgot to change status.

nelslynn’s picture

Status: Needs review » Active
rszrama’s picture

So there's only one option in the "Select a product" list?

nelslynn’s picture

No, there are two options in the 'select a product' list, however, I can select the same products in the 4th select list by selecting options in the 3rd select list. The 'select a product' list is therefore un-necessary and confusing to the end user.

Here's a link to the product page:
http://goo.gl/WKKuJ

Here's how to trigger/not trigger the 'select a product' list:

How to trigger the 'select a product' list:
- From page load, select pAd288 as the first option… two attribute options appear (all okay, no 'select a Product' select list). Now select pAd363 or pAd292 (products that have 3 attribute options), 'select a product' list shows.
[edit], AND from here, when you select the bottom option (pAd363+pE1.2-CMV+pE3-CMV) from the 'select a product' dropdown, the WRONG sku is selected (CAT#: QK-1013). I should be CAT#: QK-1012, which you can now select correctly from the 3rd dropdown.

When the 'select a product' list is not triggered (same products as above):
- On page load, where first select list option = pAd363… no 'Select a product' option. Try to select any other option from only the 2nd and 3rd select lists…. no 'Select a product' option.
- Select another product where there are 3 attribute options, pAd328 from the first select box… no 'Select a Product' option (note you have to be coming from a product with 3 attribute options). Select anything else from the 2nd and 3rd select boxes…. no 'select a product' select box.
- Only when you go to a 2-attribute product (1st select list = pAd288 for example) then back to a 3-attribute product does the 'select a product' list show again.

nelslynn’s picture

Issue summary: View changes

Has anyone come across this issue? This is still an issue with all modules updated to their most resent version.

Am I to conclude that Drupal Commerce will display an irrelevant select box (confusing to the user) of product variations when there are product variations that have a mixed number of attributes?

Here's a URL where you can see the issue. Read the previous post about how to trigger the issue.
http://goo.gl/KO6R5m

nithinkolekar’s picture

@rszrama

It's just showing up because you have multiple products on the form that share the same attribute field values

I am facing same problem when product(variation) having the same attribute , which could/should be avoided by admins but for the commerce module why would it treat it as same product when they have unique SKU.

Is there anything that has to be done, to avoid duplicate products by applying unique field on product title or some other field?

cedric_a’s picture

Same problem on a fresh installation. It seems to happen only when using multiple attributes based on term reference fields.

Here is my use case :
- product 1 : Size=L / Material=wood
- product 2 : Size=L / Material=metal
- product 3 : Size=XL / Material=

When the display product page load, I have 2 select inputs (Size / Material) = OK
If I select Size=XL --> I have just one select input (Size) and the price is updated = OK
If I select Size=L --> I get 3 select inputs (Size / Material / Select a product) = KO

In the "Select a product" list there is 2 options :
- product 1 (L, wood)
- product 2 (L, metal)

If I select Material=metal (default is wood) --> "Select a product" disappear

Hope this description can help

mmtt’s picture

Same here
Edit: It hapens only if you same sku's

Marko B’s picture

Having the same problem. Both "size" and product select selects get rendered. This is happening on AJAX call only, when page is loaded by default it does not. Also when I use select and ajax refreshes this "select a product" goes away.

Here is html I get on Ajax call.

<div class="form-item form-type-select form-item-attributes-field-size">
  <label for="edit-attributes-field-size">Size </label>
 <select id="edit-attributes-field-size" name="attributes[field_size]" class="form-select ajax-processed"><option value="15ml" selected="selected">15ml</option><option value="30ml">30ml</option></select>
</div>
<div class="form-item form-type-select form-item-attributes-product-select">
  <label for="edit-attributes-product-select">Select a product </label>
 <select id="edit-attributes-product-select" name="attributes[product_select]" class="form-select ajax-processed"><option value="1090" selected="selected">LUNA™ LUXE 333</option><option value="1091">Rreee Luna Lux</option></select>
</div>
jonofthedead’s picture

Correct Cedric_a, I can confirm your case as well though mine with 3 attributes.

1: size: L, color: Black, Clip-material: plastic
2: size: L, color: Gray, Clip-material: metal
3: size: XL, Color: Black, Clip-material: NULL/Blank (as product 3 doesn't have a clip)

Starts on product 1 so attributes are on Size: L, Color: Black, Clip-Material: Plastic

If you select Gray you get product 2.

Then you select XL, Color auto chooses black, and Clip-material disappears, you get product 3.

Then select L and you get the "Select a Product" attribute at this point and it stays on Product 3. This is a problem as by selecting Large since the color was still selected as "Black" I should have gotten product 1 but I did not.

This is caused (from what I see at least) from selecting a product field as an attribute that is not a required field and therefore will be blank in some cases. When you select the attributes to pick that product with a "blank" attribute, when you try to go to any other product that has that attribute filled in you automatically get the "select a product" attribute.

I don't know if this was by design (and if so I think you should not allow us to select the field as an attribute if it isn't a required field) but my work around was to give product 3 a Clip-Material of "No Clip". Now it all works fine.

bensey’s picture

Hey all,

OMG this was an infuriating issue for me, and the kind of things DC continually throws at you whenever you want to create slightly more complex setups.

In my case however it was easily solved in the end with a hook form alter. I initially thought about unsetting the form element completely, but decided to leave it there just in case but change it from select to hidden as follows.

function MY_MODULE_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state, $form_id) {
//    dpm($form);
//    dpm($form_state);

    if(isset($form['attributes']['product_select'])){
        $form['attributes']['product_select']['#type'] = 'hidden';
    }
}
nelslynn’s picture

I hired someone to fix this for me. See below for the function to place in a custom model. This issue is only evident with specific product configurations (SKUs), but hopefully this gets addressed, as it presents a very unprofessional looking product page and functionality. Maybe if we get feedback on the function below, as it if it works and it a good solution, someone commit a fix?

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if (strpos($form_id, 'commerce_cart_add_to_cart_form_') === 0) {
    // Remove 'Select a Product' dropdown.
    // commerce_cart_add_to_cart_form() in commerce_cart.module adds this if more than one matched product found.
    if ( isset($form['attributes']['product_select']) ) {
      unset($form['attributes']['product_select']);
    }
  }
}