Update cart-grain.go
This commit is contained in:
@@ -249,14 +249,14 @@ func (c *CartGrain) UpdateTotals() {
|
|||||||
c.TotalDiscount = NewPrice()
|
c.TotalDiscount = NewPrice()
|
||||||
|
|
||||||
for _, item := range c.Items {
|
for _, item := range c.Items {
|
||||||
rowTotal := MultiplyPrice(*item.OrgPrice, int64(item.Quantity))
|
rowTotal := MultiplyPrice(item.Price, int64(item.Quantity))
|
||||||
|
|
||||||
if item.OrgPrice != nil {
|
if item.OrgPrice != nil {
|
||||||
diff := NewPrice()
|
diff := NewPrice()
|
||||||
diff.Add(*item.OrgPrice)
|
diff.Add(*item.OrgPrice)
|
||||||
diff.Subtract(item.Price)
|
diff.Subtract(item.Price)
|
||||||
diff.Multiply(int64(item.Quantity))
|
diff.Multiply(int64(item.Quantity))
|
||||||
rowTotal.Subtract(*diff)
|
//rowTotal.Subtract(*diff)
|
||||||
item.Discount = diff
|
item.Discount = diff
|
||||||
if diff.IncVat > 0 {
|
if diff.IncVat > 0 {
|
||||||
c.TotalDiscount.Add(*diff)
|
c.TotalDiscount.Add(*diff)
|
||||||
|
|||||||
Reference in New Issue
Block a user