覆盖 Sylius 中的结帐流程

huangapple go评论89阅读模式
英文:

Overide checkout process in Sylius

问题

这是我第一次使用Sylius,我很难找到关于它的任何信息。

我想要覆盖整个结账流程,使用我的自定义结账流程。

我已经尝试覆盖路由,但似乎不起作用。

我在我的routes.yaml文件中添加了以下内容:

sylius_checkout_address:
    path: /checkout/address
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_select_shipping:
    path: /checkout/select-shipping
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_select_payment:
    path: /checkout/select-payment
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_complete:
    path: /checkout/complete
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

我只是想看看是否可以输出"Hello World"然后结束程序。

但我仍然得到旧的结账流程。

英文:

This is my first time working with sylius and i am having a hard time trying to get my hands on any form of information regarding it.

I would like to overide all of the checkout with my custom checkout.

I have tried to overide the routes but it doesnt seem to work.

i added this in my routes.yaml

sylius_checkout_address:
    path: /checkout/address
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_select_shipping:
    path: /checkout/select-shipping
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_select_payment:
    path: /checkout/select-payment
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

sylius_checkout_complete:
    path: /checkout/complete
    methods: [GET, POST]
    defaults:
        _controller: open_marketplace.controller.test_controller::helloWorld

i am just trying to see if i can even just echo hello world and die().

But i still get the old checkout process.

答案1

得分: 0

覆盖Symfony中的路由始终是可能的。

最后一个路由生效,因此确保您首先加载Sylius路由,然后添加自己的路由定义。

路由的名称必须与原始路由完全相同。我猜在您的情况下,路由的名称如下:

sylius_shop_checkout_start:
  # ...

sylius_shop_checkout_address:
  # ...

sylius_shop_checkout_select_shipping:
  # ...

sylius_shop_checkout_select_payment:
  # ...

sylius_shop_checkout_complete:
  # ...
英文:

Overwriting the routes in symfony is always possible.

The last route counts, so make sure you load the sylius routes first and then add your own route definition.

The route must be named exactly like the original one. I guess in your case the routes named:

sylius_shop_checkout_start:
  # ...

sylius_shop_checkout_address:
  # ...

sylius_shop_checkout_select_shipping:
  # ...

sylius_shop_checkout_select_payment:
  # ...

sylius_shop_checkout_complete:
  # ...

huangapple
  • 本文由 发表于 2023年6月13日 16:30:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463030.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定