OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce Quick order form: how to change default button?

This topic contains 14 replies, has 2 voices, and was last updated by  Mauro Chojrin 1 week, 6 days ago.

  • Creator
    Topic
  • #40417

    Mauro Chojrin
    Participant

    Hi:

    I’m trying to change the default button on the quick order form from “Add to…” (Shopping list) to “Create order”.

    Is there a way to do this without modifying the code?

    Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Author
    Replies
  • #40428
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    Hi Mauro,
    Maybe I understand you wrong, but there is no default button on a quick order form, and the shopping list button just highlighted with a CSS class “btn–info”, nothing more.

    Is there a way to do this without modifying the code?

    No,
    If you want to change the style of the buttons to remove btn–info class from the shopping list button and add it to the create order button from the code – you can override the template that renders “add to shopping list” button
    vendor/oro/commerce/src/Oro/Bundle/ShoppingListBundle/Resources/views/Action/buttons.html.twig
    and update frontend_options of start_from_quickorderform transition in a checkout workflow.

    #40434

    Mauro Chojrin
    Participant

    Got it. Thanks for the clarification :)

    In order to override that template, should I create a new Bundle?

    #40783

    Mauro Chojrin
    Participant

    Hi Andrey:

    I’m working on this again and I’m not exactly sure how to go about it.

    I have two main issues:

    1 – Where should the new template be located? Currently I placed it at src/Leeway/Bundle/ThemeBundle/templates/Bundles/ShoppingListBundle/Resources/views/Action/buttons.html.twig is this correct?
    2 – I don’t fully understand where I should make the css change

    Here’s the code of the original template:

    Could I get some more detail? Thanks!

    #40785
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    Hi Mauro,

    See how to override the twig templates article in this article: https://doc.oroinc.com/frontend/back-office/templates/#override-twig-templates.
    For the second question see the CSS guide https://doc.oroinc.com/frontend/back-office/css/

    #40798

    Mauro Chojrin
    Participant

    Thanks Andrey!

    So far I got to confirm the correct location of the new template:

    I have to say this mapping has always been somewhat cumbersome for me (In Symonfy in general, not oro in particular)… I’m still trying to figure out the css part, but I’m getting closer :)

    #40799

    Mauro Chojrin
    Participant

    So, after digging a lot into the code (grepping files here and there) I got to this file: vendor/oro/commerce/src/Oro/Bundle/CheckoutBundle/Resources/config/oro/workflows/includes/base_transitions.yml where there’s a section I believe should be responsible for the rendering of the “Create Order” button:

    So I added the last line to try and see what happened, I cleared the cache… but nothing changed :(

    I did succeed in removing the btn–info class from the “Add to Quick Order” button, but I think the other button is somewhere else…

    #40803
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    After updating the workflow configuration, it is required to reload its state at the database with the command

    #40881

    Mauro Chojrin
    Participant

    Thanks Andrey:

    I did this and it works. The problem I have is that I made the change directly within the vendor directory and, as I suspected, once I deployed a new minor version everything went back to the way it was and I had to re-apply the change…

    How can I make this change permanent?

    Thanks!

    #40887
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator
    #40901

    Mauro Chojrin
    Participant

    Thanks. I followed that guide and my new workflow is showing in the workflow configuration panel but I don’t see the change.

    I tried de-activating the Alternative Checkout workflow but it didn’t seem to make a difference.

    I cleared my cache and that didn’t work either…

    Am I missing something?

    #40957

    Mauro Chojrin
    Participant

    I finally understood my mistake: I was following the instructions too literally :)

    I cloned the alternativecheckout workflow when what I actually needed to clone was b2b_flow_checkout.

    Once I did that the change was applied.

    The problem I’m having now is with the translation of the label… for some reason I don’t understand it’s not taking it.

    Even though I did create a translation file I still see the label like this:

    #40959
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator
    #40961

    Mauro Chojrin
    Participant

    Hi Andrey:

    Thanks, sorry to bug you.

    I went through the documentation you pointed me to and I thought the problem was that I was using “en_US” as locale instead of “en” (Which is the one I used when dumping, so the resulting file is src/Leeway/Bundle/ThemeBundle/Resources/translations/workflows.en.yml).

    I issued the following commands:

    But when I go to the translations panel I don’t see any translations under any key that contains
    b2b_flow_checkout_cloned.

    What am I doing something wrong?

    Thanks

    #40982

    Mauro Chojrin
    Participant

    I just deployed my new version to production and it worked.

    I think I might have had an issue with the name of my cloned workflow and my translation file… anyway, thanks for your help!

Viewing 14 replies - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No