Zen Cart Logo
Forums / Bug Reports / Random Duplicate Orders

Random Duplicate Orders

Views: 972

Results 1 to 2 of 2
21 Nov 2019, 20:41
#1
monarchacct avatar

monarchacct

New Zenner

Join Date:
Jul 2019
Location:
Holyoke, MA
Posts:
7
Plugin Contributions:
0

Random Duplicate Orders

Hello!

We've been getting random sporadic duplicate orders since we switched to v1.5.6c earlier this year, not a lot, but enough to annoy our CSR. Here's our setup:

Zen Cart Version 1.5.6c
PHP Version 7.1.33
PayPal Payments Standard

I've made a point in not installing any mods which edit core files. Having said that, we do use third party mods but none which (to my understanding) should conflict with PayPal Payments Standard. Most are either admin-function- or price-discount-related.

The only thing in our error log is this:

[21-Nov-2019 15:08:46 America/New_York] PHP Fatal error:  Cannot declare class order, because the name is already in use in /home2/xxxxxx/xxxxxxxx/xxxxxxx/includes/classes/order.php on line 1156

Line 1156 in my includes/classes/order.php file is just a }.

Any ideas?

Thank you!

22 Nov 2019, 03:35
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Random Duplicate Orders

While I don't know the solution to your situation, I offer the following, in no particular priority:

  1. PayPal Payments Standard is known to occasionally create duplicates if the IPN process has difficulty in doing its complex handshake. Standard was designed for webstores of the 1990s and early 2000s where a "catalog/database" of products was only on the PayPal end, not on your own store. Its technical implementation relies on a bunch of patched-together-things needing to operate "just right" in a less than optimal context.
    That said, some stores use it because PayPal formerly didn't offer Express Checkout in all parts of the world where those stores want to sell.
    But nowadays Express Checkout is much more ubiquitous, and is certainly preferred over Standard. It's also typically much more reliable from a technology perspective.
    (That's the long-winded way of suggesting you switch from Standard to Express Checkout, both to deal with the duplicates issue, and also to hopefully avoid the PHP errors you mentioned. Even if it's just a "test".)

  2. "Cannot redeclare class" happens when parts of your PHP application try to re-load the same files again, or start their processing steps over from within other places. None of this is intended, and suggests that some files on your site are probably damaged, or duplicated, or tampered with, or incorrectly altered by out of date addons.
    Two parts to this:
    a) if you're in the habit of "making a backup of a php file by renaming it", then make sure when you rename it that you do NOT leave the ".php" on the end of it! Otherwise it'll be treated as a common PHP file, and could get loaded as a duplicate instead of being ignored because it's only a backup. So, if you're replacing files for some reason and want to keep a backup, feel free to do that, but either change the ".php" suffix to something else (maybe .php-bak), or move the file to your own PC instead of leaving it on the server.
    b) do a full compare of all the files on your server vs the clean backup you have on your PC of what "should" be on the server. Then you can spot anomalies. If you don't already have a "clean backup of all the files" on your PC, then start with a clean copy of your version of Zen Cart as the base to compare against.
    Comparison guidance is offered in this article: http://www.zen-cart.com/wiki/index.php/Recovering_From_Hacks