def SearchProductByKeyword(keyword): resultList=[] if (keyword is None) or (keyword is ''): return None keys=keyword.split() if (len(keys)>0 and len(keys)==1): from models import searchProduct #Column: ID, Brand_id, ProductType_ID, Name productResult=searchProduct(keys[0]) if (productResult is not None and len(productResult)>0): for item in productResult: product=Product(item[3],item[0],item[2]) item=dict(name=product._productName,price=product._price,url=product._webUrl, brand=product._brand) resultList.append(item) return resultList
def SearchProductByKeyword(keyword): resultList=[] if (keyword is None) or (keyword is ''): return None keys=keyword.split() if (len(keys)>0 and len(keys)==1): from models import searchProduct #Column: ID, Brand_id, ProductType_ID, Name productResult=searchProduct(keys[0]) if (productResult is not None and len(productResult)>0): #"a.ID, a.Name, a.Website, a.outUrl, a.ProductID, e.color, c.BrandName, g.RetailPrice,g.SalePrice " #name, id, brandName, color, retail, sale, weburl): for item in productResult: try: product=Product(item[1],item[0],item[6],item[5],item[7],item[8],item[3]) result=dict(name=product._productName,price=product._price, saleprice=product._saleprice, color=product._color, url=product._webUrl, brand=product._brand, pic_url=product._pic_path) resultList.append(result) except: pass return resultList