Subversion Repositories SmartDukaan

Rev

Rev 15075 | Rev 15090 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15075 Rev 15076
Line 938... Line 938...
938
        return {1:"Data added successfully"}
938
        return {1:"Data added successfully"}
939
 
939
 
940
def searchCollection(class_name, sku, skuBundleId):
940
def searchCollection(class_name, sku, skuBundleId):
941
    data = []
941
    data = []
942
    collection = get_mongo_connection().Catalog[class_name]
942
    collection = get_mongo_connection().Catalog[class_name]
-
 
943
    if class_name == "Notifications":
-
 
944
        cursor = collection.find({'skuBundleId':skuBundleId})
-
 
945
        for val in cursor:
-
 
946
            master = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':val['skuBundleId']}))
-
 
947
            if len(master) > 0:
-
 
948
                val['brand'] = master[0]['brand']
-
 
949
                val['model_name'] = master[0]['model_name']
-
 
950
                val['skuBundleId'] = master[0]['skuBundleId']
-
 
951
            else:
-
 
952
                val['brand'] = ""
-
 
953
                val['model_name'] = ""
-
 
954
                val['skuBundleId'] = val['skuBundleId']
-
 
955
            data.append(val)
-
 
956
    return data
943
    if sku is not None:
957
    if sku is not None:
944
        cursor = collection.find({'sku':sku})
958
        cursor = collection.find({'sku':sku})
945
        for val in cursor:
959
        for val in cursor:
946
            master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
960
            master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
947
            if len(master) > 0:
961
            if len(master) > 0: