def searching(): listcategory = SQL.SelectAllCategory() if request.method == "POST": text = request.form.get("search-data") listproduct = SQL.SelectFromText(text) return render_template('Sub-page.html', listitem=listproduct, listcategory=listcategory)
def render_userpage(UserName): listproduct = SQL.SelectAll("product") listcategory = SQL.SelectAllCategory() numpro = SQL.GetAmountProductInCart(UserName) return render_template('userpage.html', listitem=listproduct, listcategory=listcategory, UserName=UserName, cartAmount=numpro)
def search_user(UserName): listcategory = SQL.SelectAllCategory() numpro = SQL.GetAmountProductInCart(UserName) if request.method == "POST": text = request.form.get("search-data") listproduct = SQL.SelectFromText(text) return render_template('sub_userpage.html', listitem=listproduct, listcategory=listcategory, UserName=UserName, cartAmount=numpro)
def loadCategory(category): listcategory = SQL.SelectAllCategory() if (category == "all"): listproduct = SQL.SelectAll("product") return render_template('Sub-page.html', listitem=listproduct, listcategory=listcategory) else: listproduct = SQL.SelectFromCategory(category) return render_template('Sub-page.html', listitem=listproduct, listcategory=listcategory)
def loadCategory_user(UserName, category): listcategory = SQL.SelectAllCategory() numpro = SQL.GetAmountProductInCart(UserName) if (category == "all"): listproduct = SQL.SelectAll("product") return render_template('sub_userpage.html', listitem=listproduct, listcategory=listcategory, UserName=UserName, cartAmount=numpro) else: listproduct = SQL.SelectFromCategory(category) return render_template('sub_userpage.html', listitem=listproduct, listcategory=listcategory, UserName=UserName, cartAmount=numpro)
def main(): listproduct = SQL.SelectAll("product") listcategory = SQL.SelectAllCategory() return render_template('frontend.html', listitem=listproduct, listcategory=listcategory)