Tuesday, February 11, 2014

Simple Way To Create Shipping Group : ATG

Creating Shipping Groups:


A ShippingGroup contains information on the shipping address and delivery method for a group of commerce items.

1. By default, a new Order has one default ShippingGroup.

2. As items are added to the Order, these items automatically become part of the default ShippingGroup.

3. Once a second ShippingGroup is added to the Order, all the items in the Order are removed from the default ShippingGroup and must be explicitly added to one of two shipping groups.

4. Relationships must now be created to associate the items with shipping groups.


Follow these steps to create a new ShippingGroup and add it to an Order:


 1. Call ShippingGroupManager.createShippingGroup().

 2. Make any changes to the ShippingGroup, such as setting the address.

 3. Call ShippingGroupManager.addShippingGroupToOrder(pOrder, pShippingGroup) to add the ShippingGroup to the Order.


Refer to the following example:


// Get a reference to the OrderManager
OrderManager orderManager = (OrderManager)
  request.resolveName("/atg/commerce/order/OrderManager");


// Create the ShippingGroup
ShippingGroup shippingGroup = shippingGroupManager.createShippingGroup();
 
// Add the ShippingGroup to the Order
shippingGroup.addShippingGroupToOrder(pOrder, shippingGroup);


When setting the shipping and billing addresses, normally you pass a RepositoryContactInfo object to setShippingAddress() or setBillingAddress(). If you want to use a ContactInfo object instead, but do not want to subclass RepositoryContactInfo (see defaultShippingGroupAddressType in the OrderTools section), you must modify some Nucleus components. List the properties of your address object in the savedProperties property of /atg/commerce/order/processor/SaveShippingGroupObjects and the loadProperties property of atg/commerce/order/processor/LoadShippingGroupObjects.


Tip For Multiple Shipping Groups   

 

1. Multiple shipping groups (which implement Multishipment) on a commerce site permit a customer to ship parts of an order to different addresses using different methods of delivery.

2. For example, suppose a customer enters the checkout process on a site that supports multiple shipping methods for a single order. The customer chooses to have the items shipped to different locations. The site must provide a UI that allows the customer to enter an address, and then associate it with a shipper, such as UPS or US Postal.

3. After the customer selects a shipper, a ShippingGroup is created. The site must then provide a UI that allows the customer to associate items with that shipping group. If there is only one shipping group, then all the items to be shipped will go into that shipping group. If more than one shipping group is associated with the order, then the customer must decide which items go into each group.






----------------------------------------------------------------------------------------------------------------------------

No comments:

Popular Posts