Checking in commerce stuff

This commit is contained in:
Martin Kamerbeek 2005-04-25 22:33:57 +00:00
parent d0374dcca3
commit 6e4cefc7c0
14 changed files with 1006 additions and 44 deletions

View file

@ -39,11 +39,159 @@ foreach my $asset (@{$newConfig{assets}}) {
}
$newConfig{utilityAssets} = ["WebGUI::Asset::Template"];
$newConfig{assets} = \@newAssetList;
$newConfig{shippingPlugins} = ['ByPrice', 'ByWeight', 'PerTransaction'];
$conf->purge;
$conf->set(%newConfig);
$conf->write;
#--------------------------------------------
print "\tAdding default product template\n" unless ($quiet);
my $import = WebGUI::Asset->newByUrl('templates');
my $folder = $import->addChild({
title=>"Commerce/Product",
menuTitle=>"Commerce/Product",
url=>"Commerce/Product",
className=>"WebGUI::Asset::Wobject::Folder"
});
$folder->addChild({
namespace=>'Commerce/Product',
title=>'Default Product Template',
menuTitle=>'Default Product Template',
url=>'Default Produuct Template',
showInForms=>1,
isEditable=>1,
className=>"WebGUI::Asset::Template",
template=>'<h1><tmpl_var title></h1>
<tmpl_var description><br>
<br>
<tmpl_var variants.message><br>
<table>
<tmpl_loop variantLoop>
<tr>
<td style="indent: 40px">
<tmpl_loop variant.compositionLoop>
<tmpl_var parameter>: <tmpl_var value><tmpl_unless __LAST__>,</tmpl_unless>
</tmpl_loop>
</td>
<td>$ <tmpl_var variant.price></td>
<td><a href="<tmpl_var variant.addToCart.url>"><tmpl_var variant.addToCart.label></a></td>
</tr>
</tmpl_loop>
</table>' },'PBtmplCP00000000000001');
#--------------------------------------------
print "\tAdding default select shipping method template\n" unless ($quiet);
$folder = $import->addChild({
title=>"Commerce/SelectShippingMethod",
menuTitle=>"Commerce/SelectShippingMethod",
url=>"Commerce/SelectShippingMethod",
className=>"WebGUI::Asset::Wobject::Folder"
});
$folder->addChild({
namespace=>'Commerce/SelectShippingMethod',
title=>'Default Select Shipping Method Template',
menuTitle=>'Default Select Shipping Method Template',
url=>'Default Select Shipping Method Template',
showInForms=>1,
isEditable=>1,
className=>"WebGUI::Asset::Template",
template=>'<tmpl_if pluginsAvailable>
<tmpl_var message><br>
<tmpl_var formHeader>
<table border="0" cellspacing="0" cellpadding="5">
<tmpl_loop pluginLoop>
<tr>
<td><tmpl_var formElement></td>
<td align="left"><tmpl_var name></td>
</tr>
</tmpl_loop>
</table>
<tmpl_var formSubmit>
<tmpl_var formFooter>
<tmpl_else>
<tmpl_var noPluginsMessage>
</tmpl_if>'}, 'PBtmplCSSM000000000001');
#--------------------------------------------
print "\tAdding default shopping cart template\n" unless ($quiet);
my $folder = $import->addChild({
title=>"Commerce/ViewShoppingCart",
menuTitle=>"Commerce/ViewShoppingCart",
url=>"Commerce/ViewShoppingCart",
className=>"WebGUI::Asset::Wobject::Folder"
});
$folder->addChild({
namespace=>'Commerce/ViewShoppingCart',
title=>'Default Shopping Cart Template',
menuTitle=>'Default Shopping Cart Template',
url=>'Default ShoppingCart Template',
showInForms=>1,
isEditable=>1,
className=>"WebGUI::Asset::Template",
template=>'<tmpl_if cartEmpty>
<tmpl_var cartEmpty.message>
<tmpl_else>
<tmpl_var updateForm.header>
<table>
<tr align="left">
<th></th>
<th style="border-bottom: 2px solid black">Product</th>
<th style="border-bottom: 2px solid black">Quantity</th>
<th style="border-bottom: 2px solid black">Price</th>
</tr>
<tmpl_if normalItems>
</tmpl_if>
<tmpl_loop normalItemsLoop>
<tr>
<td><tmpl_var deleteIcon></td>
<td align="left"><tmpl_var name></td>
<td align="center"><tmpl_var quantity.form></td>
<td align="right"><tmpl_var totalPrice></td>
</tr>
</tmpl_loop>
<tmpl_loop recurringItemsLoop>
<tr>
<td><tmpl_var deleteIcon></td>
<td align="left"><tmpl_var name></td>
<td align="center"><tmpl_var quantity.form></td>
<td align="right"><tmpl_var totalPrice></td>
</tr>
</tmpl_loop>
<tr style="border-top: 1px solid black">
<td></td>
<td style="border-top: 1px solid black">&nbsp;</td>
<td align="right" style="border-top: 1px solid black"><b>Total</b></td>
<td align="right" colspan="3" style="border-top: 1px solid black"><b><tmpl_var total></b></td>
</tr>
</table>
<tmpl_var updateForm.button>
<tmpl_var updateForm.footer>
<tmpl_var checkoutForm.header>
<tmpl_var checkoutForm.button>
<tmpl_var checkoutForm.footer>
</tmpl_if>' },'PBtmplVSC0000000000001');
#--------------------------------------------
print "\tAdding several settings\n" unless ($quiet);
WebGUI::SQL->write("insert into settings values ('commerceSelectShippingMethodTemplateId', 'PBtmplCSSM000000000001')");
WebGUI::SQL->write("insert into settings values ('commerceViewShoppingCartTemplateId', 'PBtmplVSC0000000000001')");
#--------------------------------------------
print "\tAdding product managers group\n" unless ($quiet);
WebGUI::SQL->write("insert into groups (groupId, groupName, description) values (14, 'Product Managers', 'The group that is allowed to edit, delete and create products.')");
WebGUI::Session::close();

View file

@ -7,3 +7,45 @@ update template set template = '<a href=\"<tmpl_var back.url>\"><tmpl_var back.l
alter table Navigation change endPoint descendantEndPoint int not null default 55;
alter table Navigation add column anscestorEndPoint int not null default 55;
create table productVariants (
variantId varchar(22) not null primary key,
productId varchar(22) not null,
composition mediumtext not null,
sku varchar(255),
price decimal(12,2) default 0,
weight decimal(8,3) default 0,
skuOverride tinyint(1) default 0,
priceOverride tinyint(1) default 0,
weightOverride tinyint(1) default 0,
available tinyint(1) default 1
);
create table products (
productId varchar(22) not null primary key,
title varchar(255) not null,
description mediumtext,
price decimal(12,2) not null,
weight decimal(8,3) not null,
sku varchar(255) not null,
skuTemplate varchar(255),
templateId varchar(22)
);
create table productParameters (
parameterId varchar(22) not null primary key,
productId varchar(22) not null,
name varchar(64) not null
);
create table productParameterOptions (
optionId varchar(22) not null primary key,
parameterId varchar(22) not null,
value varchar(64) not null,
priceModifier decimal(10,2) default 0,
weightModifier decimal(6,2) default 0,
skuModifier varchar(64)
);
alter table transaction add column shippingCost varchar(9) default '0.00';
alter table transaction add column shippingMethod varchar(15);
alter table transaction add column shippingOptions text;
alter table transaction add column shippingStatus varchar(15) default 'NotShipped';
alter table transaction add column trackingNumber varchar(255);