Hi,
I was wondering if it was possible to set the option "automatic product title" in such a way that product attributes are only added to the product title if an option from the attribute is selected.
I'm creating a webshop that sells locally produced groceries. In my product-type I've set up attributes for:
- volume (used for liquids like milk and juice),
- weight (used for solid products like sugar),
- contents (for boxes with eggs or a boxes with tea-bags)
- Processing (with options like sliced/unsliced for bread and ground/unground for coffee)
I would like the automatic product-title functionality to add an attribute to the product-title only if an option has been selected. Otherwise product-titles end up looking like: Bananas ( ,1Kg, , ,) which is not pretty.
Is this already possible?
Cheers,
Garbo
Comments
Comment #1
garbo commentedI created a patch with a small adjustment of the save function in commerce_product.inline_entity_form.inc
The adjustment is a check per attribute if an option was selected.
This is my first patch ever so if I did something wrong please tell me!
Comment #2
garbo commentedComment #3
bojanz commentedGood catch. Committed.
Comment #5
cn313 commentedPatch needs to be updated to the current version of Inline Entity Form ( line numbers changed) which still has this bug. I will try to find the time to do so in the next days
Comment #6
bojanz commentedI actually committed a fix (and it's in IEF 1.0), but it's only half of the patch (sorry), I'm checking if the attribute is empty, but I'm not checking if all attributes are empty before appending.
Comment #7
bojanz commentedCommitted.
Comment #9
mstrelan commentedIf anyone is looking for an SQL script to run to update their existing products the following worked for me, YMMV.
I am aware that it could have been written a bit better but I literally just wrote it in the order I noticed issues ... the last 4 lines or so could probably have been avoided but it's not worth going back to fix.
As always with database changes make sure you back up your database first. Oh, also you might have to run it a few times depending on how many attributes you have. It should be pretty safe unless you have product titles that actually have weird use of brackets, commas and spaces.