File packages/amazon_data_upload.py changed (mode: 100644) (index 0de9797..7084878) |
... |
... |
def amazonSkuUpload(flatfile, export): |
59 |
59 |
|
|
60 |
60 |
output_path = writeCSV(Data, 'sku_amazon', column_names) |
output_path = writeCSV(Data, 'sku_amazon', column_names) |
61 |
61 |
|
|
62 |
|
def amazon |
|
|
62 |
|
|
|
63 |
|
def amazonDataUpload(flatfile, export): |
|
64 |
|
|
|
65 |
|
column_names = [ |
|
66 |
|
'ItemAmazonProductType', 'ItemProductType', 'bullet_point1' |
|
67 |
|
, 'bullet_point2', 'bullet_point3', 'bullet_point4' |
|
68 |
|
, 'bullet_point5', 'fit_type' |
|
69 |
|
, 'lifestyle', 'batteries_required' |
|
70 |
|
, 'supplier_declared_dg_hz_regulation1' |
|
71 |
|
, 'supplier_declared_dg_hz_regulation2' |
|
72 |
|
, 'supplier_declared_dg_hz_regulation3' |
|
73 |
|
, 'supplier_declared_dg_hz_regulation4' |
|
74 |
|
, 'supplier_declared_dg_hz_regulation5', 'ItemID'] |
|
75 |
|
|
|
76 |
|
Data = SortedDict() |
|
77 |
|
|
|
78 |
|
with open(flatfile, mode='r') as item: |
|
79 |
|
reader = csv.DictReader(item, delimiter=";") |
|
80 |
|
|
|
81 |
|
for row in reader: |
|
82 |
|
if(row['parent_child'] == 'parent'): |
|
83 |
|
values = [row['product_type'], row['product_type'] |
|
84 |
|
, row['bullet_point1'], row['bullet_point2'] |
|
85 |
|
, row['bullet_point3'], row['bullet_point4'] |
|
86 |
|
, row['bullet_point5'], row['fit_type'] |
|
87 |
|
, row['lifestyle'], row['batteries_required'] |
|
88 |
|
, row['supplier_declared_dg_hz_regulation1'] |
|
89 |
|
, row['supplier_declared_dg_hz_regulation2'] |
|
90 |
|
, row['supplier_declared_dg_hz_regulation3'] |
|
91 |
|
, row['supplier_declared_dg_hz_regulation4'] |
|
92 |
|
, row['supplier_declared_dg_hz_regulation5'] |
|
93 |
|
, ''] |
|
94 |
|
Data[row['item_sku']] = SortedDict(zip(column_names, values)) |
|
95 |
|
|
|
96 |
|
with open(export, mode='r') as item: |
|
97 |
|
reader = csv.DictReader(item, delimiter=";") |
|
98 |
|
|
|
99 |
|
for row in reader: |
|
100 |
|
if(row['VariationNumber'] in [*Data]): |
|
101 |
|
Data[row['VariationNumber']]['ItemID'] = row['ItemID'] |
|
102 |
|
|
|
103 |
|
writeCSV(dataobject=Data, name='amazon_data', columns=column_names) |
File packages/variation_upload.py changed (mode: 100644) (index 8247872..558e66f) |
... |
... |
def variationUpload(flatfile, intern_number): |
98 |
98 |
|
|
99 |
99 |
def setActive(flatfile, export): |
def setActive(flatfile, export): |
100 |
100 |
# because of a regulation of the plentyMarkets system the active status has to be delivered as an extra upload |
# because of a regulation of the plentyMarkets system the active status has to be delivered as an extra upload |
101 |
|
column_names = ['Active', 'ItemID', 'VariationID', 'VariationNumber'] |
|
|
101 |
|
column_names = ['Active', 'VariationID'] |
102 |
102 |
Data = {} |
Data = {} |
103 |
103 |
# open the flatfile to get the sku names |
# open the flatfile to get the sku names |
104 |
104 |
with open(flatfile, mode='r') as item: |
with open(flatfile, mode='r') as item: |
105 |
105 |
reader = DictReader(item, delimiter=';') |
reader = DictReader(item, delimiter=';') |
106 |
106 |
|
|
107 |
107 |
for row in reader: |
for row in reader: |
108 |
|
values = ['Y', '', '', row['item_sku']] |
|
|
108 |
|
values = ['Y', ''] |
109 |
109 |
Data[row['item_sku']] = dict(zip(column_names, values)) |
Data[row['item_sku']] = dict(zip(column_names, values)) |
110 |
110 |
|
|
111 |
111 |
with open(export, mode='r') as item: |
with open(export, mode='r') as item: |
112 |
112 |
reader = DictReader(item, delimiter=';') |
reader = DictReader(item, delimiter=';') |
113 |
113 |
for row in reader: |
for row in reader: |
114 |
114 |
if(row['VariationNumber'] in [*Data]): |
if(row['VariationNumber'] in [*Data]): |
115 |
|
Data[row['VariationNumber']]['ItemID'] = row['ItemID'] |
|
116 |
115 |
Data[row['VariationNumber']]['VariationID'] = row['VariationID'] |
Data[row['VariationNumber']]['VariationID'] = row['VariationID'] |
117 |
116 |
output_path = writeCSV(Data, 'active', column_names) |
output_path = writeCSV(Data, 'active', column_names) |
118 |
117 |
|
|
119 |
118 |
|
|
120 |
119 |
def EANUpload(flatfile, export): |
def EANUpload(flatfile, export): |
121 |
120 |
# open the flatfile get the ean for an sku and save it into a dictionary with columnheaders of the plentymarket dataformat |
# open the flatfile get the ean for an sku and save it into a dictionary with columnheaders of the plentymarket dataformat |
|
121 |
|
|
122 |
122 |
column_names = ['BarcodeID', 'BarcodeName', 'BarcodeType', |
column_names = ['BarcodeID', 'BarcodeName', 'BarcodeType', |
123 |
123 |
'Code', 'VariationID', 'VariationNumber'] |
'Code', 'VariationID', 'VariationNumber'] |
124 |
124 |
Data = {} |
Data = {} |
|
... |
... |
def EANUpload(flatfile, export): |
139 |
139 |
Data[row['VariationNumber']]['VariationID'] = row['VariationID'] |
Data[row['VariationNumber']]['VariationID'] = row['VariationID'] |
140 |
140 |
|
|
141 |
141 |
output_path = writeCSV(Data, 'EAN', column_names) |
output_path = writeCSV(Data, 'EAN', column_names) |
|
142 |
|
|
|
143 |
|
|
|
144 |
|
def marketConnection(export, ebay=0, amazon=0): |
|
145 |
|
# Enable marketconnection of items and variations by entering 1 for True |
|
146 |
|
# and 0 for False |
|
147 |
|
|
|
148 |
|
column_names = ['VariationID', 'VariationCustomNumber', |
|
149 |
|
'webApi', 'AmazonGermany', 'Amazon', 'eBayGermany', 'Ebay'] |
|
150 |
|
|
|
151 |
|
Data = {} |
|
152 |
|
with open(export, mode='r') as item: |
|
153 |
|
reader = DictReader(item, delimiter=';') |
|
154 |
|
|
|
155 |
|
for row in reader: |
|
156 |
|
if row['VariationID'] and row['VariationNumber']: |
|
157 |
|
values = [row['VariationID'], row['VariationNumber'], |
|
158 |
|
'1', amazon, amazon, ebay, ebay] |
|
159 |
|
Data[row['VariationNumber']] = dict(zip(column_names, values)) |
|
160 |
|
|
|
161 |
|
|
|
162 |
|
output_path = writeCSV(Data, 'market_connect', column_names) |
File product_import.py changed (mode: 100644) (index 51b2add..d9dd4a4) |
... |
... |
from tkinter.filedialog import askopenfilename |
3 |
3 |
from sys import exit |
from sys import exit |
4 |
4 |
from packages.item_upload import itemUpload |
from packages.item_upload import itemUpload |
5 |
5 |
# from packages.attribute_upload import attributeUpload |
# from packages.attribute_upload import attributeUpload |
6 |
|
from packages.variation_upload import variationUpload, setActive, EANUpload |
|
|
6 |
|
from packages.variation_upload import variationUpload, setActive, EANUpload, marketConnection |
7 |
7 |
from packages.stock_upload import stockUpload, priceUpload |
from packages.stock_upload import stockUpload, priceUpload |
8 |
8 |
from packages.UploadGUI import UploadGUI |
from packages.UploadGUI import UploadGUI |
9 |
|
from packages.amazon_data_upload import amazonSkuUpload |
|
|
9 |
|
from packages.amazon_data_upload import amazonSkuUpload, amazonDataUpload |
10 |
10 |
from packages.image_upload import imageUpload |
from packages.image_upload import imageUpload |
11 |
11 |
|
|
12 |
12 |
|
|
|
... |
... |
def main(): |
24 |
24 |
print("spreadsheet csv containing the flatfile : ", sheet) |
print("spreadsheet csv containing the flatfile : ", sheet) |
25 |
25 |
print("spreadsheet csv containing the intern numbers : ", intern_number) |
print("spreadsheet csv containing the intern numbers : ", intern_number) |
26 |
26 |
try: |
try: |
27 |
|
print("Item Upload") |
|
|
27 |
|
print("\nItem Upload\n") |
28 |
28 |
itemUpload(sheet, intern_number) |
itemUpload(sheet, intern_number) |
29 |
29 |
except Exception as exc: |
except Exception as exc: |
30 |
30 |
print(exc) |
print(exc) |
31 |
31 |
print("Item Upload failed!") |
print("Item Upload failed!") |
32 |
32 |
|
|
33 |
33 |
try: |
try: |
34 |
|
print("Variation Upload") |
|
|
34 |
|
print("\nVariation Upload\n") |
35 |
35 |
variationUpload(sheet, intern_number) |
variationUpload(sheet, intern_number) |
36 |
36 |
except Exception as exc: |
except Exception as exc: |
37 |
37 |
print(exc) |
print(exc) |
38 |
38 |
print("VariationUpload failed!") |
print("VariationUpload failed!") |
39 |
39 |
|
|
|
40 |
|
print("###########################################################") |
|
41 |
|
print("\nUpload the files in plentymarkets, make sure that the categories are set because they are necessary for the active Upload.\n") |
|
42 |
|
|
|
43 |
|
moveon = input("Continue(ENTER)") |
|
44 |
|
|
40 |
45 |
print("\nGet a dataexport from the plentymarket site from the variation attributes, in order to access the current Variation ID.\n") |
print("\nGet a dataexport from the plentymarket site from the variation attributes, in order to access the current Variation ID.\n") |
41 |
46 |
try: |
try: |
42 |
47 |
export = askopenfilename() |
export = askopenfilename() |
|
... |
... |
def main(): |
65 |
70 |
|
|
66 |
71 |
amazonSkuUpload(sheet, export) |
amazonSkuUpload(sheet, export) |
67 |
72 |
|
|
|
73 |
|
print("\nCreate a upload file for the additional Information to Amazon Products like bullet points, lifestyle etc.\n") |
|
74 |
|
|
|
75 |
|
amazonDataUpload(sheet, export) |
|
76 |
|
|
68 |
77 |
print("\nCollect the imagelinks from the flatfile, sorts them and assigns the variation ID.\n") |
print("\nCollect the imagelinks from the flatfile, sorts them and assigns the variation ID.\n") |
69 |
78 |
try: |
try: |
70 |
79 |
imageUpload(sheet, export) |
imageUpload(sheet, export) |
|
... |
... |
def main(): |
72 |
81 |
print(err) |
print(err) |
73 |
82 |
print("Image Upload failed!") |
print("Image Upload failed!") |
74 |
83 |
|
|
|
84 |
|
print("\nActivate Marketconnection for Ebay & Amazon for all variation.\n") |
|
85 |
|
|
|
86 |
|
try: |
|
87 |
|
marketConnection(export, ebay=1, amazon=0) |
|
88 |
|
except Exception as err: |
|
89 |
|
print(err) |
|
90 |
|
print("Market connection failed!") |
|
91 |
|
|
75 |
92 |
# In case of new attributes uncomment and watch attribute_upload.py first |
# In case of new attributes uncomment and watch attribute_upload.py first |
76 |
93 |
# try: |
# try: |
77 |
94 |
# attributeUpload(sheet) |
# attributeUpload(sheet) |