1

Ubercart for Drupal 7: Attribute Options separated from label by comma

Discovering Product Attributes in Ubercart was quite a find. However, my client does not like the way the dropdown looks. Previously, all the prices had + in front of them, but I was able to remove them taking a clue from questions by other Drupal users (sites/modules/ubercart/uc_attribute/uc_attribute.module line 1361). But, finding where to get rid of the comma eludes me.

If you have any further clues, I would be most appreciative!

3 Answers 3

1

theme_uc_attribute_option($option, $price) is what you're looking for. Override that theme function in your theme and you can eliminate the "," & the price adjustment amount.

2
  • Thanks so much for the clue! For anyone who is new to the Drupal file structure, I found the function that Shawn mentioned in sites/all/modules/ubercart/uc_attribute.theme.inc. The file I was looking in was sites/modules/ubercart/uc_attribute/uc_attribute.module. So, obviously, I couldn't find it because I was in the wrong place. Now, I will admit that while I have worked extensively in the some basic theme files, I have never worked in Drupal functions. I know from best practices in WordPress that you should not override anything in original files, if possible. Where do I go to override? Commented Apr 11, 2015 at 20:25
  • Thanks! I'm sure that will come in handing for other functions as well! Commented Apr 16, 2015 at 1:59
1

For Drupal 7, Ubercart 3...

Go to: admin/store/settings/products > Attribute settings

Tick "Display total price" and save.

0

Add span and Class in the file uc_attribute.theme.inc under function theme_uc_attribute_option like shown below..and apply your class or style to it $output .= ' ' . $variables['price'].'';

1
  • Hi @urvesh, welcome to Drupal Answers. To improve your answer, please describe how one can hook into theme_uc_attribute_option() in a custom theme's template.php for example instead of altering the contributed module. Thanks! Commented Mar 6, 2017 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.