更改 Uber 购物车中的数量标签?
如何在不实际破解核心组件的情况下更改 UberCart(在 Drupal 中)中的 QTY(数量)标签?我希望标签是几个月,而不是数量。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 字符串覆盖 模块。以下是其项目页面的摘录:
我曾经在另一种语言(德语)中遇到过类似的 Ubercart 问题,我们通过重新翻译字符串来“解决”它。提到的模块应该可以满足您的情况。
You could use the String Overrides module. Here is an excerpt from its project page:
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.
我没有使用过 ubercarts,但我猜会有一个管理部分来做到这一点。否则 hook_form_alter() 或 hook_form_FORM_ID_alter() 应该能够为您解决问题。
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.
不幸的是,ubercart 中没有此设置。
在当前的 ubercart-6.x-2.0-rc7 版本中搜索“Qty”(区分大小写,因为代码中有很多“qty”)会得到 7 个匹配项:
hook_form_alter
进行更改,正如 googletorp 建议的那样hook_tapir_table_alter
进行更改/orhook_tapir_table_header_alter
(请参阅 ubercarts doc 目录中的 hooks.php 文件)因此您应该能够在不更改模块本身的情况下实现更改,但考虑到所涉及的工作量,我会首先尝试 schnecks 的建议;)
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:
hook_form_alter
as googletorp suggestedhook_tapir_table_alter
and/orhook_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 ;)