Hi,
Lyle and I have discussed and agreed to add optional labels to attributes. This will allow the following attributes to both show a select list labelled Size on product Add to cart forms.
Attribute: A
Name: Dress sizes
Label: Size
Options: 6, 8, 10, 12, 14
Attribute: B
Name: Jean sizes
Label: Size
Options: 28, 29, 30, 31, 32, 34
Once one of the above attributes is added to a product the other (with the same label) will not be shown in that product's Add attribute form.
Attribute labels can be overridden per-product in the same way Required or Display can.
We've also added support for a label set to ''. This will hide the label on product Add to cart forms. In the cart (both block and page), checkout and orders, the attribute name will be used. Use this feature carefully. Most use cases are better off not using this feature.
Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | uc_attribute.module_original.txt | 28.37 KB | aliak |
| #5 | 437268_200904182100+1000.patch | 1.18 KB | sammys |
| #3 | attribute_label.patch | 15.17 KB | Island Usurper |
| #2 | attribute_label.patch | 14.98 KB | Island Usurper |
| #1 | 437268_200904181250+1000.patch | 16.15 KB | sammys |
Comments
Comment #1
sammys commentedPatch attached!
Comment #2
Island Usurper commentedOkey dokey. Couple of quick things. I've changed the update function to use the Schema API for D6, and added another place to use _uc_attribute_get_name().
Since it took me a couple of tries to figure out what the $force parameter was doing, I changed it and the inline docs to say something that will hopefully be clearer.
Lastly, I fixed it so that attributes with empty labels don't exclude any others from the add attributes to products form.
Comment #3
Island Usurper commentedGoing off some of Ryan's suggestions for usability, labels' default values should be the attribute's name if they are empty.
Comment #4
rszrama commentedFixed a bugfix and column title. Committing as is, we can refine as we go.
Comment #5
sammys commentedThere's a typo that I left there when changing function name. Patch attached.
Comment #6
rszrama commentedFixed! Thanks, Sammy, and thanks for rushing this patch together for us. We normally aren't so pressed for time and wouldn't force things, but we needed the morale boost of a release candidate last night. : P
Comment #7
sammys commentedAll good Ryan! Thanks for accepting the patch and for all the work to get it to RC! :) You all deserve some Chick-fil-a! :)
Comment #9
aliak commentedhi, is the line 325 problem in ubercart-6.x-2.0-rc2 also?
I was seeing this error message, then found this thread.
Fatal error: Call to undefined function uc_attribute_get_name() in /home//sites/all/modules/ubercart/uc_attribute/uc_attribute.module on line 325
I made the change (manually) as per the patch & re-ran cron and it seems ok now
- $output .= '
'. uc_attribute_get_name($attribute) .'
';
+ $output .= '
'. _uc_attribute_get_name($attribute) .'
';
attached is the original file (broken)
uc_attribute.module_original.txt
(sorry I didn't change the version # in the bug report header)
Comment #10
Island Usurper commentedI think this was one of the things that I committed to the Bazaar repository, but didn't fix right in CVS. It should be good in the dev version.
Comment #11
aliak commentedthanks. I installed this and it doesn't have the error
(I'd installed the rc2 as it was recommended for drupal6 - didn't notice the dev version was a later date)
Comment #12
asak commentedsubscribing.
Comment #13
Island Usurper commentedYou subscribed to a closed thread?
Get rc3: it has the fix in it.