def purchased(): produc = ShoppingCart.query.all() total = ShoppingCart.gettotal() if total != 0: return render_template('purchased.html', product=produc, total=total) else: return redirect(url_for('cart'))
def delete_from_cart(product_id): produc = ShoppingCart.query.all() total = ShoppingCart.gettotal() for prod in produc: if prod.id == product_id: db.session.delete(prod) db.session.commit() total -= prod.price return redirect(url_for('cart'))
def quantity(): produc = ShoppingCart.query.all() total = ShoppingCart.gettotal() return render_template('cart.html', product=produc, total=total)