add a thank you message to the FlatDiscount/Coupon

This commit is contained in:
Colin Kuskie 2008-06-12 16:01:36 +00:00
parent 6b759f2b8e
commit b57f289706
3 changed files with 30 additions and 7 deletions

View file

@ -57,6 +57,7 @@ sub addToCart {
$found =1 if (ref($item->getSku) eq ref($self));
}
unless ($found) {
$self->{_hasAddedToCart} = 1;
$self->SUPER::addToCart($options);
}
}
@ -106,6 +107,13 @@ sub definition {
label => $i18n->get("price discount"),
hoverHelp => $i18n->get("price discount help"),
},
thankYouMessage => {
tab => "properties",
defaultValue => $i18n->get("default thank you message"),
fieldType => "HTMLArea",
label => $i18n->get("thank you message"),
hoverHelp => $i18n->get("thank you message help"),
},
);
push(@{$definition}, {
assetName => $i18n->get('assetName'),
@ -205,6 +213,7 @@ sub view {
. WebGUI::Form::hidden( $session, { name=>"func", value=>"addToCart" }),
formFooter => WebGUI::Form::formFooter($session),
addToCartButton => WebGUI::Form::submit( $session, { value => $i18n->get("add to cart") }),
hasAddedToCart => $self->{_hasAddedToCart},
);
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
}

View file

@ -17,13 +17,15 @@ our $HELP = {
fields => [
],
variables => [
{ name => "formHeader" , required=>1},
{ name => "formFooter" , required=>1 },
{ name => "addToCartButton" , required=>1 },
{ name => "mustSpend", description=>"must spend help" },
{ name => "percentageDiscount", description=>"percentage discount help" },
{ name => "priceDiscount", description=>"price discount help" },
{ name => "templateId", description=>"template help" },
{ name => "formHeader" , required=>1},
{ name => "formFooter" , required=>1 },
{ name => "addToCartButton" , required=>1 },
{ name => "mustSpend", description=>"must spend help" },
{ name => "percentageDiscount", description=>"percentage discount help" },
{ name => "priceDiscount", description=>"price discount help" },
{ name => "templateId", description=>"template help" },
{ name => "hasAddedToCart" , required=>1 },
{ name => "thankYouMessage", description=>"thank you message help" },
],
related => [
],

View file

@ -93,6 +93,18 @@ our $I18N = {
context => q|template variable description|
},
'thank you message help' => {
message => q|Write a "thank you message", this could also just be a notice that something was added to the cart.|,
lastUpdated => 0,
context => q|help for default price field|
},
'hasAddedToCart' => {
message => q|A condition indicating that the user has added the product to their cart, so we can display the thank you message.|,
lastUpdated => 0,
context => q|template variable|
},
};
1;