initBasti / Amazon2PlentySync (public) (License: GPLv3) (since 2019-01-27) (hash sha1)
Transfer your data from you Amazon Flatfile spreadsheet over to the Plentymarkets system. How to is included in the readme
List of commits:
Subject Hash Author Date (UTC)
Bug-fix: Empty output item upload c7b09d6224024d03e2ac711371091fc46c234bb0 Sebastian Fricke 2020-04-30 06:53:28
Remove encoding from xlsx file intern numbers 798259d898b83395e50f4d855399058c807f0c0c Sebastian Fricke 2020-04-29 13:50:47
Improve coding style and linting d3d1d6de52f0f5530ec200aae082ac0ec99ddd70 Sebastian Fricke 2020-04-29 10:08:21
Remove fixed values for specific item settings 0f2452a1bb953efcbb797c5feeb2b8f35617f537 Sebastian Fricke 2020-04-29 08:38:52
Remove fixed fba values from upload 758ca263cf88343c55af70b1e7824c76d485d7f2 Sebastian Fricke 2020-04-29 08:32:09
Remove market assign & availibilty settings fdf971d45706f8c75d9a7ea7e949193c45620051 Sebastian Fricke 2020-04-29 07:31:36
Remove manual upload of extern id & export files 66d60bc9243173f256b01071f203849edf43546d Sebastian Fricke 2020-04-28 13:55:27
Bug Fix: product-import.py Empty TK root window 0b087f8a7902523b2495c936a6e09447a93a6cb5 Sebastian Fricke 2020-04-28 09:41:04
Add ignore file for silver searcher tool 87a1b335af1f88c10ad12e5b8f59f8207c58aaec Sebastian Fricke 2020-04-28 09:25:54
add tests folder pycache to gitignore 9d7989d1658d3dffd7eb00e9411af3dec6c85563 Sebastian Fricke 2020-04-27 12:55:24
Unit test for find_price function c19fa28ad9bf0dd1b5361e871dc498f6704cb196 Sebastian Fricke 2020-04-27 12:53:20
Remove price calculation from script d852cb3ef648336ed94daeaaa220721e6055dd7c Sebastian Fricke 2020-04-27 12:50:52
Function description priceUpload 2c5735f4f4c79607f55c77b1359aa5984d1e6699 Sebastian Fricke 2020-04-23 09:34:30
similar attribute search regardless of the parent 4bb0970408d78d25264d479428fe8c3389483215 Sebastian Fricke 2020-04-23 09:28:19
Fix marking dropdown bug 0d1695083d2b4e49fd364a36a7ef3c92a192d62f Sebastian Fricke 2020-04-23 09:26:46
update desktop specific build script for windows 8a6536d6173f7383022fab92f234ab25fc81204b Sebastian Fricke 2020-04-22 10:15:05
Refactor config handling a9be950a4e8d97fa97c7e9caff33fcbb1f476d9d Sebastian Fricke 2020-04-22 10:11:57
Fix gui/category_chooser: file change bug 9879e65c9aad9b1feb05b6121a0e33c129a8beb5 Sebastian Fricke 2020-04-22 10:09:36
update .gitignore 6c7628af605a72ced1e146c27da8639225ab9c6c Sebastian Fricke 2020-04-22 10:08:47
Fix error.py: Fix colorful messages on windows 31f0b106c7aee1962bba3efb5758f647170eceff Sebastian Fricke 2020-04-22 10:07:30
Commit c7b09d6224024d03e2ac711371091fc46c234bb0 - Bug-fix: Empty output item upload
After the removal of an unnecessary try-except statement, the indent of
a major part of the program was aligned beneath a if statement.

Fix the indent issue.
Remove further unnecessary comments and change naming according to
convention.

Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
Author: Sebastian Fricke
Author date (UTC): 2020-04-30 06:53
Committer name: Sebastian Fricke
Committer date (UTC): 2020-04-30 06:53
Parent(s): 798259d898b83395e50f4d855399058c807f0c0c
Signing key:
Tree: e709b4d2cb7ac8ce27830914cff2762e4aeea8c1
File Lines added Lines deleted
packages/item_upload.py 73 78
File packages/item_upload.py changed (mode: 100644) (index 30d5d3b..a89f4a4)
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
32 32 ] ]
33 33
34 34 data = dict() data = dict()
35 package_properties = dict()
36 color_size_sets = dict()
37 barcode_data = dict()
35 38 sorted_data = collections.OrderedDict() sorted_data = collections.OrderedDict()
36 package_properties = {}
37 barcode_data = {}
38 is_parent = False
39 group_parent = ''
39 40 position = 0 position = 0
40 41 item_price = 0 item_price = 0
42 is_parent = False
41 43
42 # Get sets of all colors and sizes for each parent
43 # to find if there are some with only one attribute value for all childs
44 color_size_sets = {}
45 44 color_size_sets = findSimilarAttr(flatfile, ['size_name']) color_size_sets = findSimilarAttr(flatfile, ['size_name'])
46 45
47 package_properties = getProperties(flatfile)
48 group_parent = ''
46 package_properties = get_properties(flatfile)
49 47
50 48 with open(flatfile['path'], mode='r', encoding=flatfile['encoding']) as item: with open(flatfile['path'], mode='r', encoding=flatfile['encoding']) as item:
51 49 reader = csv.DictReader(item, delimiter=";") reader = csv.DictReader(item, delimiter=";")
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
63 61 msg="Generic Keywords are empty!", err='', msg="Generic Keywords are empty!", err='',
64 62 linenumber=inspect.currentframe().f_back.f_lineno) linenumber=inspect.currentframe().f_back.f_lineno)
65 63
66 item_price = row['standard_price']
67 if not item_price and row['parent_child'] == 'parent':
68 item_price = price.find_price(flatfile, row['item_sku'])
69 if item_price == -1:
70 if os.name == 'nt':
71 print("press ENTER to continue..")
72 input()
73 sys.exit(1)
74 if item_price == '':
75 error.warnPrint(
76 msg=str(f"{row['item_sku']},has no price"), err='',
77 linenumber=inspect.currentframe().f_back.f_lineno)
64 item_price = row['standard_price']
65 if not item_price and row['parent_child'] == 'parent':
66 item_price = price.find_price(flatfile, row['item_sku'])
67 if item_price == -1:
68 if os.name == 'nt':
69 print("press ENTER to continue..")
70 input()
71 sys.exit(1)
72 if item_price == '':
73 error.warnPrint(
74 msg=str(f"{row['item_sku']},has no price"), err='',
75 linenumber=inspect.currentframe().f_back.f_lineno)
78 76
79 77
80 try:
81 attributes = ''
82 if row['parent_child'] == 'parent':
83 is_parent = True
84 group_parent = row['item_sku']
85 position = 0
86 if row['parent_child'] == 'child':
87 is_parent = False
88 attributes = getAttributes(dataset=row,
89 sets=color_size_sets)
90 if(group_parent and row['parent_sku'] == group_parent):
91 position += 1
92 except Exception as err:
93 error.warnPrint(msg="Attribute setting failed", err=err,
94 linenumber=sys.exc_info()[2].tb_lineno)
95 try:
96 values = [
97 row['parent_sku'], row['item_sku'],
98 is_parent,
99 package_properties['length'] * 10,
100 package_properties['width'] * 10,
101 package_properties['height'] * 10,
102 package_properties['weight'],
103 row['item_name'], '104',
104 attributes, position,
105 keywords,
106 input_data['name'], row['product_description'],
107 '', # externalID
108 input_data['categories'],
109 input_data['categories'][0:3],
110 input_data['categories'][0:3],
111 input_data['categories'],
112 input_data['categories'][0:3], input_data['categories'][0:3],
113 '', '', # barcode
114 '', '', # market & accout id amazonsku
115 '', '', # sku & parentsku amazonsku
116 amazon.get_producttype_id(source=flatfile,
117 sku=row['item_sku']),
118 item_price, # prices
119 '', '', '', #asin
120 input_data['marking']
121 ]
78 try:
79 attributes = ''
80 if row['parent_child'] == 'parent':
81 is_parent = True
82 group_parent = row['item_sku']
83 position = 0
84 if row['parent_child'] == 'child':
85 is_parent = False
86 attributes = getAttributes(dataset=row,
87 sets=color_size_sets)
88 if(group_parent and row['parent_sku'] == group_parent):
89 position += 1
90 except Exception as err:
91 error.warnPrint(msg="Attribute setting failed", err=err,
92 linenumber=sys.exc_info()[2].tb_lineno)
93 try:
94 values = [
95 row['parent_sku'], row['item_sku'],
96 is_parent,
97 package_properties['length'] * 10,
98 package_properties['width'] * 10,
99 package_properties['height'] * 10,
100 package_properties['weight'],
101 row['item_name'], '104',
102 attributes, position,
103 keywords,
104 input_data['name'], row['product_description'],
105 '', # externalID
106 input_data['categories'],
107 input_data['categories'][0:3],
108 input_data['categories'][0:3],
109 input_data['categories'],
110 input_data['categories'][0:3], input_data['categories'][0:3],
111 '', '', # barcode
112 '', '', # market & accout id amazonsku
113 '', '', # sku & parentsku amazonsku
114 amazon.get_producttype_id(source=flatfile,
115 sku=row['item_sku']),
116 item_price, # prices
117 '', '', '', #asin
118 input_data['marking']
119 ]
122 120
123 except KeyError as kerr:
124 error.warnPrint(
125 msg='column name not found in flatfile',
126 err=kerr,
127 linenumber=inspect.currentframe().f_back.f_lineno)
128 raise KeyError
129 except Exception as err:
130 error.errorPrint(msg="setting values failed", err=err,
131 linenumber=sys.exc_info()[2].tb_lineno)
121 except KeyError as kerr:
122 error.warnPrint(
123 msg='column name not found in flatfile',
124 err=kerr,
125 linenumber=inspect.currentframe().f_back.f_lineno)
126 raise KeyError
127 except Exception as err:
128 error.errorPrint(msg="setting values failed", err=err,
129 linenumber=sys.exc_info()[2].tb_lineno)
132 130
133 data[row['item_sku']] =\
134 collections.OrderedDict(zip(column_names, values))
131 data[row['item_sku']] =\
132 collections.OrderedDict(zip(column_names, values))
135 133
136 # open the intern number xlsx to get the external id
137 134 get_externalid(dataset=data, numberlist=intern) get_externalid(dataset=data, numberlist=intern)
138 135
139 136 barcode_data = barcode.barcode_Upload(flatfile, stocklist) barcode_data = barcode.barcode_Upload(flatfile, stocklist)
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
151 148 msg=str(f"Barcode part for {row}"), err=err, msg=str(f"Barcode part for {row}"), err=err,
152 149 linenumber=sys.exc_info()[2].tb_lineno) linenumber=sys.exc_info()[2].tb_lineno)
153 150
154 # Include the amazonsku
155 151 sku_data = amazon.amazonSkuUpload(flatfile) sku_data = amazon.amazonSkuUpload(flatfile)
156 152
157 153 for row in sku_data: for row in sku_data:
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
166 162 msg=str(f"SKU part for {row}"), err=err, msg=str(f"SKU part for {row}"), err=err,
167 163 linenumber=sys.exc_info()[2].tb_lineno) linenumber=sys.exc_info()[2].tb_lineno)
168 164
169 # Sort the dictionary to make sure that the parents are the first variant of each item
170 165 sorted_data = sortProducts(data) sorted_data = sortProducts(data)
171 166
172 167 barcode.writeCSV(sorted_data, "item", column_names, folder, filename) barcode.writeCSV(sorted_data, "item", column_names, folder, filename)
 
... ... def itemPropertyUpload(flatfile, folder, filename):
236 231
237 232 barcode.writeCSV(data, "Item_Merkmale", column_names, folder, filename) barcode.writeCSV(data, "Item_Merkmale", column_names, folder, filename)
238 233
239 def getProperties(flatfile):
234 def get_properties(flatfile):
240 235
241 236 properties = {'length':0, properties = {'length':0,
242 237 'width':0, 'width':0,
 
... ... def getProperties(flatfile):
275 270 linenumber=sys.exc_info()[2].tb_lineno) linenumber=sys.exc_info()[2].tb_lineno)
276 271 sys.exit() sys.exit()
277 272 except KeyError as err: except KeyError as err:
278 msg = str(f"getProperties key: {err} not found")
273 msg = str(f"get_properties key: {err} not found")
279 274 error.errorPrint(msg=msg, err='', error.errorPrint(msg=msg, err='',
280 275 linenumber=sys.exc_info()[2].tb_lineno) linenumber=sys.exc_info()[2].tb_lineno)
281 276
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/initBasti/Amazon2PlentySync

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/initBasti/Amazon2PlentySync

Clone this repository using git:
git clone git://git.rocketgit.com/user/initBasti/Amazon2PlentySync

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main