Re: how do I require application_top.php in folder in admin with a composer package?
have you tried moving this code outside of the class:
https://github.com/wolfderby/gmailTu...dex.php#L9-L12
something like:
PHP Code:
<?php
require DIR_FS_CATALOG . 'includes/classes/vendor/autoload.php';
include "connection.php";
class Yoyo {
public function __construct() {
}
public function go() {
not sure where the connection.php file is; but i think you get the idea....
Re: how do I require application_top.php in folder in admin with a composer package?
Just taking a wild guess ...
Your github connection.php file mentions $token_path = 'token.json'; ... without any directory qualifier. If you were to be specific about its actual path that might be enough.
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
DrByte
Just taking a wild guess ...
Your github connection.php file mentions $token_path = 'token.json'; ... without any directory qualifier. If you were to be specific about its actual path that might be enough.
so if the token's in either path if it's referenced correctly it will work, however it if make the token.json (which was generated from google's quickstart code) into token.json.bak it not longer works because much of the google_client object's empty...
Code:
Google\Client Object
(
[auth:Google\Client:private] =>
[http:Google\Client:private] =>
[cache:Google\Client:private] =>
[token:Google\Client:private] =>
[config:Google\Client:private] => Array
(
[application_name] => Gmail API PHP Quickstart
[base_path] => https://www.googleapis.com
[client_id] => 787788787563-blbahlbah.apps.googleusercontent.com
[client_secret] => blbahlbah
[credentials] =>
[scopes] =>
[quota_project] =>
[redirect_uri] => urn:blbahlbah:wg:oauth:2.0:oob
[state] =>
[developer_key] =>
[use_application_default_credentials] =>
[signing_key] =>
[signing_algorithm] =>
[subject] =>
[hd] =>
[prompt] => select_account consent
[openid.realm] =>
[include_granted_scopes] =>
[login_hint] =>
[request_visible_actions] =>
[access_type] => offline
[approval_prompt] => auto
[retry] => Array
(
)
[retry_map] =>
[cache] =>
[cache_config] => Array
(
)
[token_callback] => Closure Object
(
[this] => Google\Client Object
*RECURSION*
[parameter] => Array
(
[$cacheKey] =>
[$newAccessToken] =>
)
)
[jwt] =>
[api_format_v2] =>
)
[logger:Google\Client:private] =>
[deferExecution:Google\Client:private] =>
[requestedScopes:protected] => Array
(
[0] => https://www.googleapis.com/auth/gmail.readonly
)
)
..then it throws...
PHP Fatal error: Uncaught Error: Call to a member function createAuthUrl() on null in C:\xampp\htdocs\mysite\site\admin\includes\classes\yoyo_connection.php:30
Stack trace:
#0 C:\xampp\htdocs\mysite_from_gitlab\pebs\mysite\includes\classes\yoyo.php(37): Connection->get_unauthenticated_data()
#1 C:\xampp\htdocs\mysite_from_gitlab\pebs\mysite\amazon_gmail_orders.php(31): Yoyo->go()
#2 {main}
thrown in C:\xampp\htdocs\mysite_from_gitlab\mysite\admin\includes\classes\yoyo_connection .php on line 30
Re: how do I require application_top.php in folder in admin with a composer package?
ugh so yeah I think I have to delve deep into google's api to get the client object generated correctly? something dealing w/ directory paths I'm guessing.
Might meditate on this a while and try another approach.
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
wolfderby
however it if make the token.json ... into token.json.bak it not longer works
That's exactly what I would expect. If your PHP code is looking for "token.json" and you rename the file, then ... it won't find the file ... and ... it won't work.
I don't understand why you'd be renaming the file ...... ?
I'm certain Google wouldn't be suggesting to use a .bak extension for anything important or sensitive.
Re: how do I require application_top.php in folder in admin with a composer package?
...flash forward some days...
I have it sorta working... w/ the gmail api.
However I'm still new to thinking in an objected oriented design approach.
Looping through each received email, I'm generating a form w/ an insert/submit button...
that "creates" and order in my database but... the order id's are going haywire, probably because I didn't properly leverage the order's class in zen-cart.
I'm confused on how to create a consistent $oID order ID throughout the table inserts?
Code:
$newoID = $newoIDResult->fields['LAST_INSERT_ID()'];
... isn't working.
Re: how do I require application_top.php in folder in admin with a composer package?
Not necessarily expected to work as provided in that code segment unless something has been done to make that exist.
Ok, anyone else familiar with the old/revamped tv show: "name that tune"? I feel like for some reason someone said that they could guess the tune by one note and the above code snippet was that note...
Let me put it another way... In talking about a book: I don't understand all that happened... the last word of the book was "end." how could that be? It is so wrong...
Or the infamous: my car isn't working right. It makes a sound...
Yes, I know I've gone overboard. I'm trying to offer some ways for the reader(s) to think from the other person(s) perspective so that likely more information could be given without having to request what may seem like basics. Sure, there's "hard" stuff that isn't known to give, (reminds me of a story recently told elsewhere in the forum about knowing how to use the tools the right way) but please help to help.
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
wolfderby
.probably because I didn't properly leverage the order's class in zen-cart.
I'm confused on how to create a consistent $oID order ID throughout the table inserts?
Simple: use the order class.
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
mc12345678
my car isn't working right. It makes a sound...
...so that sound... from my laptop... it's my bad code. :/ I KNEW IT! (:
Thanks for the input though, I had a feeling I was going down the wrong path, so I'm glad the community's here to chime in a get me on track. I don't do this professionally yet, so my outside input's limited.
Where's the best place to look for order creation using the order class? I've been skimming the class and the one page checkout add-on...
Also regarding tooling I'm still on VScode which I added some php intellisense to, I'm going to school for comp sci and I've heard PHPstorms' free to students. Any thoughts on trying it out?
Re: how do I require application_top.php in folder in admin with a composer package?
Quote:
Originally Posted by
wolfderby
Also regarding tooling I'm still on VScode which I added some php intellisense to, I'm going to school for comp sci and I've heard PHPstorms' free to students. Any thoughts on trying it out?
At one time Notepad++ was the best recommendation. But it's kinda dated now.
Then Sublime-Text came along (and is still an excellent choice).
But Microsoft has put a huge push into getting people onto VSCode.
I've spent a little time in VScode. It's the tool-of-choice for a lot of developers nowadays. You should be fine with it.
I highly recommend https://learn-vscode.com if you want to augment your efficiency in it.
That said, I use PhpStorm all the time, and find it to be better than all the others. It's also the tool that the ZC core team uses.
Yes it's pretty easy to apply for their student discount. Do it. (Note: PhpStorm includes the WebStorm features, so you only need to apply for PhpStorm.)
A friend of mine recently recorded some videos for the PhpStorm team: https://www.youtube.com/playlist?lis...x3Okalij5jMAgw and is preparing a course for it too at https://masteringphpstorm.com