cart bug, fixing
This commit is contained in:
parent
f1e33783d7
commit
969b59776e
2 changed files with 11 additions and 0 deletions
|
@ -276,6 +276,8 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
|
||||||
"cart_size": cartSize(cart),
|
"cart_size": cartSize(cart),
|
||||||
"shipping_cost": shippingCost,
|
"shipping_cost": shippingCost,
|
||||||
"total_cost": totalPrice,
|
"total_cost": totalPrice,
|
||||||
|
"banner_color": os.Getenv("BANNER_COLOR"), // illustrates canary deployments
|
||||||
|
"ad": fe.chooseAd(r.Context(), []string{}, log),
|
||||||
"items": items,
|
"items": items,
|
||||||
"expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4},
|
"expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4},
|
||||||
"platform_css": plat.css,
|
"platform_css": plat.css,
|
||||||
|
@ -333,10 +335,17 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque
|
||||||
totalPaid = money.Must(money.Sum(totalPaid, *v.GetCost()))
|
totalPaid = money.Must(money.Sum(totalPaid, *v.GetCost()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currencies, err := fe.getCurrencies(r.Context())
|
||||||
|
if err != nil {
|
||||||
|
renderHTTPError(log, r, w, errors.Wrap(err, "could not retrieve currencies"), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := templates.ExecuteTemplate(w, "order", map[string]interface{}{
|
if err := templates.ExecuteTemplate(w, "order", map[string]interface{}{
|
||||||
"session_id": sessionID(r),
|
"session_id": sessionID(r),
|
||||||
"request_id": r.Context().Value(ctxKeyRequestID{}),
|
"request_id": r.Context().Value(ctxKeyRequestID{}),
|
||||||
"user_currency": currentCurrency(r),
|
"user_currency": currentCurrency(r),
|
||||||
|
"currencies": currencies,
|
||||||
"order": order.GetOrder(),
|
"order": order.GetOrder(),
|
||||||
"total_paid": &totalPaid,
|
"total_paid": &totalPaid,
|
||||||
"recommendations": recommendations,
|
"recommendations": recommendations,
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ end }} <!-- range $.items-->
|
{{ end }} <!-- range $.items-->
|
||||||
|
|
||||||
|
|
||||||
<div class="row pt-2 my-3">
|
<div class="row pt-2 my-3">
|
||||||
<div class="col text-center order-summary">
|
<div class="col text-center order-summary">
|
||||||
<p class="text-muted my-0">Shipping Cost: <strong>{{ renderMoney .shipping_cost }}</strong></p>
|
<p class="text-muted my-0">Shipping Cost: <strong>{{ renderMoney .shipping_cost }}</strong></p>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue