• Welcome to KonaKart Community Forum. Please login or sign up.
 
May 12, 2024, 11:54:18 am

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - unic1988

16
Ok I played around a bit with the KKCustomEng and found out that its instantiated everytime a new Session starts. I tested it a while and it seems, that the KKCustomEng has the same lifetime as the HttpSession, but im not sure and I need to be sure, so is anyone there who can tell me if I am right or not?
17
Hello,

I need to get some Information about the actual user in an API Call even if the user is not logged in. I don't need to know what the users name is or something like that but I want to check his HttpSession to figure out if he was looking to the site befor.

My Problem is, that the KKAppEng that calls the KKCustomEng is saved in the HttpSession, so I don't know how to pass some Information from the HttpSession resp. the actions to the KKCustomEng.

Another possibility would be to make some more dataelements in the KKCustomEng and use them as attributes for the actual user, but I don't know if the KKCustomEng gets initialized everytime an action is performed or if it exists the same period of time as the Session and the KKAppEng.


So my Problem is that I can not identify an user in an API Call if the user is not logged in, but it is very important for me to do that. Does anyone have an idea how to solve that Problem?
18
Well modifying the jsp's is not an option for me, so im going to wait for the next release and for now I subordinate the problem with the "Whats new" and the "Specials" panel.

Thank you for your explanation of what the "sessionId" is, so I don't have to try to get access to the session and can look for another solution to save some information about the user.

By the way I want to thank you and all other admins here for your help, this forum is really usefull!
19
My aim is to modify the prices of all products in Konakart according to the customer who is looking at them. So I wrote a little pricemanipulation-class with only one important method that consumes the sessionId of the user, an isntance of the kkCustomEngine, an originalProductPrice and the quantity of the product thats price is going to geht manipulated.

To make my modifications happen to all prices everywhere in Konakart I  edited some API-calls like GetAllProducts or GetAllSpecials as in the code above. Nearly everything works fine apart from the prices shown in the "Whats new" and the "Specials" panel. At the moment my pricemodification method only looks if there is an sessionId and then sets the price to 1111.11 € if there is one, 9999.99 € otherwise.
As you can see in the Picture that I have added to one of my previous posts most of the prices get modified right if the user is logged in (set to 1111.11 €), but in the "Whats new" and the "Specials" panel my method seems not to be able to find a sessionId, so the price is set to 9999.99 €. I cant understand why, because the sessionId that is passed to GetAllProducts/GetAllSpecials (according to my tests those two are the API-Calls that return the productIf-Objects for "Whats new" and "Specials") should be the same as in every other API-Call. Do you have an idea what mistakes I am making? Or is it maybe a Bug (what I don't believe)?

Another Problem is, that I want to save which Products prices I have already modified, so I thought it would be suggestive to save this information in the session-object, but how can I get Access to it from an API-Call? Because from my knowledge about http and stuff a HttpServletRequest-object is needed to retrieve the session-object. Maybe you have an idea how to get the session or how I could save some user-dependend information for a while.

I am thankfull for all answers you can give me!
20
Does noone have an Idea? I don't know how to solve this without the full sourcecode of KonaKart, so I really need your help.
21
By the way: is it possible to access the session-object from an Api-Call to do some setAttribute() and getAttribute()? This is not absolutly necessary because I think i can save all important information in a customers custom-field, but I expect sessions to be faster than playing around with very large String-Objects.
22
I will show you what my Problem is:

I made a Screenshot showing the situation i worry about. At the momment my pricemanipulation-method returns 9,999.99 € if the sessionId is null, 1,111.11 € otherwise. As you can see, the User is logged in. The prices at the "latest products"-panel are showing the value I want (1,111.11), so at this point the sessionId is not null. But the Price at the "whats new"-product is showing 9,999.99 , what means, that in this case the sessionId is null. I found out, that I have to edit GetAllProducts.java to manipulate the price of the "whats new"-panel. The same Problem occurs at the "Specials"-panel.




Here is some Code how i modified GetAllProducts.java :

public class GetAllProducts
{
    KKEng kkEng = null;

    /**
     * Constructor
     */
     public GetAllProducts(KKEng _kkEng)
     {
         kkEng = _kkEng;
     }

     public ProductsIf getAllProducts(String sessionId, DataDescriptorIf dataDesc, int languageId) throws KKException
     {
        ProductsIf products = kkEng.getAllProducts(sessionId, dataDesc, languageId);
PriceManipulator pm = new PriceManipulator();
products = pm.manipulatePrice(sessionId, kkEng, products);
return products;
     }
}


The method that manipulates the price only does the following simple calculation(quantity is set to 1, if the manipulated product is not an object of type BasketIf):

if(sessionId != null)
{
return 1111.11*quantity;
}
else
{
return 9999.99*quantity;
}
23
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

24
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.

25
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
...

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
26
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?
27
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.
28
Hello,

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!
29
Hi,

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!

30
Programming of KonaKart / How to manipulate shown prices
December 10, 2008, 09:46:42 am
Hello,

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


Here are my Questions:

1.)
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!!!

2.)
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 :)