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)
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
Refactor CategoryChooser 562e6657c6fef89d0584731e54325cec013268a7 Sebastian Fricke 2020-01-15 14:42:11
Add category_config location to the script config 8698e4a99d63b06fde5c39787fc7d6f7400b9f47 Sebastian Fricke 2020-01-15 14:29:47
Refactor findConfig 321ae9d7edd69e8be0755cf5ba82289944d06ca3 Sebastian Fricke 2020-01-15 14:26:09
Add logging function: no category config warning e8323843a3b6c24ef274d6a12c10d76aa8b8f591 Sebastian Fricke 2020-01-14 14:38:39
Add module + test for the category-id config fadaf4515aab1009f4df4a1af5a2e8f82077bc4c Sebastian Fricke 2020-01-14 14:35:44
improved coding style on log functions caf97eec6c6026aa051bc98f02a90e649a6e4754 Sebastian Fricke 2020-01-14 10:23:17
fixed a typo in the product type list 707e993b953aea0d653ffbca136bbe81bb36ea13 Sebastian Fricke 2020-01-14 10:22:34
added home product properties, improved dictionary iteration, fixed a key error in get_attributes 30d4aed4403c39a6865e30c0384c3360d375cbb6 Sebastian Fricke 2020-01-14 10:21:56
removed warning for missing flatfile columns as requested bfe6e22f7acb282a3af8423c81ceacf9fcf21ef4 Sebastian Fricke 2020-01-13 15:05:27
added initialization for the position variable 8331f92d62deb9ba7be7e97201c7c6afa7cf732a Sebastian Fricke 2020-01-13 14:47:57
improved code style and fixed problem where the dictionary containing the path was given to functions instead of the path itself 1a5bf99751b599f48d4687a9a6cbd55ffe213f5a Sebastian Fricke 2020-01-13 14:47:13
Commit 7c5451b067760100904aed947b2ba484ab9c9e45 - Add Cdiscount price & coding style review
coding style review & cleanup using the PEP8 standard
added a Cdiscount price and simplified price calculation
Author: Sebastian Fricke
Author date (UTC): 2020-01-16 14:25
Committer name: Sebastian Fricke
Committer date (UTC): 2020-01-16 14:25
Parent(s): 218378ca191510dc2092108a87e63ff83b4c6b31
Signer:
Signing key:
Signing status: N
Tree: fe1c7bf049fefa0bcfbedc93d664e0e08c2bd12c
File Lines added Lines deleted
packages/price_upload.py 51 34
File packages/price_upload.py changed (mode: 100644) (index 481553f..e581288)
1 import inspect
2 from collections import OrderedDict
1 3 from csv import DictReader from csv import DictReader
2 try:
3 from sortedcontainers import SortedDict
4 except ImportError:
5 print("the sortedcontainers module is required to run this program.")
6 raise ImportError
4 from packages.item_upload import warnPrint, infoPrint
7 5
8 6
9 7 def priceUpload(flatfile): def priceUpload(flatfile):
 
... ... def priceUpload(flatfile):
15 13 'ebay':{'id':'3', 'value':''}, 'ebay':{'id':'3', 'value':''},
16 14 'amazon':{'id':'4', 'value':''}, 'amazon':{'id':'4', 'value':''},
17 15 'webshop':{'id':'5', 'value':''}, 'webshop':{'id':'5', 'value':''},
18 'etsy':{'id':'6', 'value':''}
16 'etsy':{'id':'6', 'value':''},
17 'cdiscount':{'id':'7', 'value':''}
19 18 } }
20 19
21 # create a Data Dictionary and fill it with the necessary values from the
20 # create a data Dictionary and fill it with the necessary values from the
22 21 # flatfile # flatfile
23 Data = SortedDict()
22 data = OrderedDict()
24 23 standard_price = 0 standard_price = 0
25 24 variation_price = 0 variation_price = 0
25 round_price = 0
26 percent_diff = 0
27 adjust = 0
26 28
27 29 with open(flatfile['path'], mode='r', encoding=flatfile['encoding']) as item: with open(flatfile['path'], mode='r', encoding=flatfile['encoding']) as item:
28 30 reader = DictReader(item, delimiter=";") reader = DictReader(item, delimiter=";")
29 31 for row in reader: for row in reader:
30 32 # Make sure that there is price even at parents # Make sure that there is price even at parents
31 if(not( row['standard_price'] )):
32 print("row:{0} doesnt have a price!".format(row['item_sku']))
33 if not row['standard_price']:
34 warnPrint(f"row:{row['item_sku']} doesnt have a price!",
35 linenumber=inspect.currentframe().f_back.f_lineno,
36 err='')
33 37 for scndrow in reader: for scndrow in reader:
34 if(row['parent_child'] == 'parent'):
35 if(scndrow['parent_child'] == 'child' and scndrow['standard_price'] and row['item_sku'] == scndrow['parent_sku']):
36 print("parent without price add:{0} from:{1} to:{2}"
37 .format(scndrow['standard_price'],
38 scndrow['item_sku'],
39 row['item_sku']))
38 if row['parent_child'] == 'parent':
39 if scndrow['parent_child'] == 'child' and\
40 scndrow['standard_price'] and\
41 row['item_sku'] == scndrow['parent_sku']:
42 infoPrint(
43 "parent without price add:{0} from:{1} to:{2}"
44 .format(scndrow['standard_price'],
45 scndrow['item_sku'],
46 row['item_sku']))
40 47 standard_price = scndrow['standard_price'] standard_price = scndrow['standard_price']
41 48 break break
42 elif(row['parent_child'] == 'child'):
43 if(scndrow['parent_child'] == 'child' and scndrow['standard_price'] and row['parent_sku'] == scndrow['parent_sku']):
49 elif row['parent_child'] == 'child':
50 if scndrow['parent_child'] == 'child' and\
51 scndrow['standard_price'] and\
52 row['parent_sku'] == scndrow['parent_sku']:
44 53 standard_price = scndrow['standard_price'] standard_price = scndrow['standard_price']
45 54 break break
46 55
 
... ... def priceUpload(flatfile):
48 57 reader = DictReader(item, delimiter=";") reader = DictReader(item, delimiter=";")
49 58
50 59 for row in reader: for row in reader:
51 if(row['standard_price']):
60 if row['standard_price']:
52 61 variation_price = row['standard_price'] variation_price = row['standard_price']
53 62 else: else:
54 63 variation_price = standard_price variation_price = standard_price
55 64 for price in prices: for price in prices:
56 if(prices[ price ]['id'] == '3'):
57 # Ebay price calculation
58 prices[ price ]['value'] = ( int( round( float( variation_price ) - (float( variation_price ) * 0.10) ) ) - 0.05 )
59 if(prices[ price ]['id'] == '5'):
60 # Webshop price calculation
61 prices[ price ]['value'] = ( int( round( float( variation_price ) - (float( variation_price ) * 0.16666666) ) ) - 0.05 )
62 if(prices[ price ]['id'] == '6'):
63 # Etsy price calculation
64 prices[ price ]['value'] = ( int( round( float( variation_price ) + (float( variation_price ) * 0.1) ) ) - 0.15 )
65 if prices[price]['id'] == '3':
66 percent_diff = 0.10
67 adjust = 0.05
68 if prices[price]['id'] == '5':
69 percent_diff = 0.166666666
70 adjust = 0.05
71 if prices[price]['id'] == '6':
72 percent_diff = 0.1
73 adjust = 0.15
74 if prices[price]['id'] == '7':
75 percent_diff = 0.2
76 adjust = 0.05
65 77 else: else:
66 prices[ price ]['value'] = variation_price
67 values = [prices['price']['value'], prices['ebay']['value'],
68 prices['amazon']['value'], prices['webshop']['value'],
69 prices['etsy']['value']]
70 Data[row['item_sku']] = SortedDict(zip(column_names, values))
78 percent_diff = 0
79 adjust = 0
80
81 round_price = round(float(variation_price)+\
82 (float(variation_price*percent_diff)))
83 prices[price]['value'] = int(round_price)-adjust
71 84
72 return Data
85 values = [prices['price']['value'], prices['ebay']['value'],
86 prices['amazon']['value'], prices['webshop']['value'],
87 prices['etsy']['value']]
88 data[row['item_sku']] = OrderedDict(zip(column_names, values))
73 89
90 return data
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