Sylius: It's possible to use custom messages when a form is successfuly sumbitted?

Created on 26 Sep 2016  ·  6Comments  ·  Source: Sylius/Sylius

Hi Syliusers, I'm asking about is possible to change the preseted messages about a form save data successfully.

Most helpful comment

Yes, it is a standard message from ResourceBundle.

I guess that you could overwrite the routing and specify your own flash message like we have for example in cart.yml: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/ShopBundle/Resources/config/routing/cart.yml#L20

All 6 comments

I guess you're looking for the Resources/translations/flashes.[locale].yml files of your bundle, where you can put something like :

sylius.customer.create: "Your account was successfully created !"

if you want to override the message when a customer is created for instance. Does that help ?

Uhm, maybe but i cant do it work.

I want to change de flash message showed when my cart has changed.

http://docs.sylius.org/en/latest/customization/translation.html

All the flashes connected to cart changes are here:

# SyliusOrderBundle:Resources/translations/flashes.en.yml
sylius:
    cart:
        cart_save_completed: The cart has been successfully updated.
        cart_clear_completed: The cart has been successfully cleared.
        item_add_completed: Item has been added to cart.
        item_remove_completed: Item has been removed from cart.
        item_add_error: Error occurred while adding item to cart.
        item_remove_error: Error occurred while removing item from cart.

And by the way - I would suggest to ask such questions rather on StackOverflow not here in the issues, this is a thing that works in Sylius.

Hi @TheMadeleine thanks for your response. You are right about i must ask this questions on stackoverflow, sorry about that.

Getting back to my question, i found translation files a long time ago but the translations doesn't match with the messages that i saw in the webpage.

When I make changes any fields on Order entity, the flash message shows like this
captura de pantalla 2016-09-27 a las 9 28 17

Seems as standard message for all entities.

Yes, it is a standard message from ResourceBundle.

I guess that you could overwrite the routing and specify your own flash message like we have for example in cart.yml: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/ShopBundle/Resources/config/routing/cart.yml#L20

@GSadee Thanks, that was what I was looking for.

Closing issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xleliberty picture xleliberty  ·  3Comments

stefandoorn picture stefandoorn  ·  3Comments

Chrysweel picture Chrysweel  ·  3Comments

javiereguiluz picture javiereguiluz  ·  3Comments

eb22fbb4 picture eb22fbb4  ·  3Comments