英文:
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:
# ...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论