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 together, I’m trying to implement a functionality where the prices for products are loaded fr

ULW0Z4150
ULW0Z4150 Posts: 69 🧑🏻‍🚀 - Cadet

Hello together,

I’m trying to implement a functionality where the prices for products are loaded from an external API. I’m having some issues finding the logic where the related data is send to the frontend. Can anyone tell me what a good place to implement this behaviour would be?

Comments

  • UKTSRTD5M
    UKTSRTD5M Posts: 77 🧑🏻‍🚀 - Cadet
    edited November 2019

    Hi David, we've done a similar thing. We're not storing prices at all in spryker but load them at runtime from our erp. Is this what you're after?

  • ULW0Z4150
    ULW0Z4150 Posts: 69 🧑🏻‍🚀 - Cadet

    Yes I think so. The prices are supposed to be loaded depending on the customer that is signed in.

  • ULW0Z4150
    ULW0Z4150 Posts: 69 🧑🏻‍🚀 - Cadet

    It would be great if you could give me a starting point to implement this behavior

  • UKTSRTD5M
    UKTSRTD5M Posts: 77 🧑🏻‍🚀 - Cadet

    We implemented a dedicated client to handle these calls to the erp for us. So we did not override any existing module but built our own from scratch. This is then hooked up to an json endpoint which provides the prices (and some more, e.g. something like: if you order until 6pm you will get the delivery tomorrow morning). This endpoint is called via ajax from the browser, so that the site may be displayed even if the erp is responding slowly / not at all.

  • ULW0Z4150
    ULW0Z4150 Posts: 69 🧑🏻‍🚀 - Cadet

    Ok thanks, I’ll give that a try

  • rshopin
    rshopin Senior Solution Architect Sprykee Posts: 32 🧑🏻‍🚀 - Cadet

    Hi @ULW0Z4150, you can check \Spryker\Client\PriceProductStorage\PriceProductStorageClient and \Spryker\Client\PriceProductStorage\Storage\PriceConcreteStorageReader

  • rshopin
    rshopin Senior Solution Architect Sprykee Posts: 32 🧑🏻‍🚀 - Cadet

    You can override this Price readers (for example replace Storage client \Spryker\Client\PriceProductStorage\PriceProductStorageFactory::getStorage with your own) and get prices from esternal source.

  • ULW0Z4150
    ULW0Z4150 Posts: 69 🧑🏻‍🚀 - Cadet

    Thank you I’ll take a look at that