如何从我的模块动态更改 ubercart 的默认消息
对于某些产品,我希望有一个与默认值不同的特殊结账完成消息。
我知道我可以通过将默认重定向页面更改为其他内容来做到这一点。 [我不确定这是否会引入另一个问题]
但是,我想知道是否有标准/更好的方法来解决这个问题。
谢谢!,
D
There are some products for which I would like to have a special checkout complete message that would differ from the default.
I know that I could probably do this by changing the default redirect page to something else. [And I'm not sure if that would introduce another problem]
However, I would like to know if there is a standard/better way of approaching this problem.
Thanks!,
D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
考虑字符串覆盖模块。这是关于它的引用(来自模块的项目页面):
Consider the String Overrides module. Here is a quote about it (from the module's project page):
我想做我正在考虑的事情的唯一其他可能的方法是覆盖 ubercart 用于显示消息的主题函数。这似乎是最有意义的。
在这种情况下,我将覆盖 theme_uc_cart_complete_sale
我可以设置 a
,然后将 $message 设置为我的 $special_message(如果已设置)。
最后,要从我的模块覆盖,我需要挂钩预处理挂钩:
重要的是要注意在模块中拥有此函数是不够的。仅当调用覆盖主题函数的模板文件时,才会调用预处理函数。
更多详细信息请访问 http://drupal.org/node/223430
I guess the only other possible way of doing what I am thinking of is to override the theme function that ubercart uses to display the message. And this probably seems like it would make the most sense.
In this case I would override theme_uc_cart_complete_sale
I could set a
and then set $message to my $special_message if it's been set.
Finally, to override from my module I will need to hook into the pre-process hook:
It is important to note that it is not enough to have this function in your module. The preprocess functions are only invoked when the template file that overrides the theme function is called.
More details can be found at http://drupal.org/node/223430