• Welcome to KonaKart Community Forum. Please login or sign up.
 
May 01, 2024, 04:31:43 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.

Messages - Ted

16
Programming of KonaKart / Re: Order not saved
October 29, 2009, 03:12:32 pm
Ah solved!

http://www.konakart.com/forum/index.php?topic=136.0 pointed my into the direction of missing order statusses in my language.
17
Programming of KonaKart / Re: Order not saved
October 29, 2009, 02:59:47 pm
Hmm, wait! The orders ARE actually in the MySQL database in the 'orders' table. But they're not given back by the API - not even to be seen by konakartadmin app.
18
Programming of KonaKart / Order not saved
October 29, 2009, 02:56:07 pm
In my Wicket application I have used a great deal of the shopping cart code of the Struts/JSP application.

Now I've taken some of the code from CheckoutConfirmationSubmitAction.java to save the order en get the payment details at the end of the checkout process:


// Save the order
int orderId = kkAppEng.getOrderMgr().saveOrder(/* sendEmail */false);
log.debug("Order succesfully saved as order id " + orderId);

OrderIf dbOrder = kkAppEng.getEng().getOrder(kkAppEng.getSessionId(), orderId, -1);
log.debug("From db: " + dbOrder);

// Get a fully populated PaymentDetails object and attach it to the order
log.debug("Retrieving payment details with sessionId=" + kkAppEng.getSessionId()
+ ", code=" + checkoutOrder.getPaymentDetails().getCode()
+ ", orderId=" + orderId + ", hostAndPort=" + hostAndPort + ", langId="
+ kkAppEng.getLangId());
PaymentDetailsIf pd = kkAppEng.getEng().getPaymentDetails(kkAppEng.getSessionId(),
checkoutOrder.getPaymentDetails().getCode(), orderId, hostAndPort,
kkAppEng.getLangId());
checkoutOrder.setPaymentDetails(pd);


Note that I have added some debug statements myself. This is because I'm getting an exception the following exception:


DEBUG CheckoutPayment - Order succesfully saved as order id 5
DEBUG CheckoutPayment - From db: null
DEBUG CheckoutPayment - Retrieving payment details with sessionId=196bd4150d08942f9b2b6ee9d72a9465, code=<mycode>, orderId=5, hostAndPort=<myshop.com>:8080, langId=1
ERROR CheckoutPayment - Oops.
com.konakart.app.KKException: Cannot find order for Id = 5
at com.konakart.bl.modules.payment.PaymentMgr.getPaymentDetails(Unknown Source)
at com.konakart.app.KKEng.getPaymentDetails(Unknown Source)
at com.konakart.app.KKEng.getPaymentDetails(Unknown Source)
at <somepackage>.CheckoutPayment.process(CheckoutPayment.java:183)


at com.konakart.bl.modules.payment.PaymentMgr.getPaymentDetails()

Except for the log statements every API call is the same in the correct sequence. May be it has something to do with my current user or something I forgot to do before this point, but I can't debug the fact that the order which is supposed to be saved (I'm getting a id) isn't saved - calling kkAppEng.getEng().getOrder(...) results in null and in the database indeed actually nothing shows up.

Any hints to look for would be appreciated!
19
See screenshot. I thought when products are shared, customer have to be shared too?
20
Configuration of KonaKart / Addresses
October 28, 2009, 08:48:16 am
I 've got a question about addresses in KonaKart.

- Although the Struts/JSP app says a customer can't create more than 5, is this actually enforced by the KonaKart API or is this in the Struts/JSP frontend code? Else I would recommended this as a feature for the future.
- Looks like there are a number of addresses to be associated with a customer but only 1 can be set as primary address?
- Is there a way to have a customer while managing his addresses upfront (in My Account) designate addresses for delivery specifically and others for shipping? Or is this something only during checkout can be managed?

We're not using the KonaKart Struts frontend - so I'm especially interested in anything that goes directly via the API.
21
Can you give me an indication as to what implications? They may or may not coincide with our requirements :)
22
Thx, I will!
23
The Programming Guide (http://www.konakart.com/docs/Programming.html) deals a lot with using the Java API's, using SOAP webservices, running own SQL and customizing the source. There are parts where engine customizations are described and how the Struts/JSP actions, forms, modules and JSP's are to be modified.

All instructions lean a lot towards customizing the current "open-source" customizable Struts code and building the various parts using Ant - which is really nicely documented!

What I was missing when I started to develop a Wicket application a few weeks ago and what would really be a nice-to-have: how to really integrate KonaKart outside the Struts/JSP (frontend/backend) application. The Java API examples are great, single-example showcases, but I had to take a really good look into the Struts source code as to how to configure the engine and interact with the client or server engine. This by itself is not a problem; that's what we open-source developers are used to ;)) But when (ofcourse) on a tight schedule to get a e.g. Wicket application up 'n running real fast tightly integrated with KonaKart a lot more 'general webapplication project' stuff was appreciated. What .jars have to copied from the example frontend to my own application, is there a Maven repository I could use for all KonaKart dependencies, what happens in com.konakart.plugins.KKEngPlugin which I have to mimick in my own webapp to initialize the engine properly, more examples about howto take multi-store programmatically into account - that sort of stuff.

Futhermore; great product and keep up the good work!
24
I see there's a customers.store_id field which seems to be set to the default store ('store1') when a customer is added - instead of the actually store. There's however no field in e.g. CustomerRegistrationIf to set that manually. Would that field be a good candidate to use instead of a customer field - or are there consequences when that field is used?
25
Thanks for your insight!

Since I can't ascertain the correct way to set up global aspects common to all future instances of the KKAppEng since it's inside com.konakart.plugins.KKEngPlugin - is it possible to view the code of com.konakart.plugins.KKEngPlugin somewhere? Then I can make sure that our Wicket framework basically uses the same approach at startup of the application.
26
We're mimicking the Struts/JSP logic of the KonaKart frontend in our own Wicket frontend by using KKAppEng for most purposes.

We have customers and products shared in Multi-Store Single DB Mode and developing currently to support multiple stores. Now since customers are shared (and can use their account created at store 1 to log into store 2) it's essential for commercial purposes that we track at what shop a customer is registered as a new user initially.

Can this be configured? If not, any suggestions as to what approach can be taken best will be greatly appreciated.
27
Configuration of KonaKart / Recalculating tax back?
October 27, 2009, 08:03:27 am
We're developing a Wicket frontend which basically uses the same KonaKart API calls on similar screens as in the Struts/JSP frontend application.

Now, our KonaKart products are updated/modified/deleted during from a main repository on a daily basis. The prices INCLUDING tax are calculated externally since they're rounded to nice numbers for commercial purposes e.g. "$ 9.95". Our solution was to import that price as the main price (9.9500) for a product in the products.products_price table.

Now we have defined a country with an associated Tax Area and an associated Tax Rate of 19%. With all the options in the KonaKart admin configuration (such as enabling to display prices including or excluding tax etc.) we don't know if its possible to achieve the following: calculate back the original EXCL. tax price preferably in the list if the order totals (on the cart screen). So basically the opposite of using an excl. tax price and adding the tax. E.g.

Product
======
1 x Some product: $ 9.95

Order totals
======
Excl. tax: $ 8.36
Tax 19%: $ 1.59
Shipping: ...
Total: $ 9.95

So, is there a configuration to use the original stored price INC. tax, and calculate back the EXCl. tax price, show it and show the tax?
28
Programming of KonaKart / Referential constraints
October 27, 2009, 07:37:43 am
I've noticed that the MySQL database schema sql (konakart_demo.sql) doesn't have any foreign keys in its tables. Is this by design? Right now, it seems I manually would be able to delete a product (without using the KonaKart API) and everything pointing to its product id would be left orphan in the database?
29
No one?  :-[
30
I've started on a project we're we have to integrate an entirely new Wicket application with KonaKart. Although the KonaKart Struts/JSP frontend application gives us a lot of information as to how to interact with the client engine KKAppEng, there are a few constructions I'm not entire confident about.

We have taken the following resources from the KonaKart distribution and added them inside our Wicket Maven application:

  • in WEB-INF/lib: konakart.jar, konakart_app.jar, konakart_custom.jar, konakart_utils.jar, konakart_village-2.0.jar

  • in src/main/resources: konakart.properties and konakart_app.properties

  • the rest is bascially good ol' MySQL 5 filled with the konakart_demo.sql and the correct JDBC driver




The first problem: How to create KKAppEng? (Does KKEngPlugin know more?)

Basically I have inside my Wicket application a HomePage which extends TemplatePage - this I tried to mimick from the Struts/JSP frontend classes CatalogMainPageAction and it's parent BaseAction. But when I have only the BaseAction code in place, e.g.:

            String storeId = getStoreIdFromRequest(request);

            StoreInfo si = new StoreInfo();
            si.setStoreId(storeId);
            kkAppEng = new KKAppEng(si);


I get this NullPointerException in com.konakart.al.KKAppEng.getEngConfCopy:

Caused by: com.konakart.al.KKAppException: java.lang.NullPointerException
at com.konakart.al.KKAppEng.init(Unknown Source)
at com.konakart.al.KKAppEng.<init>(Unknown Source)
at somepackage.wicket.ui.TemplatePage.getAppEng(TemplatePage.java:195)
at somepackage.wicket.ui.HomePage.<init>(HomePage.java:40)
... 33 more
Caused by: java.lang.NullPointerException
at com.konakart.al.KKAppEng.getEngConfCopy(Unknown Source)
at com.konakart.al.KKAppEng.getAServerEngineInstance(Unknown Source)


So my solution was the invoke the other constructor first:

EngineConfig engConf = new EngineConfig();
try {
engConf.setPropertiesFileName("konakart.properties");
engConf.setAppPropertiesFileName("konakart_app.properties");
engConf.setMode(engineMode);
engConf.setStoreId(storeId);
engConf.setCustomersShared(customersShared);
engConf.setProductsShared(productsShared);

// override store id with one from request if any
String requestStoreId = getStoreIdFromRequest(request);
if (requestStoreId != null) {
engConf.setStoreId(requestStoreId);
}

// this sets e.g. property file internally...
appEng = new KKAppEng(engConf);
} catch (Exception e) {
throw new RuntimeException("Unable to instantiate EngConf.", e);
}

// ..and now we have to use the KKAppEng(StoreInfo storeInfo) for
// when a user creates a new session.
StoreInfo si = new StoreInfo();
si.setStoreId(engConf.getStoreId()); // we have default store or request store
appEng = new KKAppEng(si);


Now everything works fine - but ofcourse this setup seems weird: having to call 2 constructors to properly initialize everything. In Struts a mysterious com.konakart.plugins.KKEngPlugin seems to would have called the KKAppEng(com.konakart.appif.EngineConfigIf engConf) constructor first when the container loaded. Now we have to do that ourselves so it seems. Is this true? It looks like there's no source of KKEngPlugin so there's noway to see what that class does in order to do it manually.

Also, I'm not sure whether or not properties from konakart.properties override any set properties via the setters e.g. engConf.setMode(engineMode) this way.

Next: Why can 't I retrieve any categories?

Now that I don't get any exceptions anymore I started out to get the categories for a block on the homepage, but I'm not getting any results from the CategoryMgr. It also seems that I had to log in myself as one of the example users - but I didn't see such code in the STruts/JSP application source so somehow something is playing tricks with me :D

CategoriesPanel is supposed to list the categories, buit it doesn't. (I've passed the KKApEng created earlier to the constructor for this component and is being used as a protected variable "appEng").

appEng.getCustomerMgr().logout();
String sessionId1 = appEng.getEng().login("root@localhost", "password");
String sessionId2 = appEng.getCustomerMgr().login("root@localhost", "password");
log.debug("sessionId1: " + sessionId1);
log.debug("sessionId2: " + sessionId2);
log.debug("appEng.getSessionId(): " + appEng.getSessionId());
log.debug("appEng.getCustomerMgr().getCurrentCustomer(): " + appEng.getCustomerMgr().getCurrentCustomer());
log.debug("appEng.getCategoryMgr().isMgrReady(): " + appEng.getCategoryMgr().isMgrReady());
log.debug("appEng.getCategoryMgr().getCats(): " + appEng.getCategoryMgr().getCats());
log.debug("appEng.getCategoryMgr().getCurrentCat().getName(): " + appEng.getCategoryMgr().getCurrentCat().getName());

results in

[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - sessionId1: 194a5dd2e2a708b20d63a8bfc93a40ed
[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - sessionId2: b99b0cf470e757410220e29d768cf3ac
[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - appEng.getSessionId(): b99b0cf470e757410220e29d768cf3ac
[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - appEng.getCustomerMgr().getCurrentCustomer(): Customer:
accountCreated = null
accountLastModified = null
birthdate = Mon Jan 01 00:00:00 CET 2001
emailAddr = root@localhost
faxNumber =
firstName = John
gender = m
globalProdNotifier = 0
id = 1
lastName = doe
lastLogon = null
newsletter = 0
numberOfLogons = 0
password = null
globalProdNotifier = 0
telephoneNumber = 12345
type = 0
groupId = -1
custom1 = null
custom2 = null
custom3 = null
custom4 = null
custom5 = null

[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - appEng.getCategoryMgr().isMgrReady(): false
[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - appEng.getCategoryMgr().getCats(): null
[2009-10-12 14:21:07,125] DEBUG somepackage.wicket.ui.tiles.CategoriesPanel - appEng.getCategoryMgr().getCurrentCat().getName():


There are no categories returned. I've checked the database they're all there. Further more I'm trying to rewrite some of the Struts methods (using HttpServletRequest) to Wicket methods (using Wicket's own Request object). My being new to integrations with KonaKart - and even more so since I don't use the existing Struts/JSP frontend - I realize there are a few subtleties I think I'm not aware of.

A few questions:

Can information such as categories be retrieved from the KonaKart client API anonymously or do I always need to be logged in as someone?

What's the difference between

  • KKAppEng's getEng().login(username, password)

  • KKAppEng's getCustomerMgr().login(username, password)



Why does getCategoryMgr().isMgrReady() say false? Is this relevant for my problem (= not getting anything) and if so, how can I ascertain the cause?

There are a few Struts methods, such as manageCookieLogout(request, response, kkAppEng), which manipulate the HttpServletRequest and HttpServletResponse. For Wicket I've rewritten them to use it's own wrappers for that (org.apache.wicket.Request and org.apache.wicket.Response) because that's simply good practice - but I'm wondering if the client engine implicitly is expecting session attributes which I don't set anymore (because of some rewriting).

If someone (with or without specific Wicket knowledge) can give me any pointers, they would be greatly appreciated!!