def support_recommendation(pid): most_useful_support = support.Support().most_useful_support(pid) if most_useful_support[1] < 1: default_recommended_service = services.Service().get_service() return default_recommended_service[0] else: return most_useful_support[0]
def customize(): pid = request.args['product_id'] most_useful = support_recommend.support_recommendation(pid) single_product = product.Product().select_product(pid) service_list = services.Service().view_service() return render_template('customize.html', record=single_product, service_list=service_list, most_useful=most_useful)
def warranty(): pid = request.args['product_id'] sid = request.args['service_id'] seek_support.seeking_for_support(pid, sid) single_product = product.Product().select_product(pid) service_list = services.Service().view_service() return render_template('warranty.html', record=single_product, service_list=service_list)
def add_to_cart(): service_id = request.form['sid'] pid = request.form['pid'] scart.append(service_id) pcart.append(pid) single_product = product.Product().select_product(pid) service_list = services.Service().view_service() return render_template('customize.html', record=single_product, service_list=service_list)
def go_to_cart(): prod_list = [] serv_list = [] for item in pcart: single_product = product.Product().select_product(item) prod_list.append(single_product) for item in scart: single_service = services.Service().select_service(item) serv_list.append(single_service) prod_serv_list = zip(prod_list, serv_list) return render_template('cart.html', prod_serv_list=prod_serv_list)