Calling Developers!
We are reenergizing our code contribution process! Learn More

What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi there. I'm trying to add a custom step to the Yves Checkout Page. I have my step ready (implement

Options
U04BCHQVACE
U04BCHQVACE Posts: 39 🧑🏻‍🚀 - Cadet

Hi there. I'm trying to add a custom step to the Yves Checkout Page. I have my step ready (implemented the right interfaces and extended the quote transfer, created twig templates and forms, etc). However, I'm having issues wiring up everything together. For instance, the standard steps are created here, and passed to the step resolver here. Is there a way I can override this and insert my custom step before the Payment Step?

My guess is to extend and override the StepFactory under the Process folder. Can be that done in the Pyz folder under src? I'm asking because this factory is outside the traditional location (root of the module), and invoked by the main factory here, so that's why I'm a bit confused.

I hope that was clear enough. Any help would be greatly appreciated! 🙂

Comments

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    edited December 2022
    Options

    Hi, just extend CheckoutPageFactory in Pyz/Yves/CheckoutPage and override

    /**
     * @return \Pyz\Yves\CheckoutPage\Process\StepFactory
     */
    public function createStepFactory(): StepFactory
    {
        return new StepFactory();
    }
    
  • U04BCHQVACE
    U04BCHQVACE Posts: 39 🧑🏻‍🚀 - Cadet
    Options

    Oh okay cool, and I can then extend that StepFactory or implement my own. Thanks! 🙂

  • UK7KBE2JW
    UK7KBE2JW Posts: 463 🧑🏻‍🚀 - Cadet
    Options

    sure

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet
    Options

    there was a similar thread days ago which is also pointing to the (outdated) docu and how he solved it: https://sprykercommunity.slack.com/archives/CKJRJM5FG/p1669219555825659 … maybe helps

  • U04BCHQVACE
    U04BCHQVACE Posts: 39 🧑🏻‍🚀 - Cadet
    Options

    Thanks! I'll have a look!

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    edited December 2022
    Options

    actually i am currently updating exactly that docu based on the feedback. hopefully it is online next week 🙂

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,034 ⚖️ - Guardians (admin)
    Options

    (taking Sebastians PR and fix also all the other parts which are outdated)

  • U04BCHQVACE
    U04BCHQVACE Posts: 39 🧑🏻‍🚀 - Cadet
    Options

    Thank you guys. I've made it work now.

    It would be cool to document a way of doing it without using too much inheritance. Obviously there is a ton of functionality that need to be reused in checkout (forms, step engine, router, etc) so I would not know how.