更改 Uber 购物车中的数量标签?

发布于 2024-08-06 11:28:56 字数 75 浏览 3 评论 0原文

如何在不实际破解核心组件的情况下更改 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

溺孤伤于心 2024-08-13 11:28:56

您可以使用 字符串覆盖 模块。以下是其项目页面的摘录:

提供了一种快速、简单的方法来替换网站上的任何文本。

特点:

  • 轻松替换通过 t() 传递的任何内容
  • 区域设置支持,允许您覆盖任何语言的字符串
  • 能够导入/导出 *.po 文件,以便从区域设置模块轻松迁移
  • 请注意,这并不是 Locale 的替代品,因为数以千计的覆盖可能会带来更多的痛苦而不是好处。仅当您需要进行一些简单的文本更改时才使用此选项。

我曾经在另一种语言(德语)中遇到过类似的 Ubercart 问题,我们通过重新翻译字符串来“解决”它。提到的模块应该可以满足您的情况。

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.

蝶…霜飞 2024-08-13 11:28:56

我没有使用过 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.

昔日梦未散 2024-08-13 11:28:56

不幸的是,ubercart 中没有此设置。

在当前的 ubercart-6.x-2.0-rc7 版本中搜索“Qty”(区分大小写,因为代码中有很多“qty”)会得到 7 个匹配项:

  • 主题函数中有 3 个匹配项,您需要覆盖它们在您的主题中
  • 1 在表单定义中,您需要通过 hook_form_alter 进行更改,正如 googletorp 建议的那样
  • 3 在表定义中,您需要通过 hook_tapir_table_alter 进行更改/or hook_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:

  • 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 ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文