| Line 1392... |
Line 1392... |
| 1392 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1392 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1393 |
data['model_name'] = str(data['model_name'])
|
1393 |
data['model_name'] = str(data['model_name'])
|
| 1394 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1394 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1395 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1395 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1396 |
return {0:'Sub-Category not selected'}
|
1396 |
return {0:'Sub-Category not selected'}
|
| - |
|
1397 |
elif data['category_id'] !=6 and data['subCategoryId'] !=0:
|
| - |
|
1398 |
return {0:'Sub-Category not valid'}
|
| - |
|
1399 |
else:
|
| - |
|
1400 |
pass
|
| 1397 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1401 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1398 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1402 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1399 |
return {1:'Data added successfully'}
|
1403 |
return {1:'Data added successfully'}
|
| 1400 |
except Exception as e:
|
1404 |
except Exception as e:
|
| 1401 |
print e
|
1405 |
print e
|
| Line 1414... |
Line 1418... |
| 1414 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1418 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1415 |
data['model_name'] = str(data['model_name'])
|
1419 |
data['model_name'] = str(data['model_name'])
|
| 1416 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1420 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1417 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1421 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1418 |
return {0:'Sub-Category not selected'}
|
1422 |
return {0:'Sub-Category not selected'}
|
| - |
|
1423 |
elif data['category_id'] !=6 and data['subCategoryId'] !=0:
|
| - |
|
1424 |
return {0:'Sub-Category not valid'}
|
| - |
|
1425 |
else:
|
| - |
|
1426 |
pass
|
| 1419 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1427 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1420 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
1428 |
get_mongo_connection().Catalog.MasterData.insert(data)
|
| 1421 |
return {1:'Data added successfully.'}
|
1429 |
return {1:'Data added successfully.'}
|
| 1422 |
except Exception as e:
|
1430 |
except Exception as e:
|
| 1423 |
print e
|
1431 |
print e
|
| Line 1436... |
Line 1444... |
| 1436 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1444 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1437 |
data['model_name'] = str(data['model_name'])
|
1445 |
data['model_name'] = str(data['model_name'])
|
| 1438 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1446 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1439 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1447 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1440 |
return {0:'Sub-Category not selected'}
|
1448 |
return {0:'Sub-Category not selected'}
|
| - |
|
1449 |
elif data['category_id'] !=6 and data['subCategoryId'] !=0:
|
| - |
|
1450 |
return {0:'Sub-Category not valid'}
|
| - |
|
1451 |
else:
|
| - |
|
1452 |
pass
|
| 1441 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1453 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1442 |
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)
|
| 1443 |
return {1:'Data updated successfully.'}
|
1455 |
return {1:'Data updated successfully.'}
|
| 1444 |
else:
|
1456 |
else:
|
| 1445 |
_id = data.pop('_id')
|
1457 |
_id = data.pop('_id')
|
| Line 1449... |
Line 1461... |
| 1449 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
1461 |
data['secondaryIdentifier'] = str(data['secondaryIdentifier'])
|
| 1450 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
1462 |
data['brand_id'] = __getBrandIdForBrand(data['brand'], data['category_id'])
|
| 1451 |
data['model_name'] = str(data['model_name'])
|
1463 |
data['model_name'] = str(data['model_name'])
|
| 1452 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
1464 |
if data['category_id'] ==6 and data['subCategoryId'] ==0:
|
| 1453 |
return {0:'Sub-Category not selected'}
|
1465 |
return {0:'Sub-Category not selected'}
|
| - |
|
1466 |
elif data['category_id'] !=6 and data['subCategoryId'] !=0:
|
| - |
|
1467 |
return {0:'Sub-Category not valid'}
|
| - |
|
1468 |
else:
|
| - |
|
1469 |
pass
|
| 1454 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
1470 |
data['subCategory'] = SUB_CATEGORY_MAP.get(data['subCategoryId'])
|
| 1455 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
1471 |
get_mongo_connection().Catalog.MasterData.update({'_id':_id},{"$set":data},upsert=False)
|
| 1456 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
1472 |
similarItems = get_mongo_connection().Catalog.MasterData.find({'skuBundleId':skuBundleId})
|
| 1457 |
for item in similarItems:
|
1473 |
for item in similarItems:
|
| 1458 |
if item['_id'] == _id:
|
1474 |
if item['_id'] == _id:
|