added thank you page

fixed bug in minicart
added user transaction detail page
This commit is contained in:
JT Smith 2008-05-26 00:11:00 +00:00
parent c913c3ede3
commit 93454e36f9
9 changed files with 115 additions and 23 deletions

View file

@ -545,7 +545,7 @@ sub convertTransactionLog {
index vendorId (vendorId)
)");
$session->setting->add('shopMyPurchasesTemplateId','');
$session->setting->add('shopMyPurchaseDetailTemplateId','');
$session->setting->add('shopMyPurchasesDetailTemplateId','g8W53Pd71uHB9pxaXhWf_A');
my $transactionResults = $db->read("select * from oldtransaction order by initDate");
while (my $oldTranny = $transactionResults->hashRef) {
my $date = WebGUI::DateTime->new($session, $oldTranny->{initDate});

View file

@ -56,7 +56,7 @@ sub process {
}
my %var = (
items => \@items,
totalPrice => sprintf(".2f",$totalPrice),
totalPrice => sprintf("%.2f",$totalPrice),
totalItems => $totalItems,
);
my $template = WebGUI::Asset::Template->new($session, $templateId || 'EBlxJpZQ9o-8VBOaGQbChA');

View file

@ -143,16 +143,16 @@ sub www_editSettings {
hoverHelp => $i18n->get("edit address template help"),
);
$form->template(
name => "myPurchasesTemplateId",
value => $setting->get("myPurchasesTemplateId"),
name => "shopMyPurchasesTemplateId",
value => $setting->get("shopMyPurchasesTemplateId"),
namespace => "Shop/MyPurchases",
label => $i18n->get("my purchases template"),
hoverHelp => $i18n->get("my purchases template help"),
);
$form->template(
name => "myPurchasesDetailTemplateId",
value => $setting->get("myPurchasesDetailTemplateId"),
namespace => "Shop/MyPurchases/Detail",
name => "shopMyPurchasesDetailTemplateId",
value => $setting->get("shopMyPurchasesDetailTemplateId"),
namespace => "Shop/MyPurchasesDetail",
label => $i18n->get("my purchases detail template"),
hoverHelp => $i18n->get("my purchases detail template help"),
);
@ -172,6 +172,8 @@ sub www_editSettingsSave {
my $self = shift;
return $self->session->privilege->adminOnly() unless ($self->session->user->isInGroup("3"));
my ($setting, $form) = $self->session->quick(qw(setting form));
$setting->set("shopMyPurchasesDetailTemplateId", $form->get("shopMyPurchasesDetailTemplateId", "template"));
$setting->set("shopMyPurchasesTemplateId", $form->get("shopMyPurchasesTemplateId", "template"));
$setting->set("shopCartTemplateId", $form->get("shopCartTemplateId", "template"));
$setting->set("shopAddressBookTemplateId", $form->get("shopAddressBookTemplateId", "template"));
$setting->set("shopAddressTemplateId", $form->get("shopAddressTemplateId", "template"));

View file

@ -386,7 +386,7 @@ sub www_selectPaymentGateway {
my $transaction = WebGUI::Shop::Transaction->create($session, {cart => $cart});
$transaction->completePurchase('zero', 'success', 'success');
$cart->onCompletePurchase;
$transaction->www_thankYou($session);
$transaction->thankYou();
}
# All the output stuff below is just a placeholder until it's templated.

View file

@ -222,7 +222,7 @@ sub www_pay {
# Complete the transaction
my $transaction = $self->processTransaction( $billingAddress );
return $transaction->www_thankYou($session);
return $transaction->thankYou();
}
#-------------------------------------------------------------------

View file

@ -595,7 +595,7 @@ sub www_pay {
# Payment time!
my $transaction = $self->processTransaction;
return $transaction->www_thankYou($session);
return $transaction->thankYou();
}
1;

View file

@ -437,6 +437,23 @@ sub newByGatewayId {
return $class->new( $session, $transactionId );
}
#-------------------------------------------------------------------
=head2 thankYou ()
Displays the default thank you page.
=cut
sub thankYou {
my ($self) = @_;
my $i18n = WebGUI::International->new($self->session,'Shop');
return $self->www_viewMy($self->session, $self, $i18n->get('thank you message'));
}
#-------------------------------------------------------------------
=head2 update ( properties )
@ -765,19 +782,6 @@ sub www_refundItem {
#-------------------------------------------------------------------
=head2 www_thankYou ()
Displays the default thank you page.
=cut
sub www_thankYou {
my ($class, $session) = @_;
return q{Thanks for your order. Need to template this.};
}
#-------------------------------------------------------------------
=head2 www_view ()
Displays the admin view of an individual transaction.
@ -1008,6 +1012,86 @@ sub www_viewItem {
#-------------------------------------------------------------------
=head2 www_viewMy ()
Displays transaction detail for a user's purchase.
=cut
sub www_viewMy {
my ($class, $session, $transaction, $notice) = @_;
unless (defined $transaction) {
$transaction = $class->new($session, $session->form->get('transactionId'));
}
return $session->insufficient unless ($transaction->get('userId') eq $session->user->userId);
my $i18n = WebGUI::International->new($session, 'Shop');
my ($style, $url) = $session->quick(qw(style url));
my %var = (
%{$transaction->get},
notice => $notice,
cancelRecurringUrl => $url->page('shop=transaction;method=cancelRecurring;transactionId='.$transaction->getId),
amount => sprintf("%.2f", $transaction->get('amount')),
inShopCreditDeduction => sprintf("%.2f", $transaction->get('inShopCreditDeduction')),
taxes => sprintf("%.2f", $transaction->get('taxes')),
shippingPrice => sprintf("%.2f", $transaction->get('shippingPrice')),
shippingAddress => $transaction->formatAddress({
name => $transaction->get('shippingAddressName'),
address1 => $transaction->get('shippingAddress1'),
address2 => $transaction->get('shippingAddress2'),
address3 => $transaction->get('shippingAddress3'),
city => $transaction->get('shippingCity'),
state => $transaction->get('shippingState'),
code => $transaction->get('shippingCode'),
country => $transaction->get('shippingCountry'),
phoneNumber => $transaction->get('shippingPhoneNumber'),
}),
paymentAddress => $transaction->formatAddress({
name => $transaction->get('paymentAddressName'),
address1 => $transaction->get('paymentAddress1'),
address2 => $transaction->get('paymentAddress2'),
address3 => $transaction->get('paymentAddress3'),
city => $transaction->get('paymentCity'),
state => $transaction->get('paymentState'),
code => $transaction->get('paymentCode'),
country => $transaction->get('paymentCountry'),
phoneNumber => $transaction->get('paymentPhoneNumber'),
}),
);
# items
my @items = ();
foreach my $item (@{$transaction->getItems}) {
my $address = '';
if ($transaction->get('shippingAddressId') ne $item->get('shippingAddressId')) {
$address = $transaction->formatAddress({
name => $item->get('shippingAddressName'),
address1 => $item->get('shippingAddress1'),
address2 => $item->get('shippingAddress2'),
address3 => $item->get('shippingAddress3'),
city => $item->get('shippingCity'),
state => $item->get('shippingState'),
code => $item->get('shippingCode'),
country => $item->get('shippingCountry'),
phoneNumber => $item->get('shippingPhoneNumber'),
});
}
push @items, {
%{$item->get},
viewItemUrl => $url->page('shop=transaction;method=viewItem;transactionId='.$transaction->getId.';itemId='.$item->getId),
price => sprintf("%.2f", $item->get('price')),
itemShippingAddress => $address,
orderStatus => $i18n->get($item->get('orderStatus')),
};
}
$var{items} = \@items;
# render
my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopMyPurchasesDetailTemplateId"));
return $style->userStyle($template->process(\%var));
}
#-------------------------------------------------------------------
=head2 www_update ( )
Sets the properties for the transaction, specifically "notes".

View file

@ -3,6 +3,12 @@ package WebGUI::i18n::English::Shop;
use strict;
our $I18N = {
'thank you message' => {
message => q|Thank you for your order! Please print this page as your receipt.|,
lastUpdated => 0,
context => q|notice after purchase|,
},
'shop notice' => {
message => q|Shop Notice|,
lastUpdated => 0,