Subversion Repositories SmartDukaan

Rev

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

Rev 17013 Rev 17036
Line 425... Line 425...
425
                
425
                
426
            lowestOfferPrice = 0
426
            lowestOfferPrice = 0
427
            inStock = 0
427
            inStock = 0
428
            
428
            
429
            if response is not None:
429
            if response is not None:
430
                lowestOfferPrice = response['available_price']
430
                lowestOfferPrice = float(response['available_price']+response['shippingCharge'])
431
                inStock = response['inStock']          
431
                inStock = response['inStock']          
432
                    
432
                    
433
            print lowestOfferPrice
433
            print lowestOfferPrice
434
            print inStock
434
            print inStock
435
            print "*************"
435
            print "*************"
436
            
436
            
-
 
437
            if lowestOfferPrice ==0:
-
 
438
                inStock = 0
-
 
439
            
437
            
440
            
438
            if inStock  == 1:
441
            if inStock  == 1:
439
                get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice,'updatedOn':to_java_date(now),'priceUpdatedOn':to_java_date(now),'in_stock':inStock,'buyBoxFlag':isBuyBox}}, multi=True)
442
                get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice,'updatedOn':to_java_date(now),'priceUpdatedOn':to_java_date(now),'in_stock':inStock}}, multi=True)
440
                get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice , 'in_stock':inStock,'codAvailable':data['codAvailable']}}, multi=True)
443
                get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'available_price':lowestOfferPrice , 'in_stock':inStock,'codAvailable':data['codAvailable']}}, multi=True)
441
            else:
444
            else:
442
                lowestOfferPrice = data['available_price']
445
                lowestOfferPrice = data['available_price']
443
                get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'updatedOn':to_java_date(now),'in_stock':inStock,'priceUpdatedOn':to_java_date(now),'buyBoxFlag':isBuyBox}}, multi=True)
446
                get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'updatedOn':to_java_date(now),'in_stock':inStock,'priceUpdatedOn':to_java_date(now)}}, multi=True)
444
                get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':inStock,'codAvailable':data['codAvailable']}}, multi=True)
447
                get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':inStock,'codAvailable':data['codAvailable']}}, multi=True)
445
            
448
            
446
            return {'_id':data['_id'],'available_price':lowestOfferPrice,'in_stock':inStock,'source_id':7,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'],'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
449
            return {'_id':data['_id'],'available_price':lowestOfferPrice,'in_stock':inStock,'source_id':7,'source_product_name':data['source_product_name'],'marketPlaceUrl':data['marketPlaceUrl'],'thumbnail':data['thumbnail'],'coupon':data['coupon'], 'codAvailable':data['codAvailable'], 'tagline': data['tagline'], 'offer': data['offer']}
447
        except Exception as e:
450
        except Exception as e:
448
            print traceback.print_exc()
451
            print traceback.print_exc()