Andrew Maltsev > XAO-Commerce-1.02 > XAO::DO::Web::Order

Download:
XAO-Commerce-1.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.003   Source  

NAME ^

XAO::DO::Web::Order - object that holds non-translated vendor orders

DESCRIPTION ^

Web::Order is a child object of Web::FS which handles all aspects of handling orders on an eCommerce site. As a part of the XAO::Commerce release its main function is to implement shopping cart and order checkout functionality. In version 1.0, Web::Order does not provide any meaningful calculation for shipping and tax charges, however the methods calc_shipping_totals() and calc_tax_totals() are in place providing sample calculations. For Web::Order to truely be useful in a production eCommerce site these methods simply need to be overridden by custom methods that reflect the actual algorithm requirements for the site.

show ()

Presents the order details. Takes arguments:

    * 'template' or 'path'
    * 'sorry.template' or 'sorry.path' or sorry'
    * 'item' or 'item.path' or 'item.template'
    * 'itemheader' or 'itemheader.path' or 'itemheader.template' (optional)
    * 'itemfooter' or 'itemfooter.path' or 'itemfooter.template' (optional)
add ()

This method does the following:

    - checks for order_id cookie; if one exists, retrieves order object,
      otherwise creates a new order object and sets an order_id cookie.
    - adds item(s) to order object if applicable.
    - saves selected shipping address to order object if applicable.
    - saves selected shipping method  to order object if applicable.
    - saves selected payment  method  to order object if applicable.
    - calculates ordered item total                and saves it to order object.
    - calculates ship  total or estimated ship  total and saves it to order object.
    - calculates tax   total or estimated tax   total and saves it to order object.
    - calculates grand total or estimated grand total and saves it to order object.

Takes arguments:

    * 'template' or 'path'
    * 'sorry.template' or 'sorry.path' or sorry'
save ()

Changes status of order to 'Placed' and adds customer_id to the order.

    * 'template' or 'path'
    * 'sorry.template' or 'sorry.path' or sorry'
expand_items (%)

This functionality is in its own method to facilitate customizations. The method displays items. It is called as follows:

    $self->expand_items($args);
clear_items (%)
add_items (%)

This method adds/sets quantities of items to "ordered items" list. It takes the following CGI Parameters:

  * items1..N
  * quantity1..N
  * set1..N (optional - 'set' mode; default is 'add' mode)
new_item (%)

This functionality is in its own method to facilitate customizations. The method copies a item into the "ordered item" list. It's called as follows:

    my $new_ordered_item = $self->new_item(
                               list    => $ordered_item_list,
                               item => $item,
                           );
set_shipto (%)

This method sets the shipping address information. It takes the following CGI Parameters:

  * shipto
set_shipmethod (%)

This method sets the shipping method information. It takes the following CGI Parameters:

  * shipmethod
set_paymethod (%)

This method sets the payment method information. It takes the following CGI Parameters:

  * paymethod
calc_item_totals ($)

This method calculates and saves the item total.

calc_shipping_totals ($)

This method calculates and saves the shipping total. Currently the calculation present is for sample purposes only (5% of items total). Override this method with your custom shipping calculation. Make sure that, in your custom version, you put the shipping total in the order's 'total_shipping' property and return the shipping total.

calc_tax_totals ($)

This method calculates and saves the tax total. Currently the calculation present is for sample purposes only (8.25% of items total if shipping to California, USA). Override this method with your custom tax calculation. Make sure that, in your custom version, you put the tax total in the order's 'total_tax' property and return the tax total.

calc_grand_total ($)

This method calculates and saves the grand total.

AUTHORS ^

Copyright (c) 2002 XAO Inc.

Marcos Alves <alves@xao.com>

syntax highlighting: