add a thank you message to the FlatDiscount/Coupon
This commit is contained in:
parent
6b759f2b8e
commit
b57f289706
3 changed files with 30 additions and 7 deletions
|
|
@ -57,6 +57,7 @@ sub addToCart {
|
||||||
$found =1 if (ref($item->getSku) eq ref($self));
|
$found =1 if (ref($item->getSku) eq ref($self));
|
||||||
}
|
}
|
||||||
unless ($found) {
|
unless ($found) {
|
||||||
|
$self->{_hasAddedToCart} = 1;
|
||||||
$self->SUPER::addToCart($options);
|
$self->SUPER::addToCart($options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,6 +107,13 @@ sub definition {
|
||||||
label => $i18n->get("price discount"),
|
label => $i18n->get("price discount"),
|
||||||
hoverHelp => $i18n->get("price discount help"),
|
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}, {
|
push(@{$definition}, {
|
||||||
assetName => $i18n->get('assetName'),
|
assetName => $i18n->get('assetName'),
|
||||||
|
|
@ -205,6 +213,7 @@ sub view {
|
||||||
. WebGUI::Form::hidden( $session, { name=>"func", value=>"addToCart" }),
|
. WebGUI::Form::hidden( $session, { name=>"func", value=>"addToCart" }),
|
||||||
formFooter => WebGUI::Form::formFooter($session),
|
formFooter => WebGUI::Form::formFooter($session),
|
||||||
addToCartButton => WebGUI::Form::submit( $session, { value => $i18n->get("add to cart") }),
|
addToCartButton => WebGUI::Form::submit( $session, { value => $i18n->get("add to cart") }),
|
||||||
|
hasAddedToCart => $self->{_hasAddedToCart},
|
||||||
);
|
);
|
||||||
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,15 @@ our $HELP = {
|
||||||
fields => [
|
fields => [
|
||||||
],
|
],
|
||||||
variables => [
|
variables => [
|
||||||
{ name => "formHeader" , required=>1},
|
{ name => "formHeader" , required=>1},
|
||||||
{ name => "formFooter" , required=>1 },
|
{ name => "formFooter" , required=>1 },
|
||||||
{ name => "addToCartButton" , required=>1 },
|
{ name => "addToCartButton" , required=>1 },
|
||||||
{ name => "mustSpend", description=>"must spend help" },
|
{ name => "mustSpend", description=>"must spend help" },
|
||||||
{ name => "percentageDiscount", description=>"percentage discount help" },
|
{ name => "percentageDiscount", description=>"percentage discount help" },
|
||||||
{ name => "priceDiscount", description=>"price discount help" },
|
{ name => "priceDiscount", description=>"price discount help" },
|
||||||
{ name => "templateId", description=>"template help" },
|
{ name => "templateId", description=>"template help" },
|
||||||
|
{ name => "hasAddedToCart" , required=>1 },
|
||||||
|
{ name => "thankYouMessage", description=>"thank you message help" },
|
||||||
],
|
],
|
||||||
related => [
|
related => [
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,18 @@ our $I18N = {
|
||||||
context => q|template variable description|
|
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;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue