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)
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
Enhanced error output to extra module dda37a22d21db1af6330fd62395682b91f46f5ec Sebastian Fricke 2020-01-27 10:56:00
Introduction infoPrint, removed unnecessary parameter 98b6779f95fcf6d3350f64e7d2a8151932415458 Sebastian Fricke 2020-01-16 14:27:15
Add Cdiscount price & coding style review 7c5451b067760100904aed947b2ba484ab9c9e45 Sebastian Fricke 2020-01-16 14:25:15
coding style, naming conventions & uninitialized 218378ca191510dc2092108a87e63ff83b4c6b31 Sebastian Fricke 2020-01-16 13:58:24
coding style & cleanup image upload module 04ac13fb764baecd1a419cbffcd9696a3ff5b680 Sebastian Fricke 2020-01-16 13:56:07
coding style improvements and colorful error msg 401db811c0edd62b14c7a0a29e2c1f6d2791774c Sebastian Fricke 2020-01-16 13:54:25
code cleanup and coding style category.py b1e41b45fe405d3826a9b6e452fb9e2f9f6697bf Sebastian Fricke 2020-01-16 10:43:44
Added the category config to the gitignore file b8b522d9ade4b59b5d0a0bd4f9b7c79e8db334c6 Sebastian Fricke 2020-01-15 14:56:06
Removed log function for category_config(not needed) c8ca8a3b6b968f1835697073e7d5fe1ea70b15ba Sebastian Fricke 2020-01-15 14:54:15
Added category_config functionality 7bd8256398b4af5c1feb3033d74cd9f29b047edc Sebastian Fricke 2020-01-15 14:53:20
improved error handling & adjusted names to naming convention cfcd91090a2598c6c51576bcdd53e03ab6c2f59b Sebastian Fricke 2020-01-15 14:47:42
Commit d852cb3ef648336ed94daeaaa220721e6055dd7c - Remove price calculation from script
Handle price calculation within Plentymarkets.
Improve handling of missing prices in variations and parent.
Disable waiting for input at exit for non-windows systems.
Author: Sebastian Fricke
Author date (UTC): 2020-04-27 12:50
Committer name: Sebastian Fricke
Committer date (UTC): 2020-04-27 12:50
Parent(s): 2c5735f4f4c79607f55c77b1359aa5984d1e6699
Signing key:
Tree: 50d112306b70604c9d6c1ff2046188548e71daef
File Lines added Lines deleted
packages/item_upload.py 27 25
packages/price.py 59 0
File packages/item_upload.py changed (mode: 100644) (index c5bcfb3..581c241)
... ... import re
4 4 import collections import collections
5 5 import inspect import inspect
6 6 import chardet import chardet
7 from packages import barcode, amazon_data_upload, price_upload, error
7 import os
8 from packages import barcode, amazon_data_upload, price, error
8 9
9 10
10 11 class WrongEncodingException(Exception): class WrongEncodingException(Exception):
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
32 33 'market-active-amafbager', 'marketid', 'accountid', 'market-active-amafbager', 'marketid', 'accountid',
33 34 'amazon_sku', 'amazon_parentsku', 'amazon_sku', 'amazon_parentsku',
34 35 'amazon-producttype', 'fba-enabled', 'fba-shipping', 'amazon-producttype', 'fba-enabled', 'fba-shipping',
35 'price-price', 'ebay-price', 'amazon-price',
36 'webshop-price', 'etsy-price', 'cdiscount-price',
37 'ASIN-countrycode', 'ASIN-type', 'ASIN-value',
36 'price', 'ASIN-countrycode', 'ASIN-type', 'ASIN-value',
38 37 'Item-Flag-1' 'Item-Flag-1'
39 38 ] ]
40 39
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
44 43 barcode_data = {} barcode_data = {}
45 44 is_parent = False is_parent = False
46 45 position = 0 position = 0
46 item_price = 0
47 47
48 48 # Get sets of all colors and sizes for each parent # Get sets of all colors and sizes for each parent
49 49 # to find if there are some with only one attribute value for all childs # to find if there are some with only one attribute value for all childs
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
70 70 error.warnPrint("Generic Keywords are empty!", error.warnPrint("Generic Keywords are empty!",
71 71 inspect.currentframe().f_back.f_lineno) inspect.currentframe().f_back.f_lineno)
72 72
73 item_price = row['standard_price']
74 if not item_price and row['parent_child'] == 'parent':
75 item_price=price.find_price(flatfile, row['item_sku'])
76 if item_price == -1:
77 if os.name == 'nt':
78 print("press ENTER to continue..")
79 input()
80 exit(1)
81 if item_price == '':
82 error.warnPrint(
83 msg=str(f"{row['item_sku']}, has no price"), err='',
84 linenumber=inspect.currentframe().f_back.f_lineno)
85
86
73 87 try: try:
74 88 attributes = '' attributes = ''
75 89 if row['parent_child'] == 'parent': if row['parent_child'] == 'parent':
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
110 124 '', '', # market & accout id amazonsku '', '', # market & accout id amazonsku
111 125 '', '', # sku & parentsku amazonsku '', '', # sku & parentsku amazonsku
112 126 '', '', '', # producttype & fba amazon '', '', '', # producttype & fba amazon
113 '', '', '', '', '', '', # prices
127 item_price, # prices
114 128 '', '', '', #asin '', '', '', #asin
115 129 input_data['marking'] input_data['marking']
116 130 ] ]
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
182 196 error.errorPrint("Amazondata part for "+row, err, error.errorPrint("Amazondata part for "+row, err,
183 197 sys.exc_info()[2].tb_lineno) sys.exc_info()[2].tb_lineno)
184 198
185 # Include the price
186 price_data = price_upload.priceUpload(flatfile)
187
188 for row in price_data:
189 try:
190 if row in list(data.keys()):
191 data[row]['price-price'] = price_data[row]['price']
192 data[row]['ebay-price'] = price_data[row]['ebay']
193 data[row]['amazon-price'] = price_data[row]['amazon']
194 data[row]['webshop-price'] = price_data[row]['webshop']
195 data[row]['etsy-price'] = price_data[row]['etsy']
196 except Exception as err:
197 error.errorPrint("Price part for "+row, err,
198 sys.exc_info()[2].tb_lineno)
199
200 199 # Sort the dictionary to make sure that the parents are the first variant of each item # Sort the dictionary to make sure that the parents are the first variant of each item
201 200 sorted_data = sortProducts(data) sorted_data = sortProducts(data)
202 201
 
... ... def itemUpload(flatfile, intern, stocklist, folder, input_data, filename):
204 203 except UnicodeDecodeError as err: except UnicodeDecodeError as err:
205 204 error.errorPrint("decoding problem", err, error.errorPrint("decoding problem", err,
206 205 sys.exc_info()[2].tb_lineno) sys.exc_info()[2].tb_lineno)
207 print("press ENTER to continue..")
208 input()
209 sys.exit()
206 if os.name == 'nt':
207 print("press ENTER to continue..")
208 input()
209 exit(1)
210 210
211 211 def itemPropertyUpload(flatfile, folder, filename): def itemPropertyUpload(flatfile, folder, filename):
212 212
 
... ... def getVariationId(exportfile, sku):
494 494 except Exception as err: except Exception as err:
495 495 error.errorPrint("Looking for irregularities in getVariationId", error.errorPrint("Looking for irregularities in getVariationId",
496 496 err, sys.exc_info()[2].tb_lineno) err, sys.exc_info()[2].tb_lineno)
497 print("press ENTER to continue...")
498 input()
497 if os.name == 'nt':
498 print("press ENTER to continue...")
499 input()
500 exit(1)
499 501 if not variationid: if not variationid:
500 502 error.warnPrint(msg="No Variation ID found for "+sku, error.warnPrint(msg="No Variation ID found for "+sku,
501 503 linenumber=inspect.currentframe().f_back.f_lineno) linenumber=inspect.currentframe().f_back.f_lineno)
File packages/price.py added (mode: 100644) (index 0000000..46e0edf)
1 """
2 Author: Sebastian Fricke
3 License: GPLv3
4 Date: 2020-04-27
5
6 Functions for working with the price field of the Amazon Flatfile
7 """
8
9 import inspect
10 import pandas
11 from packages import error
12
13
14 def find_price(flatfile, parent):
15 """
16 Parameter:
17 flatfile [Dictionary] => path and encoding as strings
18 of the flatfile
19 parent [String] => Name of the parent that requires a price
20
21 Description:
22 Transfer the variation price to the parent price if the
23 parent doesn't own a price
24
25 Return:
26 result [float] => price
27 0 = No variation has a price
28 -1 = Error
29 """
30
31 df = pandas.read_csv(flatfile['path'],
32 encoding=flatfile['encoding'],
33 sep=';')
34
35 if df.empty:
36 error.errorPrint(
37 msg=str(f"Couldn't read {flatfile['path']}"), err='',
38 linenumber=inspect.currentframe().f_back.f_lineno)
39 return -1
40
41 variation = df[df['parent_sku'] == parent]
42 if variation.empty:
43 error.errorPrint(
44 msg=str(f"No variation for {parent} in {flatfile['path']}"),
45 err='', linenumber=inspect.currentframe().f_back.f_lineno)
46 return -1
47
48 with_price = variation['standard_price'].notnull()
49 if variation[with_price].empty:
50 error.warnPrint(
51 msg=str(f"No variation of {parent} has a price"), err='',
52 linenumber=inspect.currentframe().f_back.f_lineno)
53 return 0
54
55
56 variation = variation.astype({'standard_price':float})
57 result = variation['standard_price'].values.max()
58
59 return result
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