• Welcome to KonaKart Community Forum. Please login or sign up.
 

Dynamic Prices using konakart

Started by JimmyBlue, December 09, 2011, 09:41:55 am

Previous topic - Next topic

JimmyBlue

Hi Folks,

I'm currently working on a web shop project. The shop has the following requirement:
The prices are dynamic. The price should be fetched through webservices.

Is there an opportunity to change only one distinct method which is invoked by all the other relevant functions to get the price.
Currently my solution works on different API-functions that all have to be adapted.

There has to be adapted GetProducts(), GetAllProducts(), AddToBasket(), UpdateBasket(), GetBestSellers and
the corresponding WithOptions functions.

Regards Jimmy

ryan

If you fetch all of you prices through web services (and not just the final price added to the cart) won't this make it very slow when you retrieve an array of products? Won't it also stop you sorting and filtering by price?

JimmyBlue

Hi ryan,

you're right. That should not be the solution. Well then I have to adapt all the functions.

But there is another issue:
When the customer wants to add a product to the cart (Basket) how can I use the external
price. Konakart always fetches the prices from the shop. When I adapt the function AddToBasket(WithOptions)
so that the product price is set dynamically, the basketprice doesn't adopt this price and calculate the correct
basketprice.

And using the method setFinalInc/ExTax does not fit the case when the customer already has the product inside
his cart. Otherwise he would get the price for only one product.

What do you suggest me to do ?

Regards Jimmy


JimmyBlue

Quote from: ryan on December 09, 2011, 10:35:22 am
Take a look at http://www.konakart.com/docs/usingBasketPrice.html


Yeah I also tried to follow those instructions. The problem is, that a customer probably already has that kind of product in his basket.
Then if you add an additional one, there are two products inside the basket but at the price of one. (Cause

b.setFinalPriceExTax(new BigDecimal("22.22"));

always refers to the whole basket).

I already tried this proceeding...

Regards Jimmy

ryan

You have control over the price and you know what's in the basket, so you can set the price to what you want. You may even want to give a discount if he has a high quantity.

JimmyBlue

That's right,

but I don't know whats currently in the cart. A little example:

A customer inserted a product A into the cart.
After a while he says to hisself "I like to add an additional product A to the cart" (Not inside the cart but
from a product dialog).

If the function which inserts the additional product A does something like basket.setFinalPriceExTax
the already inserted product A isn't taken into consideration. And I'm not able to get information from
the actual cart from those functions. That's my problem.

Regards Jimmy

ryan


JimmyBlue

getBasketItemsPerCustomer() is a quite useful function.

But do you know why it is only once possible to set the FinalPriceExTax?
Only the first invocation of the function addtobasketwithoptions is able to adapt
this variable by using the function setFinalPriceExTax(). The second invocation doesn't
have an impact.
But I want to change the tax on every invocation.

What do you suggest?

ryan

Sorry but I don't understand what you're saying.

JimmyBlue

There is an API function called addToBasketWithOptions(), which is invoked when a customer adds a product to the basket.

Inside the function I calculate the new price of the basket dependent on the count of already existing products inside the cart
with the same productid.

But on the second invocation of the function addToBasketWithOptions() the function setFinalPriceExTax() has no consequence.

ryan

In this mode you can't update existing basket items by changing the quantity since it would have to calculate the average price of what was already there plus the new price. All you need to do is to delete the current basket item and add your new one with the quantity and price set by you.

JimmyBlue

You're absolutely right.  :)

That helped me a lot. You saved my day with your great help. I appreciate it.

Regards Jimmy