def get(self, tags=""): cellar_id = None cellar = Cellar() res_web = cellar.GetWebCellar() if "success" in res_web: cellar_id = res_web["success"] page = int(self.get_argument("page", "1")) ajax = int(self.get_argument("ajax", 0)) tags = tags.replace("_", " ").lower() tags_arr = tags.split(",") items = 0 tallas = [] tag = Tag() res = tag.GetItemsByTags(cellar_id, tags_arr) if "success" in res: items = int(res["success"]) res = tag.GetProductsByTags(cellar_id, tags_arr, page, 16) tags_visibles = tag.ListVisibleTags(tags_arr) if "success" in tags_visibles: tags = tags_visibles["success"] product = Product() tallas_res = product.getAllSizes() if "success" in tallas_res: tallas = tallas_res["success"] if "success" in res: if ajax == 0: self.render("store/index.html", data=res["success"], items=items, page=page, tags=tags, tags_arr=tags_arr, tag=",".join(tags_arr), tallas=tallas) else: self.render("store/ajax_productos.html", data=res["success"], items=items, tag=",".join(tags_arr), page=page) else: self.render("beauty_error.html", message=res["error"])
def post(self): cellar = Cellar() res_web = cellar.GetWebCellar() cellar_id = None if "success" in res_web: cellar_id = res_web["success"] product = Product() page = int(self.get_argument("page", "1")) ajax = int(self.get_argument("ajax", 0)) lista = product.GetList(cellar_id, page, 16) items = 0 tags = {} tallas = [] response = product.GetItems(cellar_id) if "success" in response: items = response["success"] tag = Tag() tags_visibles = tag.ListVisibleTags() if "success" in tags_visibles: tags = tags_visibles["success"] tallas_res = product.getAllSizes() if "success" in tallas_res: tallas = tallas_res["success"] banners = {} banners["nuevo"] = self.jsonToObject(self.get_argument("nuevo", "")) banners["sale"] = self.jsonToObject(self.get_argument("sale", "")) banners["tienda"] = self.jsonToObject(self.get_argument("tienda", "")) banners["background"] = self.jsonToObject( self.get_argument("background", "")) tag = self.get_argument("tag", "") self.render("preview/index.html", data=lista, items=items, page=page, tags=tags, tags_arr=[tag], tag=tag, tallas=tallas, banners=banners)
def get(self): cellar = Cellar() res_web = cellar.GetWebCellar() cellar_id = None if "success" in res_web: cellar_id = res_web["success"] product = Product() page = int(self.get_argument("page", "1")) ajax = int(self.get_argument("ajax", 0)) lista = product.GetList(cellar_id, page, 16) items = 0 tags = {} tallas = [] response = product.GetItems(cellar_id) if "success" in response: items = response["success"] tag = Tag() tags_visibles = tag.ListVisibleTags() if "success" in tags_visibles: tags = tags_visibles["success"] tallas_res = product.getAllSizes() if "success" in tallas_res: tallas = tallas_res["success"] if ajax == 0: self.render("store/index.html", data=lista, items=items, page=page, tags=tags, tags_arr=None, tag="tienda", tallas=tallas) else: self.render("store/ajax_productos.html", data=lista, items=items, page=page, tags=tags, tags_arr=None, tag="tienda", tallas=tallas)