template / database upgrades for commerce changes

This commit is contained in:
Frank Dillon 2007-07-26 21:19:30 +00:00
parent 2c1005522b
commit 5392f07e66
3 changed files with 152 additions and 1 deletions

View file

@ -0,0 +1,103 @@
#PBtmpl0000000000000016
<a href="<tmpl_var viewShoppingCart.url>"><tmpl_var viewShoppingCart.label></a> &middot;
<a href="<tmpl_var changePayment.url>"><tmpl_var changePayment.label></a> &middot;
<a href="<tmpl_var changeShipping.url>"><tmpl_var changeShipping.label></a><br />
<br />
<tmpl_if purchaseError>
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<th>Transaction description</th>
<th>Price</th>
<th>Status</th>
<th>Error</th>
</tr>
<tmpl_loop resultLoop>
<tr>
<td align="left"><tmpl_var purchaseDescription></td>
<td align="right"><tmpl_var purchaseAmount></td>
<td><tmpl_var status></td>
<td align="left"><tmpl_var error> (<tmpl_var errorCode>)</td>
</tr>
</tmpl_loop>
</table><br />
<br />
<tmpl_var statusExplanation>
<br />
</tmpl_if>
<tmpl_var title><br />
<tmpl_if errorLoop>
<ul>
<tmpl_loop errorLoop>
<li><tmpl_var message></li>
</tmpl_loop>
</ul>
</tmpl_if>
<table> <tr align="left">
<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" align='center'>Price</th>
<th style="border-bottom: 2px solid black">Amount</th>
<th style="border-bottom: 2px solid black">Sales Tax</th>
<th style="border-bottom: 2px solid black">Each</th>
</tr>
<tmpl_if normalItems>
</tmpl_if>
<tmpl_loop normalItemsLoop>
<tr>
<td align="left"><tmpl_var name></td>
<td align="center"><tmpl_var quantity></td>
<td align="right"><tmpl_var price></td>
<td align="right"><tmpl_var totalPrice></td>
<td align="right"><tmpl_var salesTax></td>
<td>&nbsp;</td>
</tr>
</tmpl_loop>
<tmpl_loop recurringItemsLoop>
<tr>
<td align="left"><tmpl_var name></td>
<td align="center"><tmpl_var quantity></td>
<td align="left"><tmpl_var price></td>
<td align="right"><tmpl_var totalPrice></td>
<td align="right"><tmpl_var salesTax></td>
<td align="left"><tmpl_var period></td>
</tr>
</tmpl_loop>
<tr style="border-top: 1px solid black">
<td colspan='2' style="border-top: 1px solid black">&nbsp;</td>
<td align="right" style="border-top: 1px solid black"><b>Subtotal</b></td>
<td align="right" style="border-top: 1px solid black"><b><tmpl_var subtotal></b></td>
</tr>
<tr>
<td colspan="3" align="right">Shipping</td>
<td align="right"><tmpl_var shippingCost></td>
</tr>
<tr>
<td colspan="3" align="right"><tmpl_var discountsApplied.label></td>
<td align="right"><tmpl_var discountsApplied></td>
</tr>
<tr>
<td colspan="2" align="right">Sales Tax Rate</td>
<td align="right"><tmpl_var salesTaxRate></td>
<td style="border-top: 1px solid black">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="right">Total Sales Tax</td>
<td style="border-top: 1px solid black">&nbsp;</td>
<td align="right"><tmpl_var totalSalesTax></td>
</tr>
<tr>
<td colspan="3" align="right" style="border-top: 1px solid black"><b>Total</b></td>
<td align="right" style="border-top: 1px solid black"><b><tmpl_var total></b></td>
</tr>
</table>
<br /><br />
<tmpl_var form>

View file

@ -0,0 +1,17 @@
#PBtmpl0000000000000017
<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 label></td>
</tr>
</tmpl_loop>
</table>
<tmpl_var formSubmit>
<tmpl_var formFooter>
<tmpl_else>
<tmpl_var noPluginsMessage>
</tmpl_if>

View file

@ -38,6 +38,7 @@ addPostCaptchaToCS($session);
addFieldsToDatabaseLinks($session);
addWikiAttachments($session);
addAdminConsoleGroupSettings($session);
updateCommerce($session);
finish($session); # this line required
@ -457,7 +458,37 @@ sub addHttpProxyUrlPatternFilter {
print "OK!\n" unless ($quiet);
}
#-------------------------------------------------
sub updateCommerce {
my $session = shift;
print "\tUpdating Commerce...." unless ($quiet);
$session->db->write("delete from settings where name='commerceTransactionErrorTemplateId'");
#Remove Transaction Error Template
my @templates = $session->db->buildArray("select distinct assetId from template where namespace='Commerce/TransactionError'");
foreach my $templateId (@templates) {
my $template = WebGUI::Asset->newByDynamicClass($session,$templateId);
$template->purge;
}
#Add the Check payment gateway to the config file
my $paymentPlugins = $session->config->get('paymentPlugins');
push(@{$paymentPlugins},'Check');
$session->config->set('paymentPlugins',$paymentPlugins);
#Enable the check payment gateway if cash is enabled
my ($cashEnabled) = $session->db->quickArray("select fieldValue from commerceSettings where namespace='Cash' and fieldName='enabled'");
if($cashEnabled) {
my $sth = $session->db->read("select * from commerceSettings where namespace='Cash'");
while (my $hash = $sth->hashRef) {
my $array = [$hash->{fieldName},$hash->{fieldValue},'Check',$hash->{type}];
$session->db->write("insert into commerceSettings values (?,?,?,?)",$array);
}
}
print "OK!\n" unless $quiet;
}
# ---- DO NOT EDIT BELOW THIS LINE ----