Adding internationalized message for empty cart
This commit is contained in:
parent
94b20d8f49
commit
5b89003e24
4 changed files with 24 additions and 2 deletions
Binary file not shown.
|
|
@ -694,9 +694,21 @@ sub www_view {
|
|||
}
|
||||
</script>
|
||||
|);
|
||||
|
||||
my @items = @{$self->getItems};
|
||||
if(scalar(@items) < 1) {
|
||||
# there are no items in the cart, return a message to the template
|
||||
my %var = (
|
||||
message => $i18n->get('empty cart')
|
||||
);
|
||||
|
||||
# render the cart
|
||||
my $template = WebGUI::Asset::Template->new($session, $session->setting->get("shopCartTemplateId"));
|
||||
return $session->style->userStyle($template->process(\%var));
|
||||
}
|
||||
|
||||
# generate template variables for the items in the cart
|
||||
foreach my $item (@{$self->getItems}) {
|
||||
foreach my $item (@items) {
|
||||
my $sku = $item->getSku;
|
||||
$sku->applyOptions($item->get("options"));
|
||||
my %properties = (
|
||||
|
|
|
|||
|
|
@ -873,6 +873,13 @@ our $I18N = {
|
|||
context => q|a button the user clicks on to go back to shopping after viewing the cart|
|
||||
},
|
||||
|
||||
'empty cart' => {
|
||||
message => q|There are no items currently in your cart.|,
|
||||
lastUpdated => 0,
|
||||
context => q|a message to the user that the cart is empty|
|
||||
},
|
||||
|
||||
|
||||
'shop' => {
|
||||
message => q|Shop|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use WebGUI::TestException;
|
|||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $i18n = WebGUI::International->new($session, "Shop");
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
|
@ -52,6 +52,9 @@ my $cart = WebGUI::Shop::Cart->newBySession($session);
|
|||
isa_ok($cart, "WebGUI::Shop::Cart");
|
||||
isa_ok($cart->session, "WebGUI::Session");
|
||||
|
||||
my $message = $i18n->get('empty cart') . "\n";
|
||||
like($cart->www_view, qr/There are no items currently in your cart./, 'Display empty cart message');
|
||||
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
my $product = $root->addChild({
|
||||
className=>"WebGUI::Asset::Sku::Donation",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue