Exemple #1
0
def add_pet_to_cart(pet_id):
    cart = get_cart()
    pet = find_pet(pet_id)
    if pet is not None:
        cart['pets'].append(pet)
        save_cart(cart)
    return redirect(url_for('show_cart'))
Exemple #2
0
def cart_add(pet_id):
    cart = get_cart()
    pet = find_pet(pet_id)
    cart.append(pet)
    new_cart = {'pets_in_cart': cart}
    save_cart(new_cart)
    return redirect(url_for('cart'))
Exemple #3
0
def add_to_cart(id):
    pet = find_pet(id)
    cart = get_cart()
    if pet is not None:
        cart.append(pet)
    save_cart(cart)
    return redirect(url_for("show_cart"))
Exemple #4
0
def add_pet(pet_id):
    pet = find_pet(pet_id)
    cart = get_cart()
    cart.append(pet)
    new_cart = {"pets_in_cart": cart}
    save_cart(new_cart)
    return redirect(url_for('cart'))
Exemple #5
0
def empty_cart():
    cart = {"pets": []}
    save_cart(cart)
    return redirect(url_for('index'))
Exemple #6
0
def empty_cart():
    cart = get_cart()
    cart.clear()
    new_cart = {'pets_in_cart': cart}
    save_cart(new_cart)
    return redirect(url_for('cart'))
Exemple #7
0
def empty_cart():
    cart = save_cart([])
    total = get_cart_total(cart)

    return redirect(url_for("cart.html", cart=cart, total=total))