• Welcome to KonaKart Community Forum. Please login or sign up.
 
April 05, 2025, 11:42:12 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 - anstuff

1
While using Order Total Discount module to implement buy 1 get 1 free promotion, we found that on adding a product other than the eligible products for promotion the discount was not getting applied.
e.g. When you add A and B (both eligible) to cart, you would see one of the products for Free.
But when you add C to cart, the discount was no longer applied.

The promotion we created for this is as follows;
Promo type : Order Total Discount
Active: true, Requires Coupon: true, Cumulative: true
Minimum order value: 39.90, Min total quantity: 2, Min Quantity for a product: 1
Discount 19.95, Percent/Amount: false

Following is the code change, that will fix the problem.

                //Generate a list containing eligible product ids
                List<Integer> applicableProductIds = new ArrayList<Integer>();
                for (OrderProductIf op : promotion.getApplicableProducts()) {                   
                    applicableProductIds.add(op.getProductId());
                }

                ot = new OrderTotal();
                ot.setSortOrder(sortOrder);
                ot.setClassName(code);
                ot.setPromotions(new Promotion[]{promotion});

                // Does promotion only apply to a min order value ?
                if (minTotalOrderVal != null) {
                    if (orderValue.compareTo(minTotalOrderVal) < 0) {
                        // If we haven't reached the minimum amount then continue to the next
                        // promotion
                        continue;
                    }
                }

                // Does promotion only apply to a minimum number of products ordered ?
                if (minTotalQuantity > 0) {
                    int total = 0;
                    //instead of looping through promo.applicableProducts, loop through order.OrderProducts
                    //for (int j = 0; j < promotion.getApplicableProducts().length; j++)
                    for (int j = 0; j < order.getOrderProducts().length; j++) {
                        //ensure that applicable product ids has the product that you are trying use
                        if (applicableProductIds.contains(order.getOrderProducts()[j].getProductId())) {
                            total += order.getOrderProducts()[j].getQuantity();
                        }
                    }
                    if (total < minTotalQuantity) {
                        // If we haven't reached the minimum total then continue to the next
                        // promotion
                        continue;
                    }
                }

                // Does promotion only apply to a minimum number of single products ordered ?
                if (minProdQuantity > 0) {
                    boolean foundMin = false;
                    //instead of looping through promo.applicableProducts, loop through order.OrderProducts
                    //for (int j = 0; j < promotion.getApplicableProducts().length; j++)
                    for (int j = 0; j < order.getOrderProducts().length; j++) {
                        //ensure that applicable product ids has the product that you are trying use
                        if (applicableProductIds.contains(order.getOrderProducts()[j].getProductId())) {
                            if (order.getOrderProducts()[j].getQuantity() >= minProdQuantity) {
                                foundMin = true;
                            }
                        }
                    }
                    if (!foundMin) {
                        // If we haven't reached the minimum total then continue to the next
                        // promotion
                        continue;
                    }
                }
2
We would want to let user apply as many coupon codes as he wants to his order and get discount associated with each of those coupons.  Is it possible?
Currently, when I apply a different coupon code then the one earlier applied, it gives discount ONLY for the last coupon code applied.  Is there a way it would apply promotions associated with both coupon codes?
3
You need to do the same in mergeBasketWithOptions
4
You should be able to set the log levels using konakart-logging.properties file.  Set the debug levels to trace or debug for com.konakart and torque.
5
Thanks for the reply ming, it works for me now.  To get what i was looking for, all i had to do was to pass null as my search criteria.
6
I need to implement a feature where in I have to display all the products with discounted prices for a particular promotion.  Is there a way I can do this?
I have retrieved the promotion using getPromotion method of admin api, it seems to have applicableProducts which is an array of AdminOrderProduct.  But this array is always null. 
The hard way, I could get all products based on categoryRule and productRule but that will not have the discounted values. 
Suggestions well appreciated.
7
I get the result only when I specify the promotion Id.  But that is not the intended behavior, the call getPromotions should be giving me the result irrespective of setting the id value.  I am looking to get all active promotions available and search for a particular promotion to get its name and description for marketing purpose.

Seems like its a bug.  Could someone confirm/verify?
8
I am using admin web service to retrieve promotions which matches my specified criteria.  Here under is my unit test;
        String sessionId = long(DEFAULT_USERNAME,DEFAULT_PASSWORD);
        AdminPromotionSearch adminPromoSearch = new AdminPromotionSearch();               
        adminPromoSearch.setActive(Boolean.TRUE);
        adminPromoSearch.setCumulative(Boolean.FALSE);
        adminPromoSearch.setRequiresCoupon(Boolean.TRUE);
        Calendar startDate = new GregorianCalendar(2010, 06, 01);
        adminPromoSearch.setStartDate(startDate);
        Calendar endDate = new GregorianCalendar(2011, 06, 27);       
        adminPromoSearch.setEndDate(endDate); 
        adminPromoSearch.setOrderTotalCode("ot_product_discount");

        AdminPromotionSearchResult adminPromoSearchResult = kkClient.getPromotions(sessionId, adminPromoSearch, 0, 10);
        Assert.assertNotNull(adminPromoSearchResult);

I have promotions matching the above mentioned criteria in my app, yet adminPromoSearchResult is returned with empty promotions array and zero totalSetSize.

What am i missing?
9
Programming of KonaKart / Re: New OrderTotal module
June 04, 2010, 07:16:09 pm
Please verify the values for code in NnTax.java.
10
What do you mean when you say backend?
In order to have multiple shipping agency options available you can have a module for each of them and enable them at your will(the same way as you have ZONES module enabled) .  You could write your own shipping modules if the built in modules don't suit your purpose.
11
I have configured struts-config.xml as per Authorize.net payment module for my custom payment module.
Here under is my configuration;
<action path="/CheckoutServerPaymentSubmit" type="com.konakart.actions.CheckoutServerPaymentSubmitAction" name="CreditCardForm" scope="request" validate="true" input="/CheckoutServerPayment.do">
         <forward name="usaepay" path="/USAePay.do" redirect="false"/>
         <forward name="authorizenet" path="/AuthorizeNet.do" redirect="false"/>
         <forward name="payjunction" path="/PayJunction.do" redirect="false"/>
         <forward name="yourpay" path="/YourPay.do" redirect="false"/>
         <forward name="elink" path="/Elink.do" redirect="false"/>
                        <forward name="Mypay" path="/Mypay.do" redirect="false"/>
      </action>


<action path="/Mypay" type="com.konakart.actions.gateways.MypayAction">
         <forward name="Approved" path="/CheckoutFinished.do"/>
         <forward name="TryAgain" path="/CheckoutServerPayment.do"/>
         <forward name="NotLoggedIn" path="/CheckoutDelivery.do"/>
      </action>


The code value in the class implementing PaymentInterface is "Mypay" and same is the module code in the class implementing PaymentModule.

When I run my test case, the action class MypayAction is not getting executed.  Am I missing something?
12
If i do not use struts than that would mean no need to have the action class either.
In that case is it OK to implement the capture of funds code in the class implementing payment interface?  How can I communicate with my website if the card gets declined?
13
Is it necessary to have Struts configuration for the payment module?  I intend to plug in Payment Module with our website which has its own GUI.  The website will be interacting with Konakart to search/select products and creating orders in Konakart.
When order gets saved, we want to authorize and capture payment based on order details saved with the order. 
When the card is declined, we would like to get a notification regarding the same and would want to give customer another chance to re-enter his/her credit card details.

For doing the above mentioned, we have our own web pages, business logic etc.  Albeit, I followed the instructions as mentioned in the documentation, the implementation I did in my action class is not getting executed when I run my test case.  It does get fired when I try to place an order through Konakart Web App.  Am I missing something?

Any help appreciated.
14
I think I found the problem.  I was running Konakart locally as well in QA environment.  Some of the configuration that was done for konakart was pointing to QA environment.  That environment did not have my module installed, so obviously it did not work.  I do not know which configuration specifically would be required, if someone knows please do reply to this thread.  Thanks for looking.
15
And yes the module is enabled, also verified the Configuration table holding the value true for "MODULE_PAYMENT_CYBERSOURCE_STATUS" property.  I have made this module based on Authorize.net.