Subversion Repositories SmartDukaan

Rev

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

Rev 14495 Rev 14497
Line 699... Line 699...
699
    else:
699
    else:
700
        collection.insert(data)
700
        collection.insert(data)
701
        get_mongo_connection().Catalog.MasterData.update({'_id':data['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}},multi=False)
701
        get_mongo_connection().Catalog.MasterData.update({'_id':data['sku']},{"$set":{'updatedOn':to_java_date(datetime.now())}},multi=False)
702
        return {1:"Data added successfully"}
702
        return {1:"Data added successfully"}
703
 
703
 
-
 
704
def searchCollection(class_name, sku, skuBundleId, offset, limit):
-
 
705
    data = []
-
 
706
    collection = get_mongo_connection().Catalog[class_name]
-
 
707
    cursor = collection.find({'sku':sku})
-
 
708
    for val in cursor:
-
 
709
        master = list(get_mongo_connection().Catalog.MasterData.find({'_id':val['sku']}))
-
 
710
        if len(master) > 0:
-
 
711
            val['brand'] = master[0]['brand']
-
 
712
            val['source_product_name'] = master[0]['source_product_name']
-
 
713
            val['skuBundleId'] = master[0]['skuBundleId']
-
 
714
        else:
-
 
715
            val['brand'] = ""
-
 
716
            val['source_product_name'] = ""
-
 
717
            val['skuBundleId'] = ""
-
 
718
        data.append(val)
-
 
719
    return data
-
 
720
    
-
 
721
 
-
 
722
 
704
 
723
 
705
def main():
724
def main():
706
    print searchMaster(0, 10, "iphone")
725
    print searchMaster(0, 10, "iphone")
707
    
726
    
708
    
727