def cart(): if request.method=='POST': name=request.form['name'] add_to_cart(name) return redirect(url_for('cart')) products=cart_info() return render_template('cart.html',products=products)
def cart(): temp = cart_info(session['username']) product_info = temp[0] quantity = temp[1] total = 0 for product, quant in zip(product_info, quantity): total = total + (product['price'] * quant) return render_template("cart.html", cart=zip(product_info, quantity), total=total)
def cart(): temp = cart_info(session['username']) product_info = temp[0] quantity = temp[1] total = 0 for prod, quant in zip(product_info, quantity): total += int(prod['price']) * quant session['total'] = total return render_template('cart.html', cart=zip(product_info, quantity), total_price=session['total'])