Currently I've found no way to control the order of attribute values in the bulk_defaults:combination_labels token. It would be nice if the order in which the attributes are combined was governed by the field wight of the fields that carries the attributes. Sometimes it's desirable to list the attributes in a certain order as part of the generated product name (e.g., size needs to come first, then color). Obeying the field order would allow me to do this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sven.lauer’s picture

Assigned: Unassigned » sven.lauer

Good point.

I had thought about this, then decided that probably, one would want to also have the option to order the tokens independently from the field order ... and then decided that, really, the best way to do this is to have product type specific settings for the sku/title patterns (which would also enable one to include a name in the title, e.g. "Foo Shirt (Color: red, Size: M)" instead of "Foo Shirt (red, M)".

You are right, though, that the default should be the field oder. Working on a fix.

sven.lauer’s picture

Category: feature » task
Priority: Normal » Critical

Bumping this to a critical task, as it is something I want to get done before the 1.0 release.

AJen’s picture

Is there some sort of patch for this, that can be implemented now to make the colour come before size?

Would add a lot of flexibility also if you could specifiy the first few letters of a term eg. colour '00-blue', would be shortened to '00' in the SKU. I found the widget for specifying the SKU's in the node broke if the SKU was too long (at least I think that's what caused it)

sven.lauer’s picture

There isn't a patch yet, in part because this is a little more difficult to implement than it might seem.

However, I'll push a commit shortly that allows setting the SKU/Title patterns by content type---including tokens that are product-type specific. That means that you can then, as a work-around, just specify the the tokens manually.

Is the issue with the autocomplete that you generally have problems associating products to nodes if their SKUs are too long? In that case, you should file an issue against the Commerce project.

sven.lauer’s picture

I just pushed the commit I referred to in #4. It will be available as a dev release as soon as these are re-rolled (max. 12 hours).

Here is a work-around that will allow you to specify the order in both SKU and title fields:
- Go to Store -> Products -> Product Types -> [the product type you want to change] -> Bulk product creation

- You will see a form consisting only of a single checkbox allowing you to override the global settings for this product type.

- Enable the checkbox. A copy of the "Patterns" settings form will appear.

- There will be a second "Tokens" fieldset at the bottom, containing the product-type-specific tokens.

- You can put these into both the SKU and the title pattern field---simply replace the 'combination_values' or 'combination_labels' tokens with a list of the tokens---make sure you include tokens for all combination fields.

- Save the form. You are done. Now this product type will use these patterns instead of the global ones.

Note, though, that the "-label" fields are not guaranteed to be SKU-safe, so most likely, you'll want to use the "-value" tokens in SKUs.

I will add another token shortly, addressing @Aussiejen's request in #3: This will be a SKU-safe version of the -label token, shortened to a certain number of characters (there will be a new settings for the number of characters).

sven.lauer’s picture

Priority: Critical » Normal

Given that there is now a quite viable workaround, I am demoting this to normal.

sven.lauer’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

Commerce bpc will use a "core like" release management, meaning that new features will go into the 2.x branch (but might be backported).

nelslynn’s picture

I do not see this option in the 7.x-1.x-dev or 7.x-2.x-dev versions? Am I missing something?

mikeaja’s picture

Hi Sven / nelslynn.

Just to save others some time here, there is absolutely no difference between the released, 7.x-1.x-dev or 7.x-2.x-dev versions with regard to this issue.

This, if referring to the product type / variation type edit, does not display a BPC tab or field:

Go to Store -> Products -> Product Types -> [the product type you want to change] -> Bulk product creation

Or, is this just not working in Kickstart 2? @nelsynn, what are you using?

I also think the solution was possibly more complicated than necessary. Wouldn't it be better in weight order to solve 99% of use cases.

Can't do patches, so will hack module and report back.

mikeaja’s picture

Priority: Normal » Critical
Issue summary: View changes

Set to critical to highlight not fixed, and surely this will be necessary for quite a number of users, given the importance of product title display and possibly SKU requirements.

rollingnet’s picture

Any update about this issue?
I agree with mikeaja.
I think it's a serious issue of this module and that I'm not alone saying it's absolutely fundamental for his good work.

rollingnet’s picture

The only workaround that I've found for this issue is the following:
this module creates the combinations of field in the order that they are been created, so if you want a different order, you have to delete and re-insert the fields that you want to come after the existent ones.
Hope it could be useful in the meantime someone will publish a patch for this issue.

DannyPfeiffer’s picture

FileSize
2.69 KB

Following patch adds reordering of sku-fragment components by field weight defined on a given product type. It's dependent on each field on your product having weight defined (ie: not all fields with 0 weight).

joelstein’s picture

Status: Active » Needs review
FileSize
2.62 KB

Here's an improved, simplified patch from #13.

DannyPfeiffer’s picture

Thanks Joel!