hello my friends, first post here! Hope yall having a great day.
I need your help for a task that i’ve working for the past two days. I actually need to add the possibility to login during checkout.
my steps: cart -> account (login/register) -> payment -> complete.
i’ve overriden state_machine in the _sylius.yaml, checkout.yml in config/routes/ and sylius_shop.checkout_resolver into _sylius.yaml
Result:
_sylius.yaml:
sylius_shop:
product_grid:
include_all_descendants: true
locale_switcher: storage
checkout_resolver:
pattern: /checkout/.+
route_map:
empty_order:
route: sylius_shop_cart_summary
account:
route: sylius_shop_account_checkout
payment_selected:
route: sylius_shop_checkout_complete
payment_skipped:
route: sylius_shop_checkout_complete
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: ~
logged: ~
payment_selected: ~
completed: ~
transitions:
account:
from: [cart]
to: logged
skip_payment:
from: [logged]
to: payment_skipped
select_payment:
from: [logged, payment_selected]
to: payment_selected
complete:
from: [payment_selected, payment_skipped]
to: completed
callbacks:
after:
sylius_process_cart:
on: ["logged", "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"]
sylius_skip_shipping:
on: ["logged"]
do: ["@sylius.state_resolver.order_checkout", "resolve"]
args: ["object"]
priority: 1
sylius_skip_payment:
on: ["logged"]
do: ["@sylius.state_resolver.order_checkout", "resolve"]
args: ["object"]
priority: 1
routes/checkout.yml
sylius_shop_checkout_start:
path: /
methods: [GET]
defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController:redirectAction
route: sylius_shop_account_checkout
sylius_shop_account_checkout:
path: /account
methods: [GET]
defaults:
_controller: sylius.controller.security.custom:loginAction
_sylius:
event: login
flash: false
template: "@SyliusShop/checkout_login.html.twig"
state_machine:
graph: sylius_order_checkout
transition: account
sylius_shop_checkout_select_payment:
path: /select-payment
methods: [GET, PUT]
defaults:
_controller: sylius.controller.order:updateAction
_sylius:
event: payment
flash: false
template: "@SyliusShop/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:
The issue: i’m in my cart at localhost/cart, i proceed to checkout and i arrive on my login page at localhost/checkout/account; I log in but the /checkout/account keeps on reloading even tho i’m already logged in (localhost/account/dashboard).
i’m sure that i’ve messed my configuration somewhere, but i just can’t find any resources to help me out on that one.
I’d love to hear your advices, thanks in advance.
Victor.