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..

Hello all, I added a step in the checkout following this tutorial:

Options
U048WDEP3R7
U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

Hello all,

I added a step in the checkout following this tutorial: https://docs.spryker.com/docs/pbc/all/cart-and-checkout/tutorials-and-howtos/tutorial-checkout-and-step-engine.html#add-the-voucher-step

Everything works OK(ish) except I see breadcrumbs 2 times. Can someone please advise.

Comments

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

    did u add the steps multiple times to your step collection maybe? can u show your StepFactory? would be my first guess

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @UNGMX0012 Here is my StepFactory

    <?php
    
    namespace Pyz\Yves\CheckoutPage\Process;
    
    use Pyz\Yves\CheckoutPage\Plugin\Router\CheckoutPageRouteProviderPlugin;
    use Pyz\Yves\CheckoutPage\Process\Steps\VoucherStep;
    use Spryker\Yves\StepEngine\Process\StepCollection;
    use Spryker\Yves\StepEngine\Process\StepCollectionInterface;
    use SprykerShop\Yves\CheckoutPage\Plugin\Router\CheckoutPageRouteProviderPlugin as CheckoutPageRouteProviderPluginAlias;
    use SprykerShop\Yves\CheckoutPage\Process\StepFactory as SprykerShopStepFactory;
    use SprykerShop\Yves\HomePage\Plugin\Router\HomePageRouteProviderPlugin;
    
    /**
     * @method \SprykerShop\Yves\CheckoutPage\CheckoutPageConfig getConfig()
     */
    class StepFactory extends SprykerShopStepFactory
    {
        /**
         * @return StepCollectionInterface
         */
        public function createStepCollection()
        {
            $stepCollection = new StepCollection(
                $this->getUrlGenerator(),
                CheckoutPageRouteProviderPluginAlias::ROUTE_NAME_CHECKOUT_ERROR
            );
    
            $stepCollection
                ->addStep($this->createEntryStep())
                ->addStep($this->createCustomerStep())
                ->addStep($this->createAddressStep())
                ->addStep($this->createShipmentStep())
                ->addStep($this->createPaymentStep())
                ->addStep($this->createVoucherStep())
                ->addStep($this->createSummaryStep())
                ->addStep($this->createPlaceOrderStep())
                ->addStep($this->createSuccessStep());
    
            return $stepCollection;
        }
    
        /**
         * @return VoucherStep
         */
        public function createVoucherStep(): VoucherStep
        {
            return new VoucherStep(
                $this->getCalculationClient(),
                CheckoutPageRouteProviderPlugin::ROUTER_CHECKOUT_VOUCHER,
                HomePageRouteProviderPlugin::ROUTE_NAME_HOME
            );
        }
    }
    
  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet
    Options

    factory looks ok, can offer to have a look together

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    Hello @UNGMX0012, we figured this out. This is the updated code and it works:

    <?php
    
    namespace Pyz\Yves\CheckoutPage\Process;
    
    use Pyz\Yves\CheckoutPage\Plugin\Router\CheckoutPageRouteProviderPlugin;
    use Pyz\Yves\CheckoutPage\Process\Steps\VoucherStep;
    use Spryker\Yves\StepEngine\Dependency\Step\StepInterface;
    use SprykerShop\Yves\CheckoutPage\Process\StepFactory as SprykerShopStepFactory;
    use SprykerShop\Yves\HomePage\Plugin\Router\HomePageRouteProviderPlugin;
    
    
    class StepFactory extends SprykerShopStepFactory
    {
         /**
         * @return array<StepInterface>
         */
        public function getSteps(): array
        {
            return [
                $this->createEntryStep(),
                $this->createCustomerStep(),
                $this->createAddressStep(),
                $this->createShipmentStep(),
                $this->createPaymentStep(),
                $this->createVoucherStep(),
                $this->createSummaryStep(),
                $this->createPlaceOrderStep(),
                $this->createSuccessStep(),
                $this->createErrorStep(),
            ];
        }
    
        /**
         * @return VoucherStep
         */
        public function createVoucherStep(): VoucherStep
        {
            return new VoucherStep(
                $this->getCalculationClient(),
                CheckoutPageRouteProviderPlugin::ROUTER_CHECKOUT_VOUCHER,
                HomePageRouteProviderPlugin::ROUTE_NAME_HOME
            );
        }
    }
    
  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet
    Options

    nice, yes we did it the same way using getSteps(). had this in mind already. glad u fixed it 👍

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

    so, outdated docu? 🤔

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet
    Options

    @UNGMX0012 Yes it seems like the documentation is outdated.

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

    I created a pr to fix the outdated docu: https://github.com/spryker/spryker-docs/pull/1403