Subversion Repositories SmartDukaan

Rev

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

Rev 16577 Rev 16579
Line 630... Line 630...
630
                return cashBack.get(category_id)
630
                return cashBack.get(category_id)
631
    else:
631
    else:
632
        return {}
632
        return {}
633
    
633
    
634
def getBundleBySourceSku(source_id, identifier):
634
def getBundleBySourceSku(source_id, identifier):
635
    returnResult=[]
-
 
636
    if source_id in (1,2,4,5):
635
    if source_id in (1,2,4,5):
637
        skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
636
        skuData = list(get_mongo_connection().Catalog.MasterData.find({'identifier':identifier.strip(), 'source_id':source_id}))
638
    elif source_id == 3:
637
    elif source_id == 3:
639
        skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
638
        skuData = list(get_mongo_connection().Catalog.MasterData.find({'secondaryIdentifier':identifier.strip(), 'source_id':source_id}))
640
    else:
639
    else:
Line 642... Line 641...
642
    
641
    
643
    if not skuData:
642
    if not skuData:
644
        return {}
643
        return {}
645
    else:
644
    else:
646
        bundleId = skuData[0]["skuBundleId"]
645
        bundleId = skuData[0]["skuBundleId"]
647
        itemIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bundleId, 'in_stock':1}))
646
        itemIds = list(get_mongo_connection().Catalog.MasterData.find({'skuBundleId':bundleId, 'in_stock':1, 'source_id':{"$in":[1,2,3,5,6]}}), 
648
        for item in itemIds:
-
 
649
            sourceid = item['source_id']
-
 
650
            item['dealFlag'] = 0
-
 
651
            item['dealType'] = 0
-
 
652
            item['dealUrl'] = ""
-
 
653
            if item['sourceid'] ==5 and item['rank'] == 0:
-
 
654
                continue
-
 
655
            if item['sourceid'] ==3:
-
 
656
                item['marketPlaceUrl'] = item['marketPlaceUrl']+'?supc='+item.get('identifier')
647
                       {"source_id":1, "available_price":1, "marketPlaceUrl":1, "gross_price":1, "codAvailable":1, "source_product_name":1, "offer":1, "coupon":1})
657
            manualDeals = list(get_mongo_connection().Catalog.ManualDeals.find({'startDate':{'$lte':to_java_date(datetime.now())},'endDate':{'$gte':to_java_date(datetime.now())},'source_id':sourceid, 'sku':item['_id']}))
-
 
658
            if len(manualDeals) > 0:
-
 
659
                item['dealFlag'] = 1
-
 
660
                item['dealType'] =manualDeals[0]['dealType']
-
 
661
                item['dealUrl'] = manualDeals[0]['dealUrl']
-
 
662
            info = returnLatestPrice(item, sourceid)
-
 
663
            if info:
-
 
664
                returnResult.append(info)
-
 
665
        
-
 
666
        return {'products':returnResult}
648
        return {'products':itemIds}
667
        
649
        
668
    
650
    
669
 
651
 
670
def getDealRank(identifier, source_id, userId):
652
def getDealRank(identifier, source_id, userId):
671
    if source_id in (1,2,4,5,6):
653
    if source_id in (1,2,4,5,6):