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

/product_import.py (1728a98bb47bf06ea4192781b6921f3c764cd87f) (5179 bytes) (mode 100644) (type blob)

from tkinter import Tk
from tkinter.filedialog import askopenfilename, askdirectory
import sys
from packages.item_upload import itemUpload, itemPropertyUpload
# from packages.attribute_upload import attributeUpload
from packages.variation_upload import variationUpload, setActive, EANUpload, marketConnection
from packages.stock_upload import stockUpload, priceUpload
from packages.amazon_data_upload import amazonSkuUpload, amazonDataUpload, asinUpload, featureUpload
from packages.image_upload import imageUpload


def main():
    #app = UploadGUI(None)
    #app.title("Amazon Flatfile to PlentyMarkets Upload")
    # app.mainloop()
    '''
    Command Line Test Version will be used within the GUI as soon as it is finished
    '''
    root = Tk()
    root.withdraw()
    sheet = askopenfilename(initialdir="../",
                            title="Amazon Flatfile as .csv",
                            filetypes=[ ("csv files", "*.csv") ])
    intern_number = askopenfilename(initialdir="../",
                            title="The Intern Numbers as .csv",
                            filetypes=[ ("csv files", "*.csv") ])
    upload_folder = askdirectory(initialdir="../",
                                 title="Choose a folder for the upload files.")
    erroritem = ''
    print("spreadsheet csv containing the flatfile : ", sheet)
    print("spreadsheet csv containing the intern numbers : ", intern_number)
    try:
        print("\nItem Upload\n")
        erroritem = itemUpload(sheet, intern_number, upload_folder)
    except Exception as exc:
        print("Item Upload failed!\n")
        print("Here: ", exc, '\n')
        if(exc == 'item_sku'):
            print("It is very likely that you don't have the proper headers, use the english ones!\n")
        e = sys.exc_info()
        for element in e:
            print(element)
    try:
        print("\nVariation Upload\n")
        variationUpload(sheet, intern_number, upload_folder)
    except Exception as exc:
        print("VariationUpload failed!\n")
        e = sys.exc_info()
        for element in e:
            print(element)

    print("###########################################################")
    print("\nUpload the files in plentymarkets, make sure that the categories are set because they are necessary for the active Upload.\n")

    moveon = input("Continue(ENTER)")

    print("\nGet a dataexport from the plentymarket site from the variation attributes, in order to access the current Variation ID.\n")
    try:
        export = askopenfilename(initialdir="../",
                                title="The Export File from Plentymarkets as .csv",
                                filetypes=[ ("csv files", "*.csv") ])
    except FileNotFoundError: # pylint:disable=invalid-name,used-before-assignment
        print("No Export File!")
    except Exception as exc:
        print(exc)
        print("Something went wrong at the Export file import!")
    print("spreadsheet csv containing the export : ", export)
    try:
        print("Active, properties , features & price Upload")
        featureUpload(sheet, 'color_map', 1, upload_folder)
        setActive(sheet, export, upload_folder)
        itemPropertyUpload(sheet, export, upload_folder)
        priceUpload(sheet, export, upload_folder)
    except FileNotFoundError as err:
        print(err)
        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")
        sys.exit()
    print("\nOpen your amazon storage report and save it as an csv.\n")
    stocklist = askopenfilename(initialdir="../",
                            title="The Stockreport from Amazon as .csv",
                            filetypes=[ ("csv files", "*.csv") ])
    print("spreadsheet csv containing the FNSKU and ASIN : ", stocklist)

    EANUpload(sheet, export, stocklist, upload_folder)
    #stockUpload(sheet, stocklist)

    print("\nCreate a upload file for the SKU and Parent_SKU\nto connect existing items from amazon to plentyMarkets.\n")

    amazonSkuUpload(sheet, export, upload_folder)

    print("\nCreate a upload file for the additional Information to Amazon Products like bullet points, lifestyle etc.\n")

    amazonDataUpload(sheet, export, upload_folder)

    print("\nCollect the ASIN Numbers matching to the Variationnumber(Sku) and format them into the dataformat format.\n")

    asinUpload(export, stocklist, upload_folder)

    print("\nCollect the imagelinks from the flatfile, sorts them and assigns the variation ID.\n")
    try:
        imageUpload(sheet, export, upload_folder)
    except Exception as err:
        print(err)
        print("Image Upload failed!")

    print("\nActivate Marketconnection for Ebay & Amazon for all variation.\n")

    try:
        marketConnection(export, upload_folder, ebay=1, amazon=1)
    except Exception as err:
        print(err)
        print("Market connection failed!")

    # In case of new attributes uncomment and watch attribute_upload.py first
    # try:
    # attributeUpload(sheet)
    # except:
    # print("Attribute Upload failed!")


if __name__ == '__main__':
    main()


Mode Type Size Ref File
100644 blob 798 66a212f194a32e2fce811076154306b76ddcf9d9 .gitignore
100644 blob 5364 4bc518fabd35f03be275c799d4946690379072fd Instructions.md
100644 blob 10299 816a1d0ee7f4496c32fdb92c7811eaf877d0efc0 LICENSE.md
040000 tree - 150134c5ee574d6ec11eb67ab91dbc2f922c67a4 Linux_Version
100644 blob 3811 87e1df60c4c99c8400bcdcf1641a33e1ade245d8 README.md
040000 tree - 6b6ad43599251f2093777021a512f1af89c29473 Windows_Version
100644 blob 116 666750bce728d912256a546347e72d37d5a4159d main.py
040000 tree - 50a9635fc978951a0629f116b2303ea88f5f474f packages
100644 blob 5179 1728a98bb47bf06ea4192781b6921f3c764cd87f product_import.py
100644 blob 178 627b92178d30145f0dedc2f4a31ac856f6a15ea1 todo.md
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