events - 如何向 Shopware 中的帐户 Controller 添加操作

标签 events shopware

如何向 Shopware 中的现有 Controller 添加自定义操作?

示例(url 结构):

/account/bonus
/account/custom
/account/...

通常,为此目的创建新 Controller 会更容易、更清晰,但在某些情况下这是必要的。

最佳答案

您不应更换“帐户” Controller 。 您可以使用以下命令为现有 Controller 定义自己的操作:

public static function getSubscribedEvents()
    {
        return [
            'Enlight_Controller_Action_Frontend_Account_MyBonus'        => 'onAccountMyBonus',        
      ];
    }

然后

public function onAccountMyBonus(\Enlight_Event_EventArgs $args)
    {
        $args->setProcessed(true);
        .....
         your code here
}

关于events - 如何向 Shopware 中的帐户 Controller 添加操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46340089/

相关文章:

javascript - 即使聚焦并且 CSS 规则生效,HTML 按钮也不会单击

apache-flex - 何时扩展 EventDispatcher

shopware - 如何在现有安装中安装 Shopware 演示数据?

request - 如何在shopware 6中访问订阅者中的请求数据

migration - 移动不同版本的商店软件内容

twig - 如何从当前URL获取相对URL

symfony - 商店用品 6 : How to add Products with variation as childrens to Parent Products in LineItems

javascript - 基本事件监听器抛出错误 ('undefined is not a function' )

c# - 在引发事件的方法上编写代码契约

javascript - 在 IE6 中为 li 元素添加 onclick 事件