示例#1
0
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)
示例#2
0
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)
示例#3
0
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'])