| Line 1390... |
Line 1390... |
| 1390 |
data['identifier'] = str(data['identifier'])
|
1390 |
data['identifier'] = str(data['identifier'])
|
| 1391 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1391 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1392 |
data['model_name'] = str(data['model_name'])
|
1392 |
data['model_name'] = str(data['model_name'])
|
| 1393 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1393 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1394 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1394 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1395 |
raise
|
1395 |
return {0:'Sub-Category not selected'}
|
| 1396 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1396 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1397 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1397 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1398 |
return {1:'Data added successfully'}
|
1398 |
return {1:'Data added successfully'}
|
| 1399 |
except Exception as e:
|
1399 |
except Exception as e:
|
| 1400 |
print e
|
1400 |
print e
|
| Line 1412... |
Line 1412... |
| 1412 |
data['identifier'] = str(data['identifier'])
|
1412 |
data['identifier'] = str(data['identifier'])
|
| 1413 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1413 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1414 |
data['model_name'] = str(data['model_name'])
|
1414 |
data['model_name'] = str(data['model_name'])
|
| 1415 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1415 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1416 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1416 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1417 |
raise
|
1417 |
return {0:'Sub-Category not selected'}
|
| 1418 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1418 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1419 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1419 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1420 |
return {1:'Data added successfully.'}
|
1420 |
return {1:'Data added successfully.'}
|
| 1421 |
except Exception as e:
|
1421 |
except Exception as e:
|
| 1422 |
print e
|
1422 |
print e
|
| Line 1434... |
Line 1434... |
| 1434 |
data['identifier'] = str(data['identifier'])
|
1434 |
data['identifier'] = str(data['identifier'])
|
| 1435 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1435 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1436 |
data['model_name'] = str(data['model_name'])
|
1436 |
data['model_name'] = str(data['model_name'])
|
| 1437 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1437 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1438 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1438 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1439 |
raise
|
1439 |
return {0:'Sub-Category not selected'}
|
| 1440 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1440 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1441 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1441 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1442 |
return {1:'Data updated successfully.'}
|
1442 |
return {1:'Data updated successfully.'}
|
| 1443 |
else:
|
1443 |
else:
|
| 1444 |
_id = data.pop('_id')
|
1444 |
_id = data.pop('_id')
|
| Line 1447... |
Line 1447... |
| 1447 |
data['identifier'] = str(data['identifier'])
|
1447 |
data['identifier'] = str(data['identifier'])
|
| 1448 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1448 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1449 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1449 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1450 |
data['model_name'] = str(data['model_name'])
|
1450 |
data['model_name'] = str(data['model_name'])
|
| 1451 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1451 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1452 |
raise
|
1452 |
return {0:'Sub-Category not selected'}
|
| 1453 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1453 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1454 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1454 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1455 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
1455 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
| 1456 |
for item in similarItems:
|
1456 |
for item in similarItems:
|
| 1457 |
if item['_id'] == _id:
|
1457 |
if item['_id'] == _id:
|