def get(self, request): product = None categories = Category.get_all_category() category_id = request.GET.get('category') if category_id: product = Product.get_all_product_by_categoryId(category_id) else: product = Product.get_all_product() return render(request, 'store/home.html', {'products':product, 'categoris':categories})
def get(self, request): categories = Category.get_all_category() if request.GET.get("category"): products = Product.get_all_products_by_category_id( request.GET.get("category")) else: products = Product.get_all_products() cart_size = Cart.get_all_products_by_user(request.user.id) data = {} data['products'] = products data['categories'] = categories data['cart_size'] = len(cart_size) return render(request, "index.html", data)
def get(self, request): cart = request.session.get('cart') if not cart: request.session.cart = {} products = None categories = Category.get_all_category() categoryID = request.GET.get('category') if categoryID: products = Product.get_all_products_by_id(categoryID) else: products = Product.get_all_products() data = {'products': products, 'categories': categories} return render(request, 'index.html', data)
def get(self, request): cart = request.session.get('cart') if not cart: request.session['cart'] = {} products = None categorys = Category.get_all_category() categoryID = request.GET.get('category') if categoryID: products = Product.get_all_products_by_category_id(categoryID) else: products = Product.get_all_products() data = {} data['products'] = products data['categorys'] = categorys print(request.session.get('email')) return render(request, 'index.html', data)
def get(self, request): products = None category = Category.get_all_category() categoryid = request.GET.get('category') if categoryid: products = Product.get_all_products_by_categoryid(categoryid) else: products = Product.get_all_products() context = { 'products': products, 'category': category } print('email', request.session.get('customer_email')) return render(request, 'store/index.html', context)