Sylius: [Doc] Can't override sylius_order_checkout states
Hello. i’m having problems to override states in sylius_order_checkout process. First thing i tried is follow instructions, but placing the file where it says, it doesn’t seem to have any effect in the configurations…
Second thing i tried is to override this from my own bundle. so, i added a sylius_checkout_order.yml there and imported it from my config.yml. Just for testing purposes i added dummy values to the file. The plan is remove the shipping_selected state, so i went like
winzou_state_machine:
sylius_order_checkout:
class: my_class
property_path: checkoutState
graph: sylius_order_checkout_my_graph
state_machine_class: "%sylius.state_machine.class%"
states:
cart: ~
addressed: ~
payment_selected: ~
completed: ~
Now the problem: While the class and graph values are overrided, it looks i cannot delete that shipping_selected stated. doing a debug:container i can see this
winzou_state_machine:
sylius_order_checkout:
class: my_class
property_path: checkoutState
graph: sylius_order_checkout_my_graph
state_machine_class: Sylius\Component\Resource\StateMachine\StateMachine
states:
cart: null
addressed: null
shipping_selected: null
payment_selected: null
completed: null
As you see, shipping_selected is there and i can’t find the way to remove it. just for testing i modified my yml to be like
winzou_state_machine:
sylius_order_checkout:
class: my_class
property_path: checkoutState
graph: sylius_order_checkout_my_graph
state_machine_class: "%sylius.state_machine.class%"
states:
a_dummy_state: ~
Doing the debug again i can see
winzou_state_machine:
sylius_order_checkout:
class: my_class
property_path: checkoutState
graph: sylius_order_checkout_my_graph
state_machine_class: Sylius\Component\Resource\StateMachine\StateMachine
states:
cart: null
addressed: null
shipping_selected: null
payment_selected: null
completed: null
a_dummy_state: null
So, looks that’s something, and maybe not in the Sylius side, is merging the states isteand of replacing them? Or am i missing something here?
Thanks a lot.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (6 by maintainers)
it worked , its a problem of cache , knowing that i’ve cleared it yesterday and nothing changed , and i’ve did it again now and it worked , confusing !!
hmm, overriding the the getContainerLoaded and following the instructions worked for me perfectly…
@crevillo I had the same issue. This is my way of solution. I overwrite the getContainerLoader method in app/AppKernel.php like this:
After the instruction will work correctly.
Then you need more work, You need to work in the OrderProcessors. These ones are executed in every step or your process. This one assigns a default shipment to your order/cart as soon as it’s created. you’ll probably need to override this so the method doesn’t get added to the other.
this make sense, afaik, if you still have some shipping method enabled for your channel and for the zone. by default, when you add the product sylius adds a shipment if it finds one.
let the others correct me if i’m wrong, but i think yo need to delete every shipment method from your shop.
hi , i’ve did all the instructions and i’ve overrided the getContainerLoader method in app/AppKernel.php and when i click next in the payment step it keeps redirect me to payment step ? what can be the problem