• Welcome to KonaKart Community Forum. Please login or sign up.
March 23, 2019, 10:12:11 am


KonaKart v8.9 - Released Aug-2018 - see KonaKart website for details

How to manipulate shown prices

Started by unic1988, December 10, 2008, 02:46:42 pm

Previous topic - Next topic



First fo all: Please excuse my terrible english, its not my native language.

Here are my Questions:

I need to manipulate the shown prices everywhere in the Shop depending on the User. When I took a look in the .jsp's I found some methods like getPriceIncTax(), getPriceExTax(), formatPrice()... is it possible to edit these Methods? I couldn't find the .java files containing these methods.

If this is not possible (what I am expecting) is there another way to manipulate the price that is shown to the User, without replacing every call of getPriceIncTex()/getPriceExTax()? Notice: I don't want to manipulate the Price in the Database!!!

If I manipulated the price that is shown to the user, and the user decides to buy the product, i need to insert the user-depending-price into my list of orders and not the price that is in the database. After a while of searching through the custom/ Folder i found the class CheckoutConfirmationSubmitAction.java, is this the one i need to modify for my purpose?
If this is the one could anyone tell me what I need to do to modify the price that is saved for the order?

Beside I would be very pleased If anyone could give a link to my where I can find a little Tutorial, that explains how I tell KonaKart to use my modified CheckoutConfirmationSubmitAction.class .

Big thanks for all answers,

I hope my Purpose is possible :)



1) What you could do is to use the custom engine ( http://www.konakart.com/engine_customization_faq.php ) and do some post processing on the API calls that get products to change the price.

2) Yes, you have to change the prices on the order products before saving the order. The actual order is created in CheckoutDeliveryAction but at this point it hasn't been saved yet and will show the prices of the products from the DB.

The action classes are in konakart_custom.jar . During development you can put your edited classes under konakart/WEB-INF/classes/com/konakart etc. since they will get picked up before the ones in the jar. Once you are happy, you could create your own jar. Try running .\bin\ant -p from the custom directory. There will be an ant target to build the custom jars.



thank you for the very fast and good help! I played around with the KKCustomEng, modifiyed GetProductsPerCategory.java and it worked. Now I have one more Question:

I could solve my Problem by editing GetProductsPerCategory, GetProductsPerManufacturer, ... etc. , but I would really like only to modify one single method or class that reads a product from the database. Can you tell me if such a class exists, so that I only modify one class that is used by GetProductsPerCategory, GetProductsPerManufactuerer, ... etc. to get a Product from the database? Because if I have only one class modified it should be much easier to upgrade to newer versions of KonaKart without much Problems.

Sorry for asking such simple things, but I don't know any other way to check if such a Class exists.

Thanks for each answer!


No, you have to do it in the 3 or 4 API calls that get products. However, as long as your actual processing code isn't duplicated in each method, then the customisation just consists of a method call to your code in each KK API call. This should be easy to maintain.



I have another simple Question:

To change the Price everywhere it gets displayed I edited the following classes:

- GetAllProducts
- GetAllSpecials
- GetAlsoPurchased
- GetBestSellers
- GetProduct
- GetProductNotificationsPerCustomer
- GetProductsPerCategory
- GetProductsPerCategoryPerManufacturer 
- GetProductsPerManufacturer
- GetRelatedProducts
- GetSpecialsPerCategory
- SearchForProducts

and it works well so far.

But there is one place where my modifications take no effect, the customers shopping cart. Does anyone know which method/class gets called when KonaKart asks for the prices of the cart-items?

I tried it with 'GetBasketItemsPerCustomer'. I tried to getProduct(), manipulateIt() and setProduct() for each item in BasketIf[] but that took no effect.

Thanks for all answers!


Try changing the finalPrice attributes of the basket items. These prices take into account the quantity and also whether any product options have been selected.


My Problem is, that I don't know where I have to manipulate the Price, that its shown in the Shopping cart. I figured out that GetBasketItemsPerCustomer is called when a new Item gets added to the cart, but it seems not to get called when I klick on 'cart contents'.

I need one single Class / Method where I can make my pricemanipulations, like the ones I have when I call getProduct() or getProductPerCategory() etc. and beside its important that I don't have to make modifications in the jsp's.


That's because it is saved in the session. Try modifying the attributes I mentioned in the previous post.


Ok, it works, thank you!

But every solution brings a new Problem  :-\

When the User is not logged in "Sub-Total" shows the correct value that equals the sum of all modified product prices. But when the User is logged in it equals the sum of the product prices that are in the database.

I saw that "kkEng.getBasketMgr().getBasketTotal()" in CartTile.jsp is the method that prints Sub-Total.
Can you tell me which API call I have to modify to get the the Sub-total value that equals the sum of all modified prices, or why this method returns another value when the user is logged in?


Take a look at ShowCartItemsAction.java .

A temporary order is created with the customer details if he is logged in or with the details of a "default" customer if he isn't logged in. If no default customer is present, then no temp order is created which is what is happening in your case when you get the correct sub total. You should see an exception in the log.

This temporary order is used to get shipping costs and any promotion discounts etc. so that a customer is aware of these before starting the checkout process. All you need to do is to comment out the line where createTempOrder() is called and you should just see your sub total .


Ok that seems to work,thank you very much, but what happens when I klick on "checkout"?

I took a look at the URL and saw that EditCartSubmit.do gets called, so In checked EditCartSubmitAction.java for where Checkout-information is gathered, but i found nothing. Then I saw that
Code Select

if (ecf.getGoToCheckout().equalsIgnoreCase("true"))
    return mapping.findForward("CheckoutDelivery");

seems to redirect to CheckoutDeliveryAction if "checkout" is klicked. Is that right? Because I can't find the place where to edit the final Price Information for the Order, please help me


Quoteseems to redirect to CheckoutDeliveryAction if "checkout" is klicked. Is that right?



Well, can you tell me where I have to manipulate an OrderIf or a BasketIf? I looked through CheckoutDeliveryAction.java, CheckoutPaymentAction.java and CheckoutConfirmationAction.java but I can't figure out where to do that.
Or is there maybe the possibility to do that in an API call, that would be much better for me.

I think then it should be fnished.


If someone has the same problem: I solved it by editing createOrder.java and createOrderWithOptions.java.
Now everything seems to work  :)

Next Question:

I want to manipulate the Prices according to the actual Customer and it works well in most cases by calling kkEng.getCustomer(sessionId);
There are only two places where it doesn't work and I can't figure out why: GetAllProducts.java and GetAllSpecials.java .

As you know the sessionId is passed as an parameter into those classes as in many other of those API-Calls too, such as GetProduct.java or GetOrder.java. Apart from GetAllSpecials/GetAllProducts, I have access to the Customer by calling kkEng.getCustomer(sessionId) if the User is logged in. So I really don't know what I am making wrong... or is it a bug that the sessionId is not available in those two classes?

Please help me


The session id should be set to a valid value if the customer is logged in.