Пример #1
0
def payment():
    allproduct = Orderproduct.objects()
    indexnum = 0
    total = 0
    count = 0
    listordered = []
    for product in allproduct:
        indexnum += 1
        total += product.price * product.count
        count += product.count
        title = product["title"]
        image = product["image"]
        everyProCount = product["count"]
        listordered.append(title)
        listordered.append(image)
        listordered.append(everyProCount)
    if request.method == "GET":
        return render_template('payment.html', indexnum=indexnum, allproduct=allproduct, total=total)
    else:
        form = request.form
        customerinfor = Customerinfor(
            listordered=listordered,
            total=total,
            count=count,
            name=form["name"],
            numberphone=form["numberphone"],
            mail=form["mail"],
            city=form["city"],
            district=form["district"],
            address=form["address"],

        )
        customerinfor.save()
        return redirect(url_for('success'))
Пример #2
0
def man():
    allproduct = Orderproduct.objects()
    indexnum = 0 
    for product in allproduct:
        indexnum += 1
    all_clothman = Mancloth.objects()
    return render_template("man.html",all_clothman = all_clothman,indexnum=indexnum)
Пример #3
0
def shoppcard():
    allproduct = Orderproduct.objects()
    total = 0
    indexnum = 0
    for product in allproduct:
        indexnum += 1
        total += product.price * product.count
    return render_template("shoppcard.html", allproduct=allproduct, total=total, indexnum=indexnum)
Пример #4
0
def success():
    # delete product from the shopping card when order success
    all_orderproduct = Orderproduct.objects()
    all_orderproduct.delete()
    indexnum = 0
    for i in all_orderproduct:
        indexnum += 1
    return render_template("success.html", indexnum=indexnum)
Пример #5
0
def woman():
    allproduct = Orderproduct.objects()
    indexnum = 0 
    for product in allproduct:
        indexnum += 1
    # get all document from dabase
    all_clother = Clothers.objects()
    return render_template("woman.html",all_clother= all_clother,indexnum=indexnum)
Пример #6
0
def detail(imgid):
    allproduct = Orderproduct.objects()
    indexnum = 0
    for product in allproduct:
        indexnum += 1
    img_id = Mancloth.objects.with_id(imgid)
    if request.method == "GET":
        return render_template("detail.html", img_id=img_id, indexnum=indexnum)
    else:
        form = request.form
        orderproduct = Orderproduct(
            title=img_id["title"],
            price=img_id["price"],
            image=img_id["image"],
            size=form["size"],
            count=form["count"]
        )
        orderproduct.save()
        return redirect(url_for('shoppcard'))
Пример #7
0
def index():
    allproduct = Orderproduct.objects()
    indexnum = 0
    for product in allproduct:
        indexnum += 1
    return render_template("index.html", indexnum=indexnum)