Business-Cart-Generic
view release on metacpan or search on metacpan
lib/Business/Cart/Generic.pm view on Meta::CPAN
shell>cd Business-Cart-Generic-1.00
# Naturally, you only drop /pre-existing/ tables :-),
# so use drop.tables.pl later, when re-building the db.
shell>perl scripts/drop.tables.pl -v
shell>perl scripts/create.tables.pl -v
# If you change the schema, regenerate the DBIx::Class interface.
shell>perl scripts/generate.schema.pl
shell>perl scripts/populate.tables.pl -v
populate.tables.pl uses Business::Cart::Generic::Database::Import. This module only
populates tables which are independent of any manufacturer, product or customer.
Up to this point, there are no products in the database, which means orders can't be placed.
shell>perl scripts/import.products.pl
shell>perl scripts/place.orders.pl
These 2 scripts use Business::Cart::Generic::Database::Loader.
This tells you what you need to fabricate to place an order. This code has been
deliberately separated from Database::Import, since it (Loader) populates tables
which depend on specific manufacturers, products and customers.
Note: Loader deletes these tables: product_classes, product_colors, product_sizes,
product_styles and product_types, because they are only needed due to the nature of
the sample product data. This means the next time you run drop.tables.pl, expect
5 warning messages relating to these tables (since they have already been dropped).
=head2 Install the trivial CGI script and the Plack script
Copy the distro's httpd/cgi-bin/generic.cart.cgi to your web server's cgi-bin/
directory, and make it executable.
If I used Apache, my cgi-bin/ dir would be /usr/lib/cgi-bin/, so I would end up
with /usr/lib/cgi-bin/generic.cart.cgi.
Actually, I run nginx (Engine X) L<http://wiki.nginx.org/Main>, which does not serve
CGI scripts, and mini-httpd L<http://acme.com/software/>, which does.
=head2 Install the FAQ web page
This FAQ is for using the shopping cart CGI scripts, not for the module itself.
In .htbusiness.cart.generic.conf there is a line:
program_faq_url = /cart/generic.cart.faq.html
This page is displayed when the user clicks FAQ on the About tab.
A sample page is shipped in docs/html/generic.cart.faq.html. It has been built from
docs/pod/generic.cart.faq.pod (by running a script I wrote, pod2html.pl, which in turn
is a simple wrapper around L<Pod::Simple::HTML>).
So, copy the sample HTML file into cart/ under your web server's doc root, or generate another version
of the page, using docs/pod/generic.cart.faq.pod as input.
=head2 Start testing
Try:
starman -l 127.0.0.1:5008 --workers 1 httpd/cgi-bin/office/cms.psgi &
Or, for good debug output:
plackup -l 127.0.0.1:5008 httpd/cgi-bin/office/cms.psgi &
Or, install generic.cart.cgi and point your browser at:
http://127.0.0.1/cgi-bin/generic.cart.cgi.
=head1 Constructor and Initialization
C<new()> is called as C<< my($obj) = Business::Cart::Generic -> new(k1 => v1, k2 => v2, ...) >>.
It returns a new object of type C<Business::Cart::Generic>.
Key-value pairs accepted in the parameter list (see corresponding methods for details):
=over 4
=item o (None as yet)
=back
=head1 TODO
=over 4
=item o Customers
Only 2 dummy customers are included, in data/customers.csv.
See Business::Cart::Generic::Database::Loader.populate_customers_table().
=item o Discounts
Not implemented.
=item o Gifts
Not implemented.
=item o Invoices
Not implemented.
=item o Manufacturers
Only 1 dummy manufacturer is included, in data/manufacturers.csv.
See Business::Cart::Generic::Database::Loader.populate_manufacturers_table().
=item o Multiple indexes per database table
Not implemented.
=item o Orders and order history
Only some dummy orders are included, in data/orders.csv and data/order.items.csv.
See Business::Cart::Generic::Database::Loader.populate_orders_table(). This method
( run in 1.174 second using v1.01-cache-2.11-cpan-e93a5daba3e )