KonaKart Community Forum

Installation / Configuration => Installation of KonaKart => Topic started by: ryanlynch on September 18, 2008, 05:29:06 pm

Title: temporary adddresses for checkout
Post by: ryanlynch on September 18, 2008, 05:29:06 pm
Hello,
I would like to use "temporary addresses" for my shipping and billing addresses during checkout. Basically, to better explain, instead of giving the customer the option of adding or using existing addresses in their address book, I want to present two separate address forms --one on the shipping checkout page and one on the billing address page. I am assuming I can create new Address objects from each form, however, my question is: how do I bind these addresses to the order and then ensure they are no stored in the customer's address book?

Thank you

-Ryan
Title: Re: temporary adddresses for checkout
Post by: ryan on September 19, 2008, 09:23:35 am
Get the order in the action class (kkAppEng.getOrderMgr().getCheckoutOrder()) and set the address attributes. e.g.

        checkoutOrder.setBillingCompany();
        checkoutOrder.setBillingStreetAddress();
        checkoutOrder.setBillingCity();
Title: Re: temporary adddresses for checkout
Post by: ryanlynch on September 20, 2008, 06:39:34 am
Ah, thank you -- I see how it works now!

With the code I have available to me (that which is open source), is it possible for me to overload the Order custom fields?
Title: Re: temporary adddresses for checkout
Post by: ryan on September 20, 2008, 06:47:17 am
I'm not quite sure what you are asking  ??? The custom fields can be used to store any information that is important to your business that hasn't been catered for directly by KonaKart.
Title: Re: temporary adddresses for checkout
Post by: ryanlynch on September 20, 2008, 06:55:17 am
I understand, but there are only 5 custom fields on the order object and I have 7 separate checkboxes on the order checkout pages. I was hoping to store them as separate fields in the order object so they will easily persist across checkout pages. For example, in the JSP I could do this:

<html:checkbox name="order" property="custom4" value="<%=order.getCustom4%>"/>
<html:checkbox name="order" property="custom5" value="<%=order.getCustom5%>"/>

The problem comes into play when my custom requirements exceed 5 fields. Therefore, it would be nice to use Java overloading on the custom fields.

Hope that makes more sense :)

Thanks!

Title: Re: temporary adddresses for checkout
Post by: ryan on September 20, 2008, 07:07:25 am
I understand now   :)

I'm afraid that you can't just create more since it has implications inside the engine and in the database. Normally what people do is to group them together using some delimiter and some extra logic during reads and writes. If you require them to be longer than varchar(128), this can be achieved using an alter table on the DB.

I've even seen people serialize objects into XML and store those in the custom fields.
Title: Re: temporary adddresses for checkout
Post by: ryanlynch on September 20, 2008, 07:19:43 am
Ah, ok. I will use a deliminator and parse the strings when I need to read them.
Thank you for the response.

-Ryan
Title: Re: temporary adddresses for checkout
Post by: ryanlynch on September 22, 2008, 12:35:30 am
I have used your suggested method of using:

checkoutOrder.setDeliveryCity(localForm.getCity());
checkoutOrder.setDeliveryName(localForm.getCity());

etc...

It seems to be working because it's storing everything correctly in the database and display correct in the Admin invoice tool.

However, the order confirmation page uses:

checkoutOrder.getDeliveryFormattedAddress()

How do I create this formattedAddress and set it from the delivery and shipping values I have set??

Thanks!