Page 1 of 4

Retrieving customised inventory prices in bulk

PostPosted: Thu Jul 21, 2022 6:44 pm
by mls
Hi. Looking for some advice on how best to integrate Jiwa with a custom ecommerce site. We are running Jiwa 07.02.01 and using PHP to communicate with the REST API.

Our first challenge is to display real-time customised inventory prices to our users when they browse and search our site.

Each user on our site will be linked to a debtor record in Jiwa — we're hoping to use the REST API to fetch inventory items with Jiwa's pricing logic already applied for that user/debtor, rather than having to replicate that logic in our own system.

Is there any way to efficiently retrieve a list of priced inventory items for a particular user (i.e. given a DebtorID and multiple InventoryIDs)? I've searched the API docs but haven't found any obvious way to do this, so any advice would be much appreciated

Thanks,
Michael

Re: Retrieving customised inventory prices in bulk

PostPosted: Thu Jul 21, 2022 6:58 pm
by Mike.Sheen
mls wrote:Is there any way to efficiently retrieve a list of priced inventory items for a particular user (i.e. given a DebtorID and multiple InventoryIDs)? I've searched the API docs but haven't found any obvious way to do this, so any advice would be much appreciated


We don't have anything out-of-the-box, but creating such a route should be fairly easy for anyone familiar with Jiwa plugins and our REST API.

We have an existing route to get a price for a given product, customer, location, date and quantity - the route is /Inventory/{InventoryID}/Pricing/{DebtorID}/{IN_LogicalID}/{Date}/{Quantity}

If you look at the code behind that request in the REST API plugin, it simply creates an instance of our PriceScheme object and calls the GetPrice method. You could create a new route to adapt that to accept a list of products instead of a single product, and have it iterate the list of products calling GetPrice repeatedly and then return a list of products, prices with quantity breaks.

That may not perform well, depending on a lot of factors - but it's worth starting with that and if it doesn't perform well enough, you could then look at changing the logic to not use the GetPrice method and use another approach.

If you've no experience making plugins for Jiwa, especially ones to add custom REST API routes then you might want to engage our services on our helpdesk and we can do it for you.

Re: Retrieving customised inventory prices in bulk

PostPosted: Thu Jul 21, 2022 7:07 pm
by mls
Hi Mike,

Thanks for the quick reply. From a quick glance at your docs it looks like plugins can only be developed in C# or VB.NET — is that correct?

Michael

Re: Retrieving customised inventory prices in bulk

PostPosted: Thu Jul 21, 2022 7:10 pm
by SBarnes
Having been there and done this with a client, my best advice is as follows:

1. Given the complexity of how Jiwa's pricing works trying to replicate the pricing functionality is not a good idea and keeping the two in sync would be a nightmare.
2. Also given the complexity trying to calculating the price for possibly a long list of prices on the fly is also not a good idea.

What our customer did was as follows:

1. Show the default price for a product but then give the user the ability to enter a quantity and have a button to show their price
2. When a product was added to the cart at a given quantity show the price the customer would be charged.

To support this we developed a custom route that would take a debtor id, the date to calculate the prices at and a list of products and quantities and then return the list with prices for each item in the list.

Part of your problem whilst under inventory functionality of the api whilst you can retrieve prices such as debtor specific prices there is functionality called a scheme that determines how the different prices can be compared.

Re: Retrieving customised inventory prices in bulk

PostPosted: Thu Jul 21, 2022 7:24 pm
by SBarnes
Thanks for the quick reply. From a quick glance at your docs it looks like plugins can only be developed in C# or VB.NET — is that correct?


Yes that is correct.

Re: Retrieving customised inventory prices in bulk

PostPosted: Fri Jul 22, 2022 3:26 pm
by mls
Thanks for the replies Stuart. For now we're going to test some other solutions before diving into Jiwa plugins.

Another question:

We have an existing route to get a price for a given product, customer, location, date and quantity - the route is /Inventory/{InventoryID}/Pricing/{DebtorID}/{IN_LogicalID}/{Date}/{Quantity}


Is this the only built-in route which can retrieve a price for a given product and customer? What if we want to search across all locations?

Also, would it make any sense to get prices by creating a stateful SalesQuote/SalesOrder?

Thanks,
Michael

Re: Retrieving customised inventory prices in bulk

PostPosted: Fri Jul 22, 2022 3:37 pm
by SBarnes
There is an argument to be put forward to support Quotes through the api however, this would not a small amount of work.

I would point out that in thinking about it yes, you could create a Stateful sales order and let Jiwa price things that way and then abandon the sales order, so it may make doing quotes redundant and just go with sales orders but all pricing work including a warehouse.

Re: Retrieving customised inventory prices in bulk

PostPosted: Fri Jul 22, 2022 3:39 pm
by Mike.Sheen
SBarnes wrote:There is an argument to be put forward to support Quotes through the api however, this would not a small amount of work.

I would point out that in thinking about it yes, you could create a Stateful sales order and let Jiwa price things that way and then abandon the sales order, so it may make doing quotes redundant and just go with sales orders.


Umm... we already have full support for quotes in the API.

Re: Retrieving customised inventory prices in bulk

PostPosted: Fri Jul 22, 2022 3:41 pm
by SBarnes
Ah, I looked for a section called quotes on https://api.jiwa.com.au/ at least I looked at the documentation, just a naming issue :lol:

Re: Retrieving customised inventory prices in bulk  Topic is solved

PostPosted: Fri Jul 22, 2022 5:20 pm
by mls
Mike.Sheen wrote:we already have full support for quotes in the API.


Hey Mike, does it make sense to you to use a stateful SalesQuote (or SalesOrder) to solve this problem?