2

How do you change the QTY (quantity) label in UberCart (in Drupal) without actually hacking the core components? I want the label to be be months, instead of qty.

rockstardev
  • 13,479
  • 39
  • 164
  • 296

3 Answers3

2

I haven't used ubercarts, but I would guess there would be an admin section to do that. Else hook_form_alter() or hook_form_FORM_ID_alter() should be able to do the trick for you.

googletorp
  • 33,075
  • 15
  • 67
  • 82
2

You could use the String Overrides module. Here is an excerpt from its project page:

Provides a quick and easy way to replace any text on the site.

Features:

  • Easily replace anything that's passed through t()
  • Locale support, allowing you to override strings in any language
  • Ability to import/export *.po files, for easy migration from the Locale module
  • Note that this is not a replacement to Locale as having thousands of overrides can cause more pain then benefit. Use this only if you need a few easy text changes.

I once ran into a similar issue with Ubercart in another language (German), and we "solved" it by re-translating the string. The mentioned module should do the trick in your case.

Community
  • 1
  • 1
schneck
  • 10,556
  • 11
  • 49
  • 74
1

Unfortunately, there is no setting for this in ubercart.

Doing a search for 'Qty' (case sensitive, as there are numerous 'qty' in code) in the current ubercart-6.x-2.0-rc7 release gives seven matches:

  • 3 in theme functions, which you'd need to override in your theme
  • 1 in a form definition, which you'd need to change via hook_form_alter as googletorp suggested
  • 3 in table definitions, which you'd need to change via hook_tapir_table_alter and/or hook_tapir_table_header_alter (see the hooks.php file in ubercarts doc directory for these)

So you should be able to implement your changes without changing the module itself, but given the amount of work involved, I'd try schnecks suggestion first ;)

Henrik Opel
  • 19,341
  • 1
  • 48
  • 64