• Welcome to KonaKart Community Forum. Please login or sign up.
 

Free Digital Downloads

Started by bubba64, January 13, 2009, 12:30:52 am

Previous topic - Next topic

bubba64

We have added some free stuff to our site along side purchased products to encourage traffic to the site (PDF downloads). I have the digital downloads configured and the product cost is $0.00.

(1) Is there an easy way to bypass the credit card or payment step when the order value is $0? Right now it gives an error because the order value is $0.

(2) I have the free product listed as a product, I don't want to simply provide a link on a page to download because I want the customer to register like they are buying a real product (I can then merchandise and cross sell, and add the customer to my mailing list). I like to see the digital download appear in their 'myaccount', but with no cost.

Any ideas....?

julie

Our next version will not call the payment gateway if the amount is zero. You can add some code to CheckoutConfirmationSubmitAction()  before calling the payment gateway  that looks something like this:

            /*
             * Check to see whether the order total is set to 0. Don't bother with a payment gateway
             * if it is.
             */
            BigDecimal orderTotal = checkoutOrder.getTotalIncTax();
            if (orderTotal != null && orderTotal.compareTo(java.math.BigDecimal.ZERO) == 0)
            {
                // Set the order status
                checkoutOrder.setStatus(com.konakart.bl.OrderMgr.PAYMENT_RECEIVED_STATUS);

                // Save the order
                int orderId = kkAppEng.getOrderMgr().saveOrder(/* sendEmail */true);

                // Update the inventory
                kkAppEng.getOrderMgr().updateInventory(orderId);

                // If we received no exceptions, delete the basket
                kkAppEng.getBasketMgr().emptyBasket();

                return mapping.findForward("CheckoutFinished");
            }


ReLLiK75

If you're using SOAP, you can create your own method (I do this in my createOrder method) that checks to see if the product.type=1 (digital download) and the price=0 then call insertDigitalDownload(productID) which will make the digital download available for immediate download.  You can do the same thing in your java class if you're not using SOAP.

bubba64

Strange thing...

Added the code like you suggested, now it works properly (not asking for credit card info), yet now the Download Link does not appear in "My Account", even though the order shows "Payment Received". Changing the status to "Shipped" does not do anything either.

What step is being missed?

Thanks for the help.

trevor

You need to edit the saveOrder() method of the OrderIntegrationMgr().

Try adding:

        // When an order has a total of zero it can be saved with a payment received status
        if (order.getStatus() == com.konakart.bl.OrderMgr.PAYMENT_RECEIVED_STATUS)
        {
            manageDigitalDownloads(order.getId());
        }