keep track of next for main log in button.
Allow coupons to be removed from session carts which do not have a user or owner associated. modified: make_post_sell/templates/base.j2 modified: make_post_sell/views/coupon.py
This commit is contained in:
parent
f169d23aad
commit
6b471b6ecd
2 changed files with 5 additions and 3 deletions
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
|
||||
{% else %}
|
||||
<a href="/join-or-log-in">My Account</a>
|
||||
<a href="{{ request.route_url('join-or-log-in', _query={'next': request.url}) }}">My Account</a>
|
||||
{% endif %}
|
||||
|
||||
<a href="/cart" class="cart-and-count">🛒 Cart ${{ '%0.2f' % request.active_cart.total }} ({{ request.active_cart.count }})</a>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ def coupon_apply_to_cart(request):
|
|||
|
||||
|
||||
@view_config(route_name="coupon_remove_from_cart", request_method="POST")
|
||||
@user_required()
|
||||
def coupon_remove_from_cart(request):
|
||||
cart_id = request.params.get("cart_id")
|
||||
coupon_id = request.params.get("coupon_id")
|
||||
|
|
@ -111,9 +110,12 @@ def coupon_remove_from_cart(request):
|
|||
elif coupon is None:
|
||||
msg = ("That coupon_id does not exist.", "error")
|
||||
|
||||
elif request.user.does_not_own_cart(cart):
|
||||
elif request.user and request.user.does_not_own_cart(cart):
|
||||
msg = ("You do not own that cart.", "error")
|
||||
|
||||
elif request.user is None and cart.user is not None:
|
||||
msg = ("You do not own this cart.", "error")
|
||||
|
||||
else:
|
||||
if coupon in cart.coupons:
|
||||
msg = ("The coupon was removed from your cart.", "success")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue