Add optional label to attributes allowing attributes to share the same label

sammys - April 18, 2009 - 02:45
Project:Ubercart
Version:6.x-2.0-rc2
Component:Code
Category:task
Priority:normal
Assigned:sammys
Status:closed
Description

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.

#1

sammys - April 18, 2009 - 02:51

Patch attached!

AttachmentSize
437268_200904181250+1000.patch 16.15 KB

#2

Island Usurper - April 18, 2009 - 06:16
Status:active» needs review

Okey 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.

AttachmentSize
attribute_label.patch 14.98 KB

#3

Island Usurper - April 18, 2009 - 07:03

Going off some of Ryan's suggestions for usability, labels' default values should be the attribute's name if they are empty.

AttachmentSize
attribute_label.patch 15.17 KB

#4

rszrama - April 18, 2009 - 07:08
Version:6.x-2.x-dev» 6.x-2.0-beta6
Status:needs review» fixed

Fixed a bugfix and column title. Committing as is, we can refine as we go.

#5

sammys - April 18, 2009 - 11:01
Status:fixed» reviewed & tested by the community

There's a typo that I left there when changing function name. Patch attached.

AttachmentSize
437268_200904182100+1000.patch 1.18 KB

#6

rszrama - April 18, 2009 - 16:50
Version:6.x-2.0-beta6» 6.x-2.0-rc1
Status:reviewed & tested by the community» fixed

Fixed! 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

#7

sammys - April 18, 2009 - 23:14

All good Ryan! Thanks for accepting the patch and for all the work to get it to RC! :) You all deserve some Chick-fil-a! :)

#8

System Message - May 2, 2009 - 23:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#9

AliaK - May 6, 2009 - 14:24
Version:6.x-2.0-rc1» 6.x-2.0-rc2

hi, 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)

AttachmentSize
uc_attribute.module_original.txt 28.37 KB

#10

Island Usurper - May 6, 2009 - 17:54

I 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.

#11

AliaK - May 7, 2009 - 03:09

thanks. 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)

#12

asak - May 14, 2009 - 11:41

subscribing.

#13

Island Usurper - May 14, 2009 - 16:25

You subscribed to a closed thread?

Get rc3: it has the fix in it.

 
 

Drupal is a registered trademark of Dries Buytaert.