Re: how do I require application_top.php in folder in admin with a composer package?
Wait... Wait wait wait... Are you saying you're trying to build a script that sits on your server and connects to your Gmail account "just" so you could get it to read your Amazon emails, and then you'll use that data to modify your site's stock levels?
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
balihr
Wait... Wait wait wait... Are you saying you're trying to build a script that sits on your server and connects to your Gmail account "just" so you could get it to read your Amazon emails, and then you'll use that data to modify your site's stock levels?
That and generally to practice using API's. Amazon Sellercentral Pro's $40/mo. for the amazon seller api. :/
Re: how do I require application_top.php in folder in admin with a composer package?
currently the only way I can get it to work is w/ a folder in the admin w/ an index.php I'm guessing it's security stuff that's above me. I'm open to other suggestions on approaches. I was also considering trying to use tampermonkey to add a button in amazon sellercentral that send the data (maybe w/ json and some sort of http api end-point? (I don't know about this much yet))
Re: how do I require application_top.php in folder in admin with a composer package?
Maybe skip using the email API by:
- linking up an IfTTT (if-this-then-that) service (either forward those emails to it, or maybe it can inspect incoming emails for you)
- then the IfTTT service can be the thing that sends a notice to your server to do the cleanup (and then you just need a tiny cleanup listener script).
.. - that "notice" could be an HTTP call to a listener file (my_amazon_handler.php) that does the cleanup after some validation
.. - or maybe it could send the data as a CSV file (somehow), and you could have a cron job to loop thru all the received CSV files in whatever directory
Popular IfTTT services include ifttt .com, zapier, integromat
Re: how do I require application_top.php in folder in admin with a composer package?
IMHO, quite an overkill for what you actually need. Learning APIs is great, but Google's APIs are nowhere near simple or easy to integrate, and are definitely not something to start the learning process.
DrByte's solution is awesome (of course), but you could also have it run on your end without involving 3rd party apps. An idea that crossed my mind - setup a new email account on your server, let's say "[email protected]" and then configure your Gmail to automatically FW the amazon's "sold/ship" emails to that address. Next step would be to create your own script that uses imap_body and other imap_ functions to connect to the new email account and read the contents and then process it against the database. Run it from the admin, run it as a cron job, do whatever you want - it's relatively simple to process the data after you get the contents to your server...
Re: how do I require application_top.php in folder in admin with a composer package?
Re: Dr Byte's suggestions:
Cool I'm going to look into IFTTT I have a few of those going for other things not web dev related. Should watch a few introductions to zapier and integromate.
Re: balihr
This seems more robust than google's api auth token expiring and requiring a 2nd log in.
Before I had read those 2 replies my current pseudo code is this:
//Greasemonkey inject a button into sellercentral to pull the amount paid for shipping (not in email)
//button click launches "handler" maybe w/ orderid and shipping cost into the script page that launches the gmail api...
//loop through gmails w/ orderid search criterion
//parse
//inject order
...a question would then also be what's the easiest way to grab all the sql commands that happen when an order's placed? cleverly placed print_r in the db query factory?
Bahlir's seems to be right in I'm probably overly complicating this. Also wouldn't mind messing w/ square's API on another project before classes start back up depending on how productive I am w/ this.
Re: how do I require application_top.php in folder in admin with a composer package?
Better yet ... does Amazon offer webhook notifications when something sells?
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
DrByte
Better yet ... does Amazon offer webhook notifications when something sells?
If I'm not mistaken they do, but it's to the tune of $40/mo for the API included w/ the professional selling account. I haven't been able to hit a level of success to justify it.
Re: how do I require application_top.php in folder in admin with a composer package?
So I have this mashed up and "working" (reading from my gmail and from an orders_amazon table I created in the zen-cart db)
However, it doesn't automatically create the token.json file as it should. I have to use the google gmail api quickstart to generate it and then move it to the right location.
so the left column here's when it only worked reading from my gmail w/ the api (branch 6 https://github.com/wolfderby/gmailTu...d_of_episode_6) from https://www.youtube.com/watch?v=fUm5ddL7bG8
the right column is me trying to put it into the zen-cart design pattern.
... in ... /amazon_gmail_orders/ >>> ... in ... /admin
/amazon_gmail_orders/index.php >>> amazon_gmail_orders.php
Composer.json >>> admin/composer.json
connection.php >>> includes/classes/yoyo_connection.php
credentials.json >>> includes/classes/credentials.json
gmail.php >>> includes/classes/yoyo_gmail.php
token.json >>> includes/classes/token.json
/vendor/ >>> includes/classes/vendors/gmail/vendor/
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
wolfderby
So I have this mashed up and "working" (reading from my gmail and from an orders_amazon table I created in the zen-cart db)
However, it doesn't automatically create the token.json file as it should. I have to use the google gmail api quickstart to generate it and then move it to the right location.
so the left column here's when it only worked reading from my gmail w/ the api (branch 6
https://github.com/wolfderby/gmailTu...d_of_episode_6) from
https://www.youtube.com/watch?v=fUm5ddL7bG8
the right column is me trying to put it into the zen-cart design pattern.
... in ... /amazon_gmail_orders/ >>> ... in ... /admin
/amazon_gmail_orders/index.php >>> amazon_gmail_orders.php
Composer.json >>> admin/composer.json
connection.php >>> includes/classes/yoyo_connection.php
credentials.json >>> includes/classes/credentials.json
gmail.php >>> includes/classes/yoyo_gmail.php
token.json >>> includes/classes/token.json
/vendor/ >>> includes/classes/vendors/gmail/vendor/
also asking this question on stackoverflow in case it's more appropriate there: https://stackoverflow.com/questions/...te-the-vendors