• Welcome to KonaKart Community Forum. Please login or sign up.
 
April 28, 2024, 01:16:15 pm

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.

Topics - unic1988

1
Hello,

For some reasons I need to know the IP Address of the Customer in the KKCustomEng. I couldn't find any method that gives me the IP Address so I thought it would be best to set it from an Action (BaseAction.java).

It seems that getKKAppEng(HttpServletRequest) is the method that gets called nearly everytime an Action is performed, so I customized it a bit to have access to the IP Address from KKCustomEng.

1. I made a new dataelement in KKCustomEng named "String remoteAddr"
2. I modified BaseAction.getKKAppEng() this way:

...
        kkAppEng.setPageTitle(getCatMessage(request, "seo.default.title"));
        kkAppEng.setMetaDescription(getCatMessage(request, "seo.default.meta.description"));
        kkAppEng.setMetaKeywords(getCatMessage(request, "seo.default.meta.keywords"));

/* CUSTOMIZATION */

try {

String ip = request.getRemoteAddr();

if(kkAppEng.getEng() instanceof KKCustomEng && ip != null) {

((KKCustomEng)kkAppEng.getEng()).setRemoteAddr(ip);
}
}
catch(Exception e) {

mylog.debug("Error " + e.getMessage());
}

/* CUSTOMIZATION */

        return kkAppEng;
    }


First it seemed to work, but I never had the IP Adress available in KKCustomEng. Does kkAppEng.getEng() always return a new KKEngIf-object?

If yes: Is there another Way to pass the Ip Address to KKCustomEng?

Thanks in advance
2
Programming of KonaKart / KKCustomEng.finalize()
February 06, 2009, 12:01:21 pm
Hello everyone,

I need to do some things exactly when the users session expires, so I thought that should be easy via KKCustomEng.finalize(), but I can't get this method get called when the session expires.

What I have done in KKCustomEng.java:

protected void finalize() throws Throwable {

    mylog.debug("session closed");

    try {

//do something with some data that I've gathered during this session
    }
    finally {

super.finalize();
    }
}


I have also set konakart.session.durationMinutes=2, so I think the session should expire very fast (2 minutes).

So is there someone who can call me if I did something wrong, or if it won't work this way?
3
Hello,

I downloaded and installed Version 3.2.0.0 on WindowsXP, JRE 1.6.0_07 without any Problems, the database tables are created and filled. But if I start Konakart I get an 404 Error and I don't know where it comes from.

QuoteHTTP Status 404 -

type Status report

message

description The requested resource () is not available.
Apache Tomcat/6.0.18




This is what Tomcat says:

Quote04.02.2009 09:37:21 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
04.02.2009 09:37:21 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
04.02.2009 09:37:22 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8780
04.02.2009 09:37:22 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
04.02.2009 09:37:22 org.apache.coyote.http11.Http11NioProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
04.02.2009 09:37:22 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8789
04.02.2009 09:37:22 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1534 ms
04.02.2009 09:37:22 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
04.02.2009 09:37:22 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
04.02.2009 09:37:26 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error listenerStart
04.02.2009 09:37:26 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/konakart] startup failed due to previous errors
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error listenerStart
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/konakartadmin] startup failed due to previous errors
04.02.2009 09:37:27 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8780
04.02.2009 09:37:27 org.apache.coyote.http11.Http11NioProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
04.02.2009 09:37:27 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8789
04.02.2009 09:37:27 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5108 ms




and I found this in the logs:

Quote04.02.2009 09:37:26 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Skipped installing application listeners due to previous error(s)
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Error configuring application listener of class org.apache.axis.transport.http.AxisHTTPSessionListener
java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionListener
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.access$000(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3786)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
   at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
   at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSessionListener
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   ... 37 more
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Skipped installing application listeners due to previous error(s)


So it looks like Tomcat is not able to find some needed classes, but I have no Idea where they are and what I have to do to solve this problem.
4
hello,

I want to get the default taxrate/tax from an API-Call, so I thougt it would be the best way to use the KKEngIf.getTax() method.

now there is the problem, that this method requires some parameters, so I tried it this way:

CustomerIf customer = (sessionId == null) ? this.eng.getDefaultCustomer() : this.eng.getCustomer(sessionId);
AddressIf addr = customer.getDefaultAddr();
BigDecimal taxrate = this.eng.getTaxRate(addr.getCountryId(), addr.getZoneId(), taxClassId);


the sessionId and taxClassId are always available, but I get an exception when calling customer.getDefaultAddr(); if the user is not logged in. I'm a bit confused, because the exceptionmessage is 'null'. So is the problem that the default customer doesn't have an address or is something other? Is there maybe another way to get the tax/taxrate?

I hope someone has a solution for me,

thanks for all answers!
5
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?
6
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 :)