| Line 6... |
Line 6... |
| 6 |
1. The catalog database which it reads from the local database.
|
6 |
1. The catalog database which it reads from the local database.
|
| 7 |
2. FeatureValues.xls which is generated using the FeatureValueExtractor
|
7 |
2. FeatureValues.xls which is generated using the FeatureValueExtractor
|
| 8 |
script in the ContentStore project.
|
8 |
script in the ContentStore project.
|
| 9 |
3. ItemNumbers.xls which is fetched from Nilesh to get UPC/EAN
|
9 |
3. ItemNumbers.xls which is fetched from Nilesh to get UPC/EAN
|
| 10 |
of all handsets since Amazon is adamant that they'll not accept data w/o it.
|
10 |
of all handsets since Amazon is adamant that they'll not accept data w/o it.
|
| - |
|
11 |
4. Imagenames.xls which is generated using the FeatureValueExtractor
|
| - |
|
12 |
script in the ContentStore project. This contains item id and image url mapping.
|
| 11 |
|
13 |
|
| 12 |
Once the CSV file is generated, a header should be added to it.
|
14 |
Once the CSV file is generated, a header should be added to it.
|
| 13 |
|
15 |
|
| 14 |
@attention: The columns and their order in the featurevalues.xls can
|
16 |
@attention: The columns and their order in the featurevalues.xls can
|
| 15 |
change depending on the object model. As such the output should be
|
17 |
change depending on the object model. As such the output should be
|
| Line 182... |
Line 184... |
| 182 |
for mapping in mappings:
|
184 |
for mapping in mappings:
|
| 183 |
if mapping.vendorId == 1:
|
185 |
if mapping.vendorId == 1:
|
| 184 |
return mapping.itemKey
|
186 |
return mapping.itemKey
|
| 185 |
return None
|
187 |
return None
|
| 186 |
|
188 |
|
| - |
|
189 |
def load_item_id_image_url_map():
|
| - |
|
190 |
filename = "/home/rajveer/Desktop/imagenames.xls"
|
| - |
|
191 |
workbook = xlrd.open_workbook(filename)
|
| - |
|
192 |
sheet = workbook.sheet_by_index(0)
|
| - |
|
193 |
num_rows = sheet.nrows
|
| - |
|
194 |
itemIdMap = {}
|
| - |
|
195 |
for rownum in range(0, num_rows):
|
| - |
|
196 |
itemId, image_url = sheet.row_values(rownum)[0:2]
|
| - |
|
197 |
itemIdMap[itemId] = image_url
|
| - |
|
198 |
return itemIdMap
|
| - |
|
199 |
|
| - |
|
200 |
|
| 187 |
def main():
|
201 |
def main():
|
| 188 |
itemNumberMap, itemNumberTypeMap = load_item_numbers()
|
202 |
itemNumberMap, itemNumberTypeMap = load_item_numbers()
|
| 189 |
catalog_client = CatalogClient().get_client()
|
203 |
catalog_client = CatalogClient().get_client()
|
| 190 |
item_details = []
|
204 |
item_details = []
|
| 191 |
filename = "/home/rajveer/Desktop/featurevalues.xls"
|
205 |
filename = "/home/rajveer/Desktop/featurevalues.xls"
|
| Line 217... |
Line 231... |
| 217 |
"Shipping Weight","Weight","Length","Height","Width","Keywords1","Keywords2", "Keywords3","Keywords4",\
|
231 |
"Shipping Weight","Weight","Length","Height","Width","Keywords1","Keywords2", "Keywords3","Keywords4",\
|
| 218 |
"Keywords5","Bullet point1","Bullet point2","Bullet point3","Bullet point4","Bullet point5",\
|
232 |
"Keywords5","Bullet point1","Bullet point2","Bullet point3","Bullet point4","Bullet point5",\
|
| 219 |
"Other image-url1","Other image-url2","Other image-url3","Other image-url4","Other image-url5",
|
233 |
"Other image-url1","Other image-url2","Other image-url3","Other image-url4","Other image-url5",
|
| 220 |
"Offer note","Is Gift Wrap Available","Registered Parameter","Update Delete"])
|
234 |
"Offer note","Is Gift Wrap Available","Registered Parameter","Update Delete"])
|
| 221 |
|
235 |
|
| - |
|
236 |
itemIdImageUrlMap = load_item_id_image_url_map()
|
| - |
|
237 |
|
| 222 |
for rownum in range(2, num_rows): #2 is used as the starting index because first row is a test product with 12 years of warranty.
|
238 |
for rownum in range(2, num_rows): #2 is used as the starting index because first row is a test product with 12 years of warranty.
|
| 223 |
unused_categoryName, unused_entityName, entityID, image_url, unused_accessories, unused_softwareApplications, unused_pageTitle,\
|
239 |
unused_categoryName, unused_entityName, entityID, image_url, unused_accessories, unused_softwareApplications, unused_pageTitle,\
|
| 224 |
unused_metaDescription, metaKeywords, unused_snippets, unused_shortSnippet, tagline,\
|
240 |
unused_metaDescription, metaKeywords, unused_snippets, unused_shortSnippet, tagline,\
|
| 225 |
unused_skinSize, screenSize, unused_screenLeftUpperCornerDimension, unused_modelNameSynonyms, unused_modelNumberSynonyms,\
|
241 |
unused_skinSize, screenSize, unused_screenLeftUpperCornerDimension, unused_modelNameSynonyms, unused_modelNumberSynonyms,\
|
| 226 |
warranty, unused_warranty_type, unused_warranty_coverage, \
|
242 |
warranty, unused_warranty_type, unused_warranty_coverage, \
|
| Line 292... |
Line 308... |
| 292 |
for item in active_items:
|
308 |
for item in active_items:
|
| 293 |
stdProductId = ''
|
309 |
stdProductId = ''
|
| 294 |
stdProductIdType = ''
|
310 |
stdProductIdType = ''
|
| 295 |
if not item.color:
|
311 |
if not item.color:
|
| 296 |
item.color = ''
|
312 |
item.color = ''
|
| 297 |
|
313 |
image_url = itemIdImageUrlMap.get(item.id)
|
| 298 |
mappings = catalog_client.getVendorItemMappings(item.id)
|
314 |
mappings = catalog_client.getVendorItemMappings(item.id)
|
| 299 |
key = get_hotspot_mapping(mappings)
|
315 |
key = get_hotspot_mapping(mappings)
|
| 300 |
if key and itemNumberTypeMap.has_key(key):
|
316 |
if key and itemNumberTypeMap.has_key(key):
|
| 301 |
stdProductId = itemNumberMap[key]
|
317 |
stdProductId = itemNumberMap[key]
|
| 302 |
stdProductIdType = itemNumberTypeMap[key]
|
318 |
stdProductIdType = itemNumberTypeMap[key]
|