我知道这样的主题已经存在,但经过大量的测试后,解决方案对我来说并不合适。
这是我的问题:
我想删除Sylius(Adressing and Shipping)结帐的第一步和第二步。我做了这个代码:
# app/Resources/SyliusShopBundle/config/routing/checkout.yml
sylius_shop_checkout_start:
path: /
methods: [GET]
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: sylius_shop_checkout_select_payment
sylius_shop_checkout_select_payment:
path: /select-payment
methods: [GET, PUT]
defaults:
_controller: sylius.controller.order:updateAction
_sylius:
event: payment
flash: false
template: SyliusShopBundle:Checkout:selectPayment.html.twig
form: Sylius\Bundle\CoreBundle\Form\Type\Checkout\SelectPaymentType
repository:
method: findCartForSelectingPayment
arguments:
- "expr:service('sylius.context.cart').getCart().getId()"
state_machine:
graph: sylius_order_checkout
transition: select_payment
sylius_shop_checkout_complete:
path: /complete
methods: [GET, PUT]
defaults:
_controller: sylius.controller.order:completeAction
_sylius:
event: complete
flash: false
template: SyliusShopBundle:Checkout:complete.html.twig
repository:
method: find
arguments:
- "expr:service('sylius.context.cart').getCart()"
state_machine:
graph: sylius_order_checkout
transition: complete
redirect:
route: sylius_shop_order_pay
parameters:
tokenValue: resource.tokenValue
form:
type: Sylius\Bundle\CoreBundle\Form\Type\Checkout\CompleteType
options:
validation_groups: 'sylius_checkout_complete'
{# app/Resources/SyliusShopBundle/views/Checkout/_steps.html.twig #}
{% if active is not defined or active == 'select_payment' %}
{% set steps = {'select_payment': 'active', 'complete': 'disabled'} %}
{% else %}
{% set steps = {'select_payment': 'completed', 'complete': 'active'} %}
{% endif %}
{% set order_requires_payment = sylius_is_payment_required(order) %}
{% set steps_count = 'two' %}
<div class="ui {{ steps_count }} steps">
<a class="{{ steps['select_payment'] }} step" href="{{ path('sylius_shop_checkout_select_payment') }}">
<i class="payment icon"></i>
<div class="content">
<div class="title">{{ 'sylius.ui.payment'|trans }}</div>
<div class="description">{{ 'sylius.ui.choose_how_you_will_pay'|trans }}</div>
</div>
</a>
<div class="{{ steps['complete'] }} step" href="{{ path('sylius_shop_checkout_complete') }}">
<i class="checkered flag icon"></i>
<div class="content">
<div class="title">{{ 'sylius.ui.complete'|trans }}</div>
<div class="description">{{ 'sylius.ui.review_and_confirm_your_order'|trans }}</div>
</div>
</div>
</div>
#app/config/config.yml
sylius_shop:
checkout_resolver:
pattern: /checkout/.+
route_map:
cart:
route: sylius_shop_checkout_select_payment
payment_selected:
route: sylius_shop_checkout_complete
#app/Resources/SyliusCoreBundle/config/app/state_machine/sylius_order_checkout.yml
winzou_state_machine:
sylius_order_checkout:
class: "%sylius.model.order.class%"
property_path: checkoutState
graph: sylius_order_checkout
state_machine_class: "%sylius.state_machine.class%"
states:
cart: ~
payment_skipped: ~
payment_selected: ~
completed: ~
transitions:
select_payment:
from: [cart, payment_selected]
to: payment_selected
complete:
from: [payment_selected]
to: completed
callbacks:
after:
sylius_process_cart:
on: ["select_payment"]
do: ["@sylius.order_processing.order_processor", "process"]
args: ["object"]
sylius_create_order:
on: ["complete"]
do: ["@sm.callback.cascade_transition", "apply"]
args: ["object", "event", "'create'", "'sylius_order'"]
sylius_save_checkout_completion_date:
on: ["complete"]
do: ["object", "completeCheckout"]
args: ["object"]
{# app/Resources/SyliusShopBundle/views/Checkout/SelectPayment/_navigation.html.twig #}
{% set enabled = order.payments|length %}
<div class="ui two column grid">
<div class="column">
<a href="{{ path('sylius_shop_checkout_select_payment') }}" class="ui large icon labeled button"><i class="arrow left icon"></i> {{ 'sylius.ui.change_address'|trans }}</a>
</div>
<div class="right aligned column">
<button type="submit" id="next-step" class="ui large primary icon labeled{% if not enabled %} disabled{% endif %} button">
<i class="arrow right icon"></i>
{{ 'sylius.ui.next'|trans }}
</button>
</div>
</div>
这是我的问题:
URI“/ en_US / checkout / complete”的控制器不可调用。类“Sylius \ Bundle \ CoreBundle \ Controller \ OrderController”上的预期方法“completeAction”,您的意思是“deleteAction”吗?
感谢您的时间