File packages/item_upload.py changed (mode: 100644) (index 95657c0..a27c0eb) |
... |
... |
def itemUpload(flatfile, intern): |
46 |
46 |
# transform the text format to integer in order to adjust the |
# transform the text format to integer in order to adjust the |
47 |
47 |
# height, width, length numbers from centimeter to milimeter |
# height, width, length numbers from centimeter to milimeter |
48 |
48 |
|
|
49 |
|
if(row['parent_child'] == 'parent'): |
|
50 |
|
try: |
|
51 |
|
if(row['package_height'] and |
|
52 |
|
row['package_length'] and |
|
53 |
|
row['package_width']): |
|
54 |
|
|
|
55 |
|
row['package_height'] = int(row['package_height']) |
|
56 |
|
row['package_length'] = int(row['package_length']) |
|
57 |
|
row['package_width'] = int(row['package_width']) |
|
58 |
|
|
|
59 |
|
# if the number is a floating point number it has to be |
|
60 |
|
# transformed into a float first befor the integer conversion |
|
61 |
|
except ValueError as err: |
|
62 |
|
row['package_height'] = int(float(row['package_height'])) |
|
63 |
|
row['package_length'] = int(float(row['package_length'])) |
|
64 |
|
row['package_width'] = int(float(row['package_width'])) |
|
65 |
|
|
|
66 |
|
except ValueError as err: |
|
67 |
|
print(err) |
|
68 |
|
print("/nPlease copy the values for height, length, width", |
|
69 |
|
"and weight\nfrom the children to the parent", |
|
70 |
|
"variation in the flatfile.\n") |
|
71 |
|
exit() |
|
72 |
|
|
|
73 |
|
# get the keywords from the flatfile if it is a old flatfile |
|
74 |
|
# combine the keyword columns into a single one |
|
75 |
|
# after that check the size of the keywords |
|
76 |
|
# because the maximum for amazon is 250byte |
|
77 |
|
# if('generic_keywords1' in headers): |
|
78 |
|
# if(row['generic_keywords1']): |
|
79 |
|
# keywords = '' |
|
80 |
|
# try: |
|
81 |
|
# keywords = str(row['generic_keywords1'] + '' + |
|
82 |
|
# row['generic_keywords2'] + '' + |
|
83 |
|
# row['generic_keywords3'] + '' + |
|
84 |
|
# row['generic_keywords4'] + '' + |
|
85 |
|
# row['generic_keywords5']) |
|
86 |
|
# except Exception as err: |
|
87 |
|
# print(err) |
|
88 |
|
# print("The combination of the keywords failed!") |
|
89 |
|
if(row['generic_keywords']): |
|
90 |
|
keywords = row[ 'generic_keywords' ] |
|
91 |
|
|
|
92 |
|
try: |
|
93 |
|
values = ['', row['item_sku'], row['package_length'] * 10, |
|
94 |
|
row['package_width'] * 10, |
|
95 |
|
row['package_height'] * 10, |
|
96 |
|
row['package_weight'], row['item_name'], |
|
97 |
|
'104', '', '62', row['brand_name'].upper(), '3', |
|
98 |
|
row['feed_product_type'], '', |
|
99 |
|
row['product_description'], keywords, 'de', |
|
100 |
|
'', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 9, 1] |
|
101 |
|
|
|
102 |
|
except Exception as err: |
|
103 |
|
print(err) |
|
104 |
|
Data[row['item_sku']] = SortedDict(zip(column_names, values)) |
|
|
49 |
|
try: |
|
50 |
|
if(row['parent_child'] == 'parent'): |
|
51 |
|
try: |
|
52 |
|
if(row['package_height'] and |
|
53 |
|
row['package_length'] and |
|
54 |
|
row['package_width']): |
|
55 |
|
|
|
56 |
|
row['package_height'] = int(row['package_height']) |
|
57 |
|
row['package_length'] = int(row['package_length']) |
|
58 |
|
row['package_width'] = int(row['package_width']) |
|
59 |
|
|
|
60 |
|
# if the number is a floating point number it has to be |
|
61 |
|
# transformed into a float first befor the integer conversion |
|
62 |
|
except ValueError as err: |
|
63 |
|
row['package_height'] = int(float(row['package_height'])) |
|
64 |
|
row['package_length'] = int(float(row['package_length'])) |
|
65 |
|
row['package_width'] = int(float(row['package_width'])) |
|
66 |
|
|
|
67 |
|
except ValueError as err: |
|
68 |
|
print(err) |
|
69 |
|
print("/nPlease copy the values for height, length, width", |
|
70 |
|
"and weight\nfrom the children to the parent", |
|
71 |
|
"variation in the flatfile.\n") |
|
72 |
|
exit() |
|
73 |
|
|
|
74 |
|
# get the keywords from the flatfile if it is a old flatfile |
|
75 |
|
# combine the keyword columns into a single one |
|
76 |
|
# after that check the size of the keywords |
|
77 |
|
# because the maximum for amazon is 250byte |
|
78 |
|
# if('generic_keywords1' in headers): |
|
79 |
|
# if(row['generic_keywords1']): |
|
80 |
|
# keywords = '' |
|
81 |
|
# try: |
|
82 |
|
# keywords = str(row['generic_keywords1'] + '' + |
|
83 |
|
# row['generic_keywords2'] + '' + |
|
84 |
|
# row['generic_keywords3'] + '' + |
|
85 |
|
# row['generic_keywords4'] + '' + |
|
86 |
|
# row['generic_keywords5']) |
|
87 |
|
# except Exception as err: |
|
88 |
|
# print(err) |
|
89 |
|
# print("The combination of the keywords failed!") |
|
90 |
|
if(row['generic_keywords']): |
|
91 |
|
keywords = row[ 'generic_keywords' ] |
|
92 |
|
|
|
93 |
|
try: |
|
94 |
|
values = ['', row['item_sku'], row['package_length'] * 10, |
|
95 |
|
row['package_width'] * 10, |
|
96 |
|
row['package_height'] * 10, |
|
97 |
|
row['package_weight'], row['item_name'], |
|
98 |
|
'104', '', '62', row['brand_name'].upper(), '3', |
|
99 |
|
row['feed_product_type'], '', |
|
100 |
|
row['product_description'], keywords, 'de', |
|
101 |
|
'', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 9, 1] |
|
102 |
|
|
|
103 |
|
except Exception as err: |
|
104 |
|
print(err) |
|
105 |
|
Data[row['item_sku']] = SortedDict(zip(column_names, values)) |
|
106 |
|
except KeyError as err: |
|
107 |
|
print(err) |
|
108 |
|
return row['item_sku'] |
105 |
109 |
|
|
106 |
110 |
# open the intern number csv to get the item ID |
# open the intern number csv to get the item ID |
107 |
111 |
with open(intern, mode='r') as item: |
with open(intern, mode='r') as item: |
|
... |
... |
def itemPropertyUpload(flatfile, export): |
131 |
135 |
, 'supplier_declared_dg_hz_regulation' |
, 'supplier_declared_dg_hz_regulation' |
132 |
136 |
, 'department_name', 'variation_theme' |
, 'department_name', 'variation_theme' |
133 |
137 |
, 'seasons', 'material_composition' |
, 'seasons', 'material_composition' |
134 |
|
, 'outer_material_type'] |
|
|
138 |
|
, 'outer_material_type', 'collar_style' |
|
139 |
|
, 'neck_size', 'pattern_type' |
|
140 |
|
, 'sleeve_type'] |
135 |
141 |
|
|
136 |
142 |
# Assign the Plentymarkets property ID to the property_names |
# Assign the Plentymarkets property ID to the property_names |
137 |
143 |
property_id = dict() |
property_id = dict() |
|
... |
... |
def itemPropertyUpload(flatfile, export): |
143 |
149 |
, '14' |
, '14' |
144 |
150 |
, '13', '12' |
, '13', '12' |
145 |
151 |
, '11', '8' |
, '11', '8' |
146 |
|
, '7'] |
|
|
152 |
|
, '7', '25' |
|
153 |
|
, '26', '28' |
|
154 |
|
, '29'] |
147 |
155 |
|
|
148 |
156 |
property_id = dict( zip(property_names, id_values) ) |
property_id = dict( zip(property_names, id_values) ) |
149 |
157 |
|
|
|
... |
... |
def itemPropertyUpload(flatfile, export): |
159 |
167 |
, row[property_names[8] + '1'] |
, row[property_names[8] + '1'] |
160 |
168 |
, row[property_names[9]], row[property_names[10]] |
, row[property_names[9]], row[property_names[10]] |
161 |
169 |
, row[property_names[11]], row[property_names[12]] |
, row[property_names[11]], row[property_names[12]] |
162 |
|
, row[property_names[13]] |
|
|
170 |
|
, row[property_names[13]], row[property_names[14]] |
|
171 |
|
, row[property_names[15]], row[property_names[16]] |
|
172 |
|
, row[property_names[17]] |
163 |
173 |
] |
] |
164 |
174 |
except ValueError as err: |
except ValueError as err: |
165 |
175 |
print("In property Upload: One of the values wasn't found : ", err) |
print("In property Upload: One of the values wasn't found : ", err) |
File product_import.py changed (mode: 100644) (index 857c562..bf175f4) |
1 |
1 |
from tkinter import Tk |
from tkinter import Tk |
2 |
2 |
from tkinter.filedialog import askopenfilename |
from tkinter.filedialog import askopenfilename |
3 |
|
from sys import exit |
|
|
3 |
|
import sys |
4 |
4 |
from packages.item_upload import itemUpload, itemPropertyUpload |
from packages.item_upload import itemUpload, itemPropertyUpload |
5 |
5 |
# from packages.attribute_upload import attributeUpload |
# from packages.attribute_upload import attributeUpload |
6 |
6 |
from packages.variation_upload import variationUpload, setActive, EANUpload, marketConnection |
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 |
|
from packages.amazon_data_upload import amazonSkuUpload, amazonDataUpload, asinUpload |
|
|
8 |
|
from packages.amazon_data_upload import amazonSkuUpload, amazonDataUpload, asinUpload, featureUpload |
9 |
9 |
from packages.image_upload import imageUpload |
from packages.image_upload import imageUpload |
10 |
10 |
|
|
11 |
11 |
|
|
|
... |
... |
def main(): |
20 |
20 |
root.withdraw() |
root.withdraw() |
21 |
21 |
sheet = askopenfilename() |
sheet = askopenfilename() |
22 |
22 |
intern_number = askopenfilename() |
intern_number = askopenfilename() |
|
23 |
|
erroritem = '' |
23 |
24 |
print("spreadsheet csv containing the flatfile : ", sheet) |
print("spreadsheet csv containing the flatfile : ", sheet) |
24 |
25 |
print("spreadsheet csv containing the intern numbers : ", intern_number) |
print("spreadsheet csv containing the intern numbers : ", intern_number) |
25 |
26 |
try: |
try: |
26 |
27 |
print("\nItem Upload\n") |
print("\nItem Upload\n") |
27 |
|
itemUpload(sheet, intern_number) |
|
28 |
|
except Exception as exc: |
|
29 |
|
print(exc) |
|
|
28 |
|
erroritem = itemUpload(sheet, intern_number) |
|
29 |
|
except: |
30 |
30 |
print("Item Upload failed!") |
print("Item Upload failed!") |
31 |
|
|
|
|
31 |
|
print("Here: ", erroritem) |
32 |
32 |
try: |
try: |
33 |
33 |
print("\nVariation Upload\n") |
print("\nVariation Upload\n") |
34 |
34 |
variationUpload(sheet, intern_number) |
variationUpload(sheet, intern_number) |
|
... |
... |
def main(): |
51 |
51 |
print("Something went wrong at the Export file import!") |
print("Something went wrong at the Export file import!") |
52 |
52 |
print("spreadsheet csv containing the export : ", export) |
print("spreadsheet csv containing the export : ", export) |
53 |
53 |
try: |
try: |
54 |
|
print("Active, Merkmale & Price Upload") |
|
|
54 |
|
print("Active, properties , features & price Upload") |
|
55 |
|
featureUpload(sheet, 'color_map', 1) |
55 |
56 |
setActive(sheet, export) |
setActive(sheet, export) |
56 |
57 |
itemPropertyUpload(sheet, export) |
itemPropertyUpload(sheet, export) |
57 |
58 |
priceUpload(sheet, export) |
priceUpload(sheet, export) |
58 |
59 |
except FileNotFoundError as err: |
except FileNotFoundError as err: |
59 |
60 |
print(err) |
print(err) |
60 |
61 |
print("Missing Data, check if you have\n - a flatfile\n - a intern file table\n - export file from plentymarkets\n - a sheet with the stock numbers!\n") |
print("Missing Data, check if you have\n - a flatfile\n - a intern file table\n - export file from plentymarkets\n - a sheet with the stock numbers!\n") |
61 |
|
exit() |
|
|
62 |
|
sys.exit() |
62 |
63 |
print("\nOpen your amazon storage report and save it as an csv.\n") |
print("\nOpen your amazon storage report and save it as an csv.\n") |
63 |
64 |
stocklist = askopenfilename() |
stocklist = askopenfilename() |
64 |
65 |
print("spreadsheet csv containing the current stock : ", stocklist) |
print("spreadsheet csv containing the current stock : ", stocklist) |