GithubHelp home page GithubHelp logo

olegapanovich / import-products-from-gsheet-for-woo-importer Goto Github PK

View Code? Open in Web Editor NEW
19.0 7.0 4.0 16.33 MB

Wordpress plugin that helps import products from Google spreadsheet using standard woocommerce import.

License: GNU General Public License v3.0

JavaScript 3.71% PHP 96.29%
wordpress-plugin woocommerce-import google-spreadsheet

import-products-from-gsheet-for-woo-importer's Introduction

Description

This is a wordpress plugin that extends standard woocommerce import products functionality and lets you import, not only from a local file, but also from your google sheet file which you store on your google drive and can be edited by any member of your store team.

Standard woocommerce import, that was introduced by woocommerce team since version 3.1, became a greater plugin feature that lets you not use additional plugins and extensions for product import processes. However, if it’s a pain every time when you’re loading csv import files from your local machine, then this file is a great choice that lets you not to do it anymore. Just set your google sheet name that you store on your google drive once and in the future you will only have to press the button "Import" as usual. Plugin itself will pull the new data from the specified google sheet table.

Installation

It's a recommended to use the official plugin page on WordPress.org.

Also as option you can directly install plugin from github repository.

  1. Clone repository to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.

Set plugin options

After plugin installation we need to set connection with google API. In a plugin settings you have two options to set google API connection.

  1. "One Click Auto Connect" method with google auth code ( more simple and straightforward connection method ).
  2. "Manual Connect" method with assertion client_secret json code.

You need to set connection once and in the feature you can process import woocommerce product with your google sheet file every time you need.

1 method. "One Click Auto Connect" with google auth code

This method is recomended and default in plugin settings area. Follow the steps to set it.

  1. Go to plugin setting and press "Get Code" button in "One Click Auto Connect" tab

  2. You will be redirected to google plugin application page. Please choose google account where you store your google sheet import file on google drive

  3. In the next page you need provide access "See and download all your Google Drive files." to plugin application.

  4. Then you will be redirected back to the plugin settings page with your access code on it. Please press "Save Options" button.

  5. If code valid you will see corresponding message and new select for google sheet title and then you must to choose google sheet title that become your import file Sheet title you can find in upper left corner of your sheet on google drive

  6. That all. If you set all settings properly you will receive success connection message with link to standard woocommerce import page where you can process import products with your google sheet file

2 method. "Manual Connect" with assertion client_secret json code.

  1. If you do not have a google API client_secret json code than go to google cloud console page. where you can create new one (if you have than you can go to step 11)

  2. Go to API Library page and in the search input type "Google Drive API"

  3. Click on a first search result and enable "Google Drive API"

  4. Then you can create new credentials. Just click button "Create Сredentials"

  5. In the next page, the system will ask you to fill the form with data for your credentials, please fill it in the same way as you can see on the screenshot below

  6. In the next step you will be redirected to 'Create service account' page and you will see the form for it, feel free to choose any service account name in the appropriate field and select role project -> editor, than skip "Grant users access to this service account" and press "Done" button. After it you should have a newly created service account.

  7. Then you can go to your credentials page and find your newly created 'Service Account' click on it

  8. Then find the key tab and create a new key client_secret for your service account with json format.

  9. Please find client_email in client_secret json and copy it to your buffer for the next step.

  10. Open your google sheet import file on your google drive and share access to it with client_email that you copy to buffer in previous step

  11. Please copy the client_secret json key (all file content file) to appropriate input in the option plugin page and save it.

  12. After it, you should see select with google sheets list for your import, pick one of them and press 'Save Options'.

That’s all, if you set valid data you will see a success message, and when you next time try to import woocommerce product you will see an additional button that gives you the opportunity to import product from google sheet.

import-products-from-gsheet-for-woo-importer's People

Contributors

olegapanovich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

import-products-from-gsheet-for-woo-importer's Issues

Intagrate multiple google sheet optionality

Right now we can import only from one google sheet, it will be greate if user has option to choose between google sheet that stored on his google drive. In import page we already have select field for it but only with one google sheet that predefind in plugin option page.
For realisition we need to get all google sheets that connecteted google drive has and load all of them titles to existing select field. After it we can remove google sheet title option from plugin option page.

Fatal Error with WP 5.7.1

Impossible to start an import. It says its malformed, but it worked until few hours ago. Anyway, i use the standard woocommerce scheme so it can't be malformed, imho.

here's the sheet: https://docs.google.com/spreadsheets/d/1t0QeRRtVkqlcrZphsUJadv9yJ0lQJdqI_iQVfDcH8I8/edit?usp=sharing

Here's the screen error:
Fatal error: Uncaught Google\Spreadsheet\Exception\BadRequestException: <title>Error 400 (Bad Request)!!1</title><style nonce="k8pt/JOMwa7w3+VwjGa1jw">{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{color:#222;text-align:unset;margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px;} > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}pre{white-space:pre-wrap;}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}</style>

400. That’s an error.

The server cannot process the request because it is malformed. It should not be retried. That’s all we know.

in /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/DefaultServiceRequest.php:359 Stack trace: #0 /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/DefaultServiceRequest.php(241): Google\Spreadsheet\DefaultServiceRequest->execute(Object(CurlHandle)) #1 /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/Worksheet.php(168): Google\Spreadsheet\DefaultServiceRequest->get('https://docs.go...') #2 /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/includes/class-gswoo-wrapper-api-google-drive.php(118): Google\Spreadsheet\Worksheet->getCsv() #3 /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/woocommerce-importer/class-gswoo-wc-product-csv-importer-controller.php(172): GSWOO_Wrapper_Api_Google_Drive->get_sheet_csv() #4 /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/woocommerce-importer/class-gswoo-wc-product-csv-importer-controller.php(75): GSWOO_WC_Product_CSV_Importer_Controller->google_sheet_get_csv_file('AGGIORNA PRODOT...') #5 /home/femarofa/public_html/farmacia/wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php(294): GSWOO_WC_Product_CSV_Importer_Controller->handle_upload() #6 /home/femarofa/public_html/farmacia/wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php(268): WC_Product_CSV_Importer_Controller->upload_form_handler(Object(GSWOO_WC_Product_CSV_Importer_Controller)) #7 /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/woocommerce-importer/class-gswoo-wc-admin-importers.php(56): WC_Product_CSV_Importer_Controller->dispatch() #8 /home/femarofa/public_html/farmacia/wp-includes/class-wp-hook.php(292): GSWOO_WC_Admin_Importers->product_importer('') #9 /home/femarofa/public_html/farmacia/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters('', Array) #10 /home/femarofa/public_html/farmacia/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #11 /home/femarofa/public_html/farmacia/wp-admin/admin.php(259): do_action('product_page_pr...') #12 /home/femarofa/public_html/farmacia/wp-admin/edit.php(10): require_once('/home/femarofa/...') #13 {main} thrown in /home/femarofa/public_html/farmacia/wp-content/plugins/import-products-from-gsheet-for-woo-importer/vendor/asimlqt/php-google-spreadsheet-client/src/Google/Spreadsheet/DefaultServiceRequest.php on line 359

Add plugin redirect to plugin setting

Description
As a new user, I wanna better understand how to start using plugin.

ToDo:

After the plugin is installed and activated we need to redirect new user to plugin settings.
We need to do it only for a new user, no need to do it for users that have used it before and for some reason activate the plugin again.

Need to improve register_setting option

under menu woocommerce , I have replace function for save setting with this

register_setting(
'plugin_wc_import_google_sheet_options',
'plugin_wc_import_google_sheet_options',
['sanitize_callback' => array( $this, 'set_options' )]
);

Improve google drive api connection

Right now connection to google drive API has complecated way. We need to improve it, as a example we must try to implement API connection that already has cf7-google-sheets-connector

the plugin stopped working

apparently the connection that was being used to access google has changed and no longer allows you to connect

Fatal error in current plugin dev version

Fatal error: Interface 'Psr\Log\LoggerInterface' not found in /var/www/html/wp-content/plugins/import-products-from-gsheet-for-woo-importer/lib/monolog/monolog/src/Monolog/Logger.php on line 28

PROJECT ABANDONED?

Not working anymore (has been dead for more than a month) by the "One click auto connect" option... and all the referenced resources provided here for the "Manual Connect" option are outdated and useless for someone unfamiliar with Google APIs. =(

Do not support xlsx format files

Right now users can't use xlsx and other Exel format files.
Th have another mine-type.
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
We can add it with such a string of code
'q' => "mimeType='application/vnd.google-apps.spreadsheet' or mimeType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" but it do not work with our get_google_drive_sheets_list SheetInterplayService::get_sheet_csv method anyway

All format types
https://developers.google.com/drive/api/v3/ref-export-formats

Need will add lib to parse such type of file as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.