fix - Commerce checkout confirmation very confusing
fix - EMS Discount Pass Not Applied
This commit is contained in:
parent
b36b58cbb2
commit
edaa6c463a
5 changed files with 93 additions and 18 deletions
|
|
@ -140,7 +140,7 @@ sub priceLineItem {
|
|||
);
|
||||
}
|
||||
if ($numberOfPasses) {
|
||||
# $self->session->errorHandler->warn('adding a discount pass.');
|
||||
#$self->session->errorHandler->warn('adding a discount pass.');
|
||||
$passesInCart{$passId} = $numberOfPasses;
|
||||
$totalPassesInCart += $numberOfPasses;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ sub priceLineItem {
|
|||
my $numberOfThisPass = $passesInCart{$passId};
|
||||
# calculate discount.
|
||||
if ($pass->{type} eq 'newPrice') {
|
||||
$self->session->errorHandler->warn('discounted price: '.$pass->{amount});
|
||||
#$self->session->errorHandler->warn('discounted price: '.$pass->{amount});
|
||||
$discountedPrice = (0 + $pass->{amount}) if ($price > (0 + $pass->{amount}));
|
||||
} elsif ($pass->{type} eq 'amountOff') {
|
||||
# not yet implemented!
|
||||
|
|
@ -160,14 +160,15 @@ sub priceLineItem {
|
|||
}
|
||||
# while we still have passes and items left to discount.
|
||||
while ($numberOfThisPass && $quantity) {
|
||||
# $self->session->errorHandler->warn('applying a discount pass.');
|
||||
#$self->session->errorHandler->warn('applying a discount pass.');
|
||||
$totalPrice += $discountedPrice;
|
||||
$self->session->errorHandler->warn('new discounted price: '.$discountedPrice);
|
||||
#$self->session->errorHandler->warn('new discounted price: '.$discountedPrice);
|
||||
$quantity--;
|
||||
$numberOfThisPass--;
|
||||
}
|
||||
}
|
||||
# return the total of the discounted items plus the total of the non discounted items.
|
||||
#$self->session->errorHandler->warn($totalPrice + ($quantity * $price));
|
||||
return ($totalPrice + ($quantity * $price));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,17 +45,17 @@ sub addItem {
|
|||
$self->session->db->write("insert into transactionItem ".
|
||||
"(transactionId, itemName, amount, quantity, itemId, itemType) values ".
|
||||
"(".$self->session->db->quote($self->{_transactionId}).",".$self->session->db->quote($item->name).",".$self->session->db->quote(
|
||||
($lineItemAmount)
|
||||
($lineItemAmount ne "")
|
||||
?($lineItemAmount)
|
||||
:($item->price)
|
||||
).",".$self->session->db->quote(
|
||||
($lineItemAmount)
|
||||
($lineItemAmount ne "")
|
||||
?('1')
|
||||
:($quantity)
|
||||
).",".
|
||||
$self->session->db->quote($item->id).",".$self->session->db->quote($item->type).")");
|
||||
# Adjust total amount in the transaction table.
|
||||
$self->session->db->write("update transaction set amount=amount+".($item->price * $quantity)." where transactionId=".$self->session->db->quote($self->{_transactionId}));
|
||||
$self->session->db->write("update transaction set amount=amount+".$self->session->db->quote(($lineItemAmount ne "") ? ($lineItemAmount) : ($item->price * $quantity))." where transactionId=".$self->session->db->quote($self->{_transactionId}));
|
||||
$self->{_properties}{amount} += ($item->price * $quantity);
|
||||
push @{$self->{_items}}, {
|
||||
transactionId => $self->{_transactionId},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue