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 everyone, I recently stumbled over the fact that the net_price in the spy_sales_order_item is

U01660GHSTT
U01660GHSTT Posts: 80 🧑🏻‍🚀 - Cadet

Hello everyone,
I recently stumbled over the fact that the net_price in the spy_sales_order_item is 0 for every entry. I tried to follow the code and it seems that the net price is set to 0 in Spryker\Zed\PriceCartConnector\Business\Manager\PriceManager::setOriginUnitGrossPrice() because of the GROSS_MODE and there doesn't seem to be a CalculationPlugin or something like that to recalculate the net price.

I have two questions regarding this:
1. What is the reason to set the net price hard coded to 0 when using the GROSS_MODE?
2. Now, to fix this, I thought about implementing a plugin that calculates the net price when GROSS_MODE is used, to have the correct value in the database, respectively. Is there maybe already a core solution to this problem that I've just missed?

Comments

  • UKJND3A3H
    UKJND3A3H Posts: 123 🧑🏻‍🚀 - Cadet

    Not fully answering the question (sorry in advance) but I think the behaviour is similar chosing the other way (NET_MODE), leading to empty gross prices. The datastructure is prepared to cover both, the data contained in the data is only actively maintained/calculated/stored for one. It’s a bit irritating…

    I am not aware of a core plugin/feature keeping both prices in sync or similar

  • U01660GHSTT
    U01660GHSTT Posts: 80 🧑🏻‍🚀 - Cadet

    Thanks. That does actually help. 🙂

  • UKJND3A3H
    UKJND3A3H Posts: 123 🧑🏻‍🚀 - Cadet

    cool 🙂

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    that’s right, you can’t have both price types at the same time, since calculation needs to be done differently (https://documentation.spryker.com/docs/net-gross-prices-management)
    Price mode, however, is defined on quote level, which means you can have carts in different modes.
    Usually on the project you need to find out in which “mode” you are working

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    From the calculator stack, I can see a NetTotalCalculatorPlugin that is added after the GrandTotal and calculates the total Net price as “grandTotal - taxTotal”

  • Andriy Netseplyayev
    Andriy Netseplyayev Sprykee Posts: 519 🧑🏻‍🚀 - Cadet

    if you still need to calculate both prices for your project, I would add missing calculators or remove the ones that you find irrelevant for you

  • U01660GHSTT
    U01660GHSTT Posts: 80 🧑🏻‍🚀 - Cadet

    Great, thanks again. I was just wondering why the net price is always 0 in the database. It felt a bit strange to always calculate the net price (gross - tax) whenever the net price is required. But if that is intended I have a good basis for discussion and we can decide how we want to do it in the future.