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

How to set dynamically the price in the basket

Started by pmarrone, July 22, 2008, 10:49:34 pm

Previous topic - Next topic

pmarrone

Hi all,
I'd like to use Konakart to implement a new method to sell goods: the customer plays a game (based on ability, not luck) getting the desired good at a discounted price, where the discount depends on how much he has been able to resolve the game.
So the final price of the good is not equal to the initial product's price, but can change.
I tried to use the Basket.setFinalPriceExTax(...) method, but without success, and after a forum search I discovered that the final price is derived automatically from the price of the product in the catalog.  :'(
I also tried to update directly the price in the customers_basket table, but strangely the price displayed in the cart is always the initial product's price, even if in the table there is another value.  ???

Is there a solution to my problem?
Please help
Thank you
Paolo

julie

Hi Paolo,

The basket items are saved in the session for performance reasons which is probably why you aren't seeing updated values. If you take a look at CartTile.jsp and ShowCartItemsAction.java you'll see that the items are retrieved from kkAppEng.getCustomerMgr().getCurrentCustomer().getBasketItems(). In order to refresh the values in the UI you should call the method kkAppEng.getBasketMgr().getBasketItemsPerCustomer(); from an action class.

In order to get your price into the database you could use our customization framework to customize the methods addToBasket() and updateBasket() to change the value of the price in the DB before returning. You could pass your price in a custom attribute.

Hope this helps,

Julie