def items(request,shop,category): stories = getCategoriesInfo() lvl1 = "Category" lvl2 = "Gallery" if (shop in stories): for c in stories[shop]: if (category in stories[shop][c]['children']): lvl1 = stories[shop][c]['name'] lvl2 = stories[shop][c]['children'][category]['name'] else: return error.ZoyoeError("category does not exist") dict = {'SHOP':shop,'ITEM_WIDTH':'200','STORIES':stories,'PATH':lvl1,'CATEGORY':lvl2} query = getCategoryItems(category).filter("disable ==",False) myPagedQuery = PagedQuery(query, 12) items = [] dict['queryurlprev'] = "#" dict['queryurlnext'] = "#" total = myPagedQuery.page_count() dict['pages'] = range(1,total+1) idx = 0 if ('page' in request.GET): idx = int(request.GET['page']) items = myPagedQuery.fetch_page(int(request.GET['page'])) else: items = myPagedQuery.fetch_page() if (idx != 0): dict['queryurlprev'] = "/items/"+shop+"/"+category +"/?page="+str(idx-1) if (idx < dict['pages']): dict['queryurlnext'] = "/items/"+shop+"/"+category +"/?page="+str(idx+1) dict['sellitems'] = items dict['queryurl'] = "/items/"+shop+"/"+category context = Context(dict) temp_path = getSiteInfo().gettemplate("products.html"); return (render_to_response(temp_path,context,context_instance=RequestContext(request)))
def getItemHistoryResponse(request): itemrefs = getItemHistory(request) items = [] if (itemrefs != None): for ref in itemrefs: items.append(getItem(ref)) stories = getCategoriesInfo() lvl1 = "Viewing History" dict = {'SHOP':'Items you recently viewed','STORIES':stories,'PATH':lvl1,'CATEGORY':""} dict['sellitems'] = items context = Context(dict) temp_path = currentSite().gettemplate("products.html"); return (render_to_response(temp_path,context,context_instance=RequestContext(request))) else: return userError(request,"Your have not signed in")
def items(request, shop, category): stories = getCategoriesInfo() lvl1 = "Category" lvl2 = "Gallery" if (shop in stories): for c in stories[shop]: if (category in stories[shop][c]['children']): lvl1 = stories[shop][c]['name'] lvl2 = stories[shop][c]['children'][category]['name'] else: return error.ZoyoeError("category does not exist") dict = { 'SHOP': shop, 'ITEM_WIDTH': '200', 'STORIES': stories, 'PATH': lvl1, 'CATEGORY': lvl2 } query = getCategoryItems(category).filter("disable ==", False) myPagedQuery = PagedQuery(query, 12) items = [] dict['queryurlprev'] = "#" dict['queryurlnext'] = "#" total = myPagedQuery.page_count() dict['pages'] = range(1, total + 1) idx = 0 if ('page' in request.GET): idx = int(request.GET['page']) items = myPagedQuery.fetch_page(int(request.GET['page'])) else: items = myPagedQuery.fetch_page() if (idx != 0): dict[ 'queryurlprev'] = "/items/" + shop + "/" + category + "/?page=" + str( idx - 1) if (idx < dict['pages']): dict[ 'queryurlnext'] = "/items/" + shop + "/" + category + "/?page=" + str( idx + 1) dict['sellitems'] = items dict['queryurl'] = "/items/" + shop + "/" + category context = Context(dict) temp_path = getSiteInfo().gettemplate("products.html") return (render_to_response(temp_path, context, context_instance=RequestContext(request)))
def main(request): if (request.META['HTTP_HOST']=="www.zoyoe.com"): # This is the main website stories = getCategoriesInfo() fliers = ShopInfo.all().filter("type =","category").order("name") context = Context({'STORIES':stories,'FLIERS':fliers}) return (render_to_response("zoyoe/index.html",context,context_instance=RequestContext(request))) else: # This is customer's website site = getSiteInfo() if site: if site.published: return retail(request) else: return HttpResponseRedirect('/admin/') else: return HttpResponseRedirect('/admin/config/preference/')
def main(request): if (request.META['HTTP_HOST'] == "www.zoyoe.com"): # This is the main website stories = getCategoriesInfo() fliers = ShopInfo.all().filter("type =", "category").order("name") context = Context({'STORIES': stories, 'FLIERS': fliers}) return (render_to_response("zoyoe/index.html", context, context_instance=RequestContext(request))) else: # This is customer's website site = getSiteInfo() if site: if site.published: return retail(request) else: return HttpResponseRedirect('/admin/') else: return HttpResponseRedirect('/admin/config/preference/')
def getItemHistoryResponse(request): itemrefs = getItemHistory(request) items = [] if (itemrefs != None): for ref in itemrefs: items.append(getItem(ref)) stories = getCategoriesInfo() lvl1 = "Viewing History" dict = { 'SHOP': 'Items you recently viewed', 'STORIES': stories, 'PATH': lvl1, 'CATEGORY': "" } dict['sellitems'] = items context = Context(dict) temp_path = currentSite().gettemplate("products.html") return (render_to_response(temp_path, context, context_instance=RequestContext(request))) else: return userError(request, "Your have not signed in")
def item(request, shop, key): stories = getCategoriesInfo() item = Item.get_by_id(int(key), parent=getSupplier(shop)) return record.getItemResponse(request, item, stories)
def item(request,shop,key): stories = getCategoriesInfo() item = Item.get_by_id(int(key),parent = getSupplier(shop)) return record.getItemResponse(request,item,stories)