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 all, I have another question about splitting items when an order is created, Just to make it more

UKEP86J66
UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet
edited June 2020 in Help

Hi all, I have another question about splitting items when an order is created, Just to make it more interesting this time it is about bundle products. πŸ™‚
In our shop the products 'inside' a bundle product could be normal products that are buyable in the shop or products that only exist in that bundle (or other bundles) and are not buyable on their own. These last products have no prices so we had to adapt pub/sync to make those products available in Yves, but there will also be issues with add to cart and creating orders - when the order is split we will have products without prices in our order. Or we won't, because things will break before then πŸ™‚
We could extend all of the cart/order operations to make this work but it feels like there should be an easier way. Is there a way to avoid splitting the bundle in the order, for example?

Comments

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hi Rick πŸ‘‹
    The order item splitting logic comes from here: \Spryker\Zed\Sales\Business\SalesFacadeInterface::expandSalesOrder().
    and the transformation itself happens here: \Spryker\Zed\Sales\Business\Model\Order\OrderExpander::applyItemTransformStrategyPlugin(). According to that, you would need to introduce your custom ItemTransformerStrategyPluginInterface which will (based on the product type bundle) skip the splitting and return item as-is, bypassing the standard qty-based splitting.

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    but there will also be issues with add to cart and creating orders

    here I’m not sure.. if you have an item in your cart (bundle), that doesn’t have price - how do you calculate totals?

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hey Andrily, thanks we looked at the ItemTransformerStrategyPluginInterface for another feature but got some strange behaviour. I will try it again for the bundles.

  • UKEP86J66
    UKEP86J66 Posts: 208 πŸ§‘πŸ»β€πŸš€ - Cadet

    For bundle prices we want to only use the price on the bundle itself - the prices of the products inside are not relevant.

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 πŸ§‘πŸ»β€πŸš€ - Cadet

    okay, got it! Makes sense. Not sure I can predict issues in this case, but if you have some - just let us know, we will find out something! Good luck 🀝