Re: Square WebPay support thread.
Quote:
Originally Posted by
mvstudio
All the files were placed back as they were in the original installation 1.5.7.
Just an observation that removing something implies taking away or out, rather than turning it off. That's where this error of mine came from.
As far as I remember ZC has always had this constant that when one plugin is "removed", the files for that plugin can be safely deleted from the server, until now as far as I can tell. That's why I assumed I was doing the right thing by "removing the deprecated Square plugin" as there was no need for it. Nowhere in any of the files anywhere it stated I shouldn't have done so. Maybe a note in the read-me would help others not make the same error I made(?). Just a suggestion to avoid future mishaps.
Honest mistake on my part. Didn't mean to cause any trouble nor offend anyone. All is well and everything works as it should.
Thanks for the help! I really appreciate it :smile:
i can only speak for myself, and i did not take any offense.
with regards to removal of plugins, you are correct. but square is NOT a plugin. it is part of the base ZC install. square_webPay is a plugin.
if you think the documentation at docs.zen-cart.com is wrong (or could be clarified), i would suggest you download hugo and fix them. i'm sure the next user would be most appreciative (as well as @swguy).
best.
Re: Square WebPay support thread.
The help file has been updated to warn against deleting old Square implementation files.
https://docs.zen-cart.com/user/payment/square/
Re: Square WebPay support thread.
Hi guys. I just tried adding this plugin. I am using v1.5.7c and PHP 8.0.
After uploading all the files, when I go to turn on the module and turn off the older Square module, the new one isn't showing. The page is breaking where the new module should be showing. My error log shows this:
PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE" in .../store/includes/modules/payment/square_webPay.php:106
If I switch to PHP 7.4, the module shows.
I realise most people in this thread are using PHP 7.4, and therefore won't have this issue or maybe see it as a big deal, but I have everything else on my site working fine with PHP 8, so it would be nice to keep PHP 8 on, if this happens to be a quick easy fix. Any ideas?
Re: Square WebPay support thread.
I don't know if the same is true for your admin but, with the errors found on your home page, you may find that basic errors are creating problems for you.
Code:
<!--<div id="navMain"> |
|
<ul class="back"> |
|
<li></a></li> |
|
<li><a href=""></a></li> |
|
<li><a href=""></a></li> |
|
<li class="last"><a href=""></a></li> |
|
<li><a href=""></a></li> |
|
<li class="last"><a href=""></a></li> |
|
|
|
<li> |
|
<a class="navCartContentsIndicator" href=""><i class="fa fa-shopping-cart" title="Shopping Cart"></i> |
|
</a> |
|
</li> |
|
<li class="last"><a href=""></a></li> |
|
</ul> |
|
<div id="navMainSearch" class="forward"> |
|
</div> |
|
</div> |
|
</div> |
|
<!--eof navigation display--> |
|
|
|
|
|
<!--bof header google ad display--> |
|
<!--eof header google ad display--> |
|
|
|
<!--bof branding display--> |
|
|
|
<!--bof-wstephens edit--> |
|
<!--<div id="logoWrapper" class="group onerow-fluid navbar-dark bg-dark"> |
|
<div id="logo"> |
|
<img id="bannerPic" src="https://www.20thcenturyglass.com/images/main/20th-century-glass-headbanner2018.jpg" alt="20th Century Glass" border="0" /> |
|
</div> |
|
</div> |
|
<!--eof-wstephens edit--> |
|
|
|
<!--<div id="logoWrapper" class="group onerow-fluid"> |
|
<div id="logo"> <div id="taglineWrapper"> |
|
<div id="tagline"></div> |
|
<div id="bannerTwo" class="banners"></div> |
|
</div> |
|
</div> |
|
</div> |
You have several issues in items that may be on every page in your site. I've highlighted four instances of <!--. Between 1 to 2 and 3 to 4 there should be an ending -->
Fixing basic CSS and HTML errors might make things run smoother
Re: Square WebPay support thread.
> PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE" in .../store/includes/modules/payment/square_webPay.php:106
Right above line 105 add
if (null === $this->sort_order) return;
Re: Square WebPay support thread.
Quote:
Originally Posted by
dbltoe
I don't know if the same is true for your admin but, with the errors found on your home page, you may find that basic errors are creating problems for you.
...
Fixing basic CSS and HTML errors might make things run smoother
noting that none of these fixes has absolutely anything to do with problem being reported. nor anything to do with square_webPay.
please do NOT hijack this thread.
Quote:
Originally Posted by
swguy
> PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE" in .../store/includes/modules/payment/square_webPay.php:106
Right above line 105 add
if (null === $this->sort_order) return;
@swguy, i am NOT a fan of this solution for so many reasons. lets start with this:
https://www.php-fig.org/psr/psr-12/#51-if-elseif-else
and then continue with what happens in the admin with the affiliate link? as well as other details?
i will post some new code shortly.
best.
Re: Square WebPay support thread.
This is the standard mechanism that modules use to avoid logs from undefined variables in recent versions of PHP. Compare any other payment module and you'll see this pattern.
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
This is the standard mechanism that modules use to avoid logs from undefined variables in recent versions of PHP. Compare any other payment module and you'll see this pattern.
i have no idea what standard mechanism means. and just because it was done that way does not make it right.
i would suggest spending more time testing prior to posting code. your early return completely changes how square is presented to the store owner prior to install. and either we want our code to conform to PSR or we do not. i prefer my code to conform to said standards as i am a fan of the PHP Standards Recommendation (PSR).
back to the problem at hand; here is the fix for said code. changes start at line 105.
PHP Code:
// from:
$environment = Environment::PRODUCTION;
if (MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE === 'Sandbox') {
$environment = Environment::SANDBOX;
}
$this->client = new SquareClient([
'accessToken' => MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN,
'environment' => $environment,
]);
// to:
$environment = Environment::PRODUCTION;
if (defined('MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE') && MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE === 'Sandbox') {
$environment = Environment::SANDBOX;
}
$this->token= '';
if (defined('MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN')) {
$this->token = MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN;
}
$this->client = new SquareClient([
'accessToken' => $this->token,
'environment' => $environment,
]);
@WayneStephens please let me know if that works for you.
also, noting that these errors exist and are logged in php 7.4; in php 8.0, they are now fatal errors.
best.
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
@WayneStephens please let me know if that works for you.
That fixed it, thanks! And no other errors coming up so far while testing. :smile:
Re: Square WebPay support thread.
Quote:
Originally Posted by
WayneStephens
That fixed it, thanks! And no other errors coming up so far while testing. :smile:
:thumbsup: