Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#14 | commerce_bpc-reorder-sku-fragment-1265258-14.patch | 2.62 KB | joelstein |
#13 | reorder-sku-fragment.patch | 2.69 KB | DannyPfeiffer |
#8 | Screen shot 2013-03-16 at 8.22.26 AM.png | 48.25 KB | nelslynn |
#8 | Screen shot 2013-03-16 at 8.21.28 AM.png | 115.98 KB | nelslynn |
Comments
Comment #1
sven.lauer CreditAttribution: sven.lauer commentedGood 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.
Comment #2
sven.lauer CreditAttribution: sven.lauer commentedBumping this to a critical task, as it is something I want to get done before the 1.0 release.
Comment #3
AJen CreditAttribution: AJen commentedIs 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)
Comment #4
sven.lauer CreditAttribution: sven.lauer commentedThere 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.
Comment #5
sven.lauer CreditAttribution: sven.lauer commentedI 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).
Comment #6
sven.lauer CreditAttribution: sven.lauer commentedGiven that there is now a quite viable workaround, I am demoting this to normal.
Comment #7
sven.lauer CreditAttribution: sven.lauer commentedCommerce bpc will use a "core like" release management, meaning that new features will go into the 2.x branch (but might be backported).
Comment #8
nelslynn CreditAttribution: nelslynn commentedI do not see this option in the 7.x-1.x-dev or 7.x-2.x-dev versions? Am I missing something?
Comment #9
mikeaja CreditAttribution: mikeaja commentedHi 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:
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.
Comment #10
mikeaja CreditAttribution: mikeaja commentedSet 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.
Comment #11
rollingnet CreditAttribution: rollingnet commentedAny 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.
Comment #12
rollingnet CreditAttribution: rollingnet commentedThe 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.
Comment #13
DannyPfeiffer CreditAttribution: DannyPfeiffer commentedFollowing 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).
Comment #14
joelstein CreditAttribution: joelstein as a volunteer commentedHere's an improved, simplified patch from #13.
Comment #15
DannyPfeiffer CreditAttribution: DannyPfeiffer commentedThanks Joel!