MarketPress - Sub-blog orders showing up on main blog too
WPMU DEV Community
MarketPress - Sub-blog orders showing up on main blog too
Custom
818 pointsLike some sort of WPMU DEV God"Mindblowingly helpful member
nickd32
Member
—
14th June 2011 (11 months ago)
I'm having a strange issue with Marketpress 2.1.1.
Whenever someone orders a product from one of my client's sites (i.e. a sub-blog store), I'm also getting an email. And the order is showing up on the main blog as well. That shouldn't be happening.
The order looks fine on the client site (under Manage Orders), but it's showing up garbled on the main blog.
I'm having a strange issue with Marketpress 2.1.1.
Whenever someone orders a product from one of my client's sites (i.e. a sub-blog store), I'm also getting an email. And the order is showing up on the main blog as well. That shouldn't be happening.
The order looks fine on the client site (under Manage Orders), but it's showing up garbled on the main blog.
I've been testing MP on my local WPMS install, since I'm able to duplicate the error locally.
I've removed all plugins (and mu-plugins and network-activated plugins) except for MP on both the main blog and the sub-blog.
Still getting the double-posting when orders come in.
The ONLY way I've been able to get rid of the error is to disable MarketPress on the main blog. That's a bummer though, because then I can't get to the global gateway settings under Network Admin >> Settings >> MarketPress.
Does it do it with the manual payments gateway?
And to confirm it creates orders on the subblog (with no error), and a copy of the order (with errors in it) on the main blog?
Just tried it with the manual gateway, and everything works! So the issue must be with the Paypal Express gateway...
And to confirm it creates orders on the subblog (with no error), and a copy of the order (with errors in it) on the main blog?
Yes, that's correct. It also sends 2x emails to both the blog owner and the new buyer -- one email from the subblog (no errors) and one from the main blog (with errors).
If you want to Skype for a minute, I'm happy to share my screen and show you what's happening.
Ok, well it's on my list to attempt a fix next week. So wierd to me that it is hard to recreate, and the other user who experienced it found it to be a plugin conflict.
Thanks Aaron. I was going to record a video of me replicating the issue, but I can't get Paypal sandbox to work -- I think it's down for maintenance or something today.
I keep getting errors while trying to process a transaction through MP (using the Paypal Express gateway).
It was working fine yesterday, and I haven't changed the API credentials, so I'm guessing this is on Paypal's end.
@Aaron - Trying to get some more data from the error logs and/or the var_dump($result); you suggested here...
But it seems like the Paypal Sandbox has suddenly quit working. I keep getting errors on checkout, and I think they're on the Paypal side.
There was a problem connecting to PayPal. Please try again.
There was a problem finalizing your purchase with PayPal. Please go back and try again.
Whoops, looks like you skipped a step! Please go back and try again.
Trying to troubleshoot Paypal Sandbox... I opened a ticket with their tech support, and here's the response I got.
Can you please make sure the shopping cart is in Sandbox mode (Live - Production mode disabled) and make sure you are using the correct Sandbox merchant API credentials.
Yep, I've double and triple-checked this.
If the error persist please provide us a copy of the API request string from you server logs . Please remove the API password from the request.
How do I do this on a local MAMP install? I've checked the built-in error logs (Apache, MYSQL, PHP) and I've also got WP_DEBUG on. None of these show any API string requests.
I will note, however, that my WP_DEBUG log is throwing lots of PHP Notices -- some of these may lend some clues. http://pastebin.com/FmZSnJfu
This set of logs is from the following procedure. (WP 3.2.1, using vanilla Twentyten theme, with NO plugins or mu-plugins installed except MarketPress 2.1.3)
1. Starting from the homepage, clicked on "products"
2. Chose a product, went through shopping cart
3. Tried to check out with Paypal Sandbox -- error.
7023 pointsLike some sort of WPMU DEV GodMindblowingly helpful memberLifetime member
Lead Developer
—
16th August 2011 (9 months ago)
#
Ok, lets get deep into debugging. First API request string:
in the paypal express gateway api_call() function add this right after the string is generated (around 1101): var_dump($query_string);die();
If you've sorted the sandbox issue, lets see how orders are being doubled. Probably best to do this on your live site. Try putting this right inside the top of the create_order() function 2687:
Paypal tech support verified several of the Sandbox API strings and checked the tokens on each one -- they appear to be successful on their end. However, I'm getting errors back in WP.
Could there be something going wrong with my browser? or PHP _session variable? Something is triggering a cart_checkout_error
OK, I finally got a Sandbox order to go through. Here's the debug info you asked for.
NOTES -- This was on my local install, rather than my live site.
Your debug code actually caused me to receive 3 distinct emails, from...
1. WordPress <wordpress@a.nick.cool> » Saved as TXT file here
2. Local Skrocket Install <nick@skyrocketwebsites.com> » Saved as TXT file here
3. Local Skrocket Install <nick@skyrocketwebsites.com> » Saved as TXT file here
Using a text editor, I compared the documents. 1 and 2 have lots of differences, whereas 2 and 3 are only different in 2 places.
NONMATCHING LINES BETWEEN FILE 1 and 2
40:64 -- 'cart_cache' array
1114:1135 -- array
1153 - 'transaction_id' different
1156 - extra 'a: a:' text in array
1158:1160 - currency/total/note data different (etc... Let me know if you want more detail/screenshots of this)
I may have found a clue... Looking at my DB tables, I noticed that even though I have the global shopping cart off, I'm still getting these tables showing up in my global DB:
Is that by design? Seems like products should only show up in their respective sub-blog DBs, like:
'wp_xx_mp_products'
'wp_xx_mp_terms'
'wp_xx_mp_term_relationships'
I had another order go through -- this time on the live site.
Here they are the 3 debug emails...
1. Skyrocket <nick@skyrocketwebsites.com> »
2. Skyrocket <nick@skyrocketwebsites.com> »
3. Skyrocket <nick@skyrocketwebsites.com> »
Comparing version 2 and 3 -- there's only 2 differences... line 1112 and line 4983. (see attached screenshot)
There were however, several differences between 1 and 2 (again.)
Do you want to take a look at my server or databases?
It got to be one of 3 things - because I've tried this without any themes/plugins/mu-plugins installed:
1. Server config
2. Strange entries in the database
3. strange settings in the wp-config.php file
So I spent a considerable amount of time trying to figure this issue out yesterday.
I'm running 3.2.1 with sub directory multisite install.
MarketPress 2.1.5 (was getting the error on 2.1.4 as well)
All plugins and mu-plugins disabled.
Paypal pays out correctly to two different sandbox stores during payment_process() but obviously creates the separate orders incorrectly. It creates a bunk received order with a status of received, the same order id, and strange characters in price and descriptions inside the home site blog that no product was purchased from.
Any thought on the trouble people are having with switch_to_blog()? Tickets are still commented into /wp-includes/ms-blogs.php
Additionally I'm getting the following error on the confirmation page.
Warning: sprintf() [function.sprintf]: Too few arguments in /var/www/get-a-real-job.com/wp-content/plugins/marketpress/marketpress-includes/plugins-gateway/paypal-express.php on line 501
Followed by the success message for the first of the two products purchase. The second item in the global_cart array is always the one that doesn't get its order created correctly.
Ok, I thought I fixed my problem of not all the orders being created by doing the following, but after testing a few times I'm getting mixed results. Sometimes it works sometimes it doesn't
Line: 454 paypal-express.php
}
if (is_multisite())
switch_to_blog($current_blog_id);
Replaced With:
if (is_multisite())
switch_to_blog($current_blog_id);
}
Its the end bracket of for ($i=0; $i<10; $i++) {
Now I am still creating a weirdo order in my site's main blog but for the time being this is fine cause I will have no products in my main store.
Also fixed the sprintf error by replacing line 502 in paypal-express.php with $content .= '<p>' . sprintf(__('Your order(s) for %s store(s) totaling %s were successful.', 'mp'),count($_SESSION['prs']), $mp->format_currency($this->currencyCode, $_SESSION['final_amt'])) . '</p>';
Not sure why, I'm guessing something to do with switch to blog and the caching of plugin data. Either way I would love to see if this fixes your problems as well nick.
Responses (37)
Member — 14th June 2011 (11 months ago) #
Just for clarification on those screenshots, the "Butterfly Circus" site is a sub-blog, and "Skyrocket.me" is the main blog.
WPMU DEV Fanatic — 15th June 2011 (11 months ago) #
Hi nickd32,
That's strange, that's occurring no matter which sub-site the orders are made from, correct?
Could you let us know which version of WordPress you're on to start with?
Also, could you tell us which gateway(s) you're using?
I'll notify the developers to take a look at this too.
Thanks,
David
Member — 15th June 2011 (11 months ago) #
I believe so, yes. I'm on WP 3.1.3, using Paypal Express gateway.
Lead Developer — 15th June 2011 (11 months ago) #
See this thread
http://premium.wpmudev.org/forums/topic/marketpress-number_format-and-dropped-order
Member — 15th June 2011 (11 months ago) #
I'm having the same issue as in the thread mentioned above -- but I don't use the Contact 7 plugin.
Lead Developer — 15th June 2011 (11 months ago) #
If at all possible can you test with all other plugins disabled? Then enable a group at a time to narrow it down.
If we can confirm another plugin causing the issue, then I could compare it with contact 7 to track down the source of the issue.
Member — 23rd June 2011 (11 months ago) #
@Aaron--
I've been testing MP on my local WPMS install, since I'm able to duplicate the error locally.
I've removed all plugins (and mu-plugins and network-activated plugins) except for MP on both the main blog and the sub-blog.
Still getting the double-posting when orders come in.
The ONLY way I've been able to get rid of the error is to disable MarketPress on the main blog. That's a bummer though, because then I can't get to the global gateway settings under Network Admin >> Settings >> MarketPress.
Lead Developer — 23rd June 2011 (11 months ago) #
Wierd, we couldn't seem to replicate it.
Does it do it with the manual payments gateway?
And to confirm it creates orders on the subblog (with no error), and a copy of the order (with errors in it) on the main blog?
Member — 23rd June 2011 (11 months ago) #
Just tried it with the manual gateway, and everything works! So the issue must be with the Paypal Express gateway...
Yes, that's correct. It also sends 2x emails to both the blog owner and the new buyer -- one email from the subblog (no errors) and one from the main blog (with errors).
If you want to Skype for a minute, I'm happy to share my screen and show you what's happening.
Lead Developer — 24th June 2011 (11 months ago) #
Ok, well it's on my list to attempt a fix next week. So wierd to me that it is hard to recreate, and the other user who experienced it found it to be a plugin conflict.
Member — 24th June 2011 (11 months ago) #
Thanks Aaron. I was going to record a video of me replicating the issue, but I can't get Paypal sandbox to work -- I think it's down for maintenance or something today.
I keep getting errors while trying to process a transaction through MP (using the Paypal Express gateway).
It was working fine yesterday, and I haven't changed the API credentials, so I'm guessing this is on Paypal's end.
Member — 15th August 2011 (9 months ago) #
Aaron -- This is still a major problem for me.
Now other store owners within my network are getting false messages about orders received.
For example, over the weekend someone ordered a product from this site:
http://webster.skyrocket.ws
And this site also got an "order notification"
http://thebutterflycircus.skyrocket.ws
Hence, I got a panic email from them saying "another order got screwed up" and "it's not showing up in our Paypal".
Any way I could get you to take a look at my setup? I need to get this resolved ASAP.
Member — 15th August 2011 (9 months ago) #
@Aaron - Trying to get some more data from the error logs and/or the var_dump($result); you suggested here...
But it seems like the Paypal Sandbox has suddenly quit working. I keep getting errors on checkout, and I think they're on the Paypal side.
This is maddening.
Member — 16th August 2011 (9 months ago) #
Trying to troubleshoot Paypal Sandbox... I opened a ticket with their tech support, and here's the response I got.
Yep, I've double and triple-checked this.
How do I do this on a local MAMP install? I've checked the built-in error logs (Apache, MYSQL, PHP) and I've also got WP_DEBUG on. None of these show any API string requests.
I will note, however, that my WP_DEBUG log is throwing lots of PHP Notices -- some of these may lend some clues.
http://pastebin.com/FmZSnJfu
This set of logs is from the following procedure. (WP 3.2.1, using vanilla Twentyten theme, with NO plugins or mu-plugins installed except MarketPress 2.1.3)
1. Starting from the homepage, clicked on "products"
2. Chose a product, went through shopping cart
3. Tried to check out with Paypal Sandbox -- error.
Lead Developer — 16th August 2011 (9 months ago) #
Ok, lets get deep into debugging. First API request string:
in the paypal express gateway api_call() function add this right after the string is generated (around 1101):
var_dump($query_string);die();If you've sorted the sandbox issue, lets see how orders are being doubled. Probably best to do this on your live site. Try putting this right inside the top of the create_order() function 2687:
Member — 16th August 2011 (9 months ago) #
Working on this now. Trying to get the Paypal Sandbox straightened out.
Member — 16th August 2011 (9 months ago) #
One strange thing - I'm noticing that in each blog's wp_options table the mp_version entry is not updating with each plugin upgrade.
Lead Developer — 16th August 2011 (9 months ago) #
It should with the latest version now.
Member — 16th August 2011 (9 months ago) #
Paypal tech support verified several of the Sandbox API strings and checked the tokens on each one -- they appear to be successful on their end. However, I'm getting errors back in WP.
Could there be something going wrong with my browser? or PHP _session variable? Something is triggering a cart_checkout_error
Member — 16th August 2011 (9 months ago) #
OK, I finally got a Sandbox order to go through. Here's the debug info you asked for.
NOTES -- This was on my local install, rather than my live site.
Your debug code actually caused me to receive 3 distinct emails, from...
1. WordPress <wordpress@a.nick.cool> » Saved as TXT file here
2. Local Skrocket Install <nick@skyrocketwebsites.com> » Saved as TXT file here
3. Local Skrocket Install <nick@skyrocketwebsites.com> » Saved as TXT file here
Using a text editor, I compared the documents. 1 and 2 have lots of differences, whereas 2 and 3 are only different in 2 places.
NONMATCHING LINES BETWEEN FILE 1 and 2
40:64 -- 'cart_cache' array
1114:1135 -- array
1153 - 'transaction_id' different
1156 - extra 'a: a:' text in array
1158:1160 - currency/total/note data different
(etc... Let me know if you want more detail/screenshots of this)
NONMATCHING LINES BETWEEN FILE 2 and 3
1114, 4977
Member — 16th August 2011 (9 months ago) #
I may have found a clue... Looking at my DB tables, I noticed that even though I have the global shopping cart off, I'm still getting these tables showing up in my global DB:
'wp_mp_products'
'wp_mp_terms'
'wp_mp_term_relationships'
Is that by design? Seems like products should only show up in their respective sub-blog DBs, like:
'wp_xx_mp_products'
'wp_xx_mp_terms'
'wp_xx_mp_term_relationships'
Lead Developer — 16th August 2011 (9 months ago) #
The global tables are for indexing, they always run in multisite.
As to the email, very interesting. Did it create orders in other blogs (the error)? Or it just sent 3 emails?
Member — 16th August 2011 (9 months ago) #
Yep, I got the errors.
The order came through Blog_ID 2, but it also showed up on Blog 1.
Then I put through another order on Blog 2, and it also showed up on Blog_ID 4.
No rhyme or reason. I'm baffled.
Lead Developer — 16th August 2011 (9 months ago) #
So wierd, and that's on your local install huh? With default theme and no other plugins?
Member — 17th August 2011 (9 months ago) #
Correct. I renamed my plugins and mu-plugins folders, then made a new (blank) folder called plugins and copied MarketPress in there.
What's strange is that this behavior is replicated on my live site.
Do you want to Skype or remote in to my system to see the behavior in more detail?
Member — 18th August 2011 (9 months ago) #
Any news/breakthroughs/discoveries on this?
I had another order go through -- this time on the live site.
Here they are the 3 debug emails...
1. Skyrocket <nick@skyrocketwebsites.com> »
2. Skyrocket <nick@skyrocketwebsites.com> »
3. Skyrocket <nick@skyrocketwebsites.com> »
Comparing version 2 and 3 -- there's only 2 differences... line 1112 and line 4983. (see attached screenshot)
There were however, several differences between 1 and 2 (again.)
Also, there were faulty emails generated for this order as well. Here is the one that I got...
http://cl.ly/2f2F0R09193D3W2J122F
Lead Developer — 18th August 2011 (9 months ago) #
THanks, i've downloaded the emails. I removed the links because they contain your live api keys.
I'm continueing to look into this.
Member — 1st September 2011 (8 months ago) #
Any news/breakthroughs/discoveries on this?
Lead Developer — 1st September 2011 (8 months ago) #
I'm sorry, but still very stumped. These wierd things where you can't recreate are tough to debug.
I'm pulling in some other devs, maybe a fresh set of eyes will help.
Member — 1st September 2011 (8 months ago) #
Do you want to take a look at my server or databases?
It got to be one of 3 things - because I've tried this without any themes/plugins/mu-plugins installed:
1. Server config
2. Strange entries in the database
3. strange settings in the wp-config.php file
Member — 2nd September 2011 (8 months ago) #
So I spent a considerable amount of time trying to figure this issue out yesterday.
I'm running 3.2.1 with sub directory multisite install.
MarketPress 2.1.5 (was getting the error on 2.1.4 as well)
All plugins and mu-plugins disabled.
Paypal pays out correctly to two different sandbox stores during payment_process() but obviously creates the separate orders incorrectly. It creates a bunk received order with a status of received, the same order id, and strange characters in price and descriptions inside the home site blog that no product was purchased from.
Any thought on the trouble people are having with switch_to_blog()? Tickets are still commented into /wp-includes/ms-blogs.php
http://core.trac.wordpress.org/ticket/14992
http://core.trac.wordpress.org/ticket/14941
Additionally I'm getting the following error on the confirmation page.
Warning: sprintf() [function.sprintf]: Too few arguments in /var/www/get-a-real-job.com/wp-content/plugins/marketpress/marketpress-includes/plugins-gateway/paypal-express.php on line 501Followed by the success message for the first of the two products purchase. The second item in the global_cart array is always the one that doesn't get its order created correctly.
Member — 3rd September 2011 (8 months ago) #
Ok, I thought I fixed my problem of not all the orders being created by doing the following, but after testing a few times I'm getting mixed results. Sometimes it works sometimes it doesn't
Line: 454 paypal-express.php
Replaced With:
Its the end bracket of
for ($i=0; $i<10; $i++) {Now I am still creating a weirdo order in my site's main blog but for the time being this is fine cause I will have no products in my main store.
Also fixed the sprintf error by replacing line 502 in paypal-express.php with
$content .= '<p>' . sprintf(__('Your order(s) for %s store(s) totaling %s were successful.', 'mp'),count($_SESSION['prs']), $mp->format_currency($this->currencyCode, $_SESSION['final_amt'])) . '</p>';Member — 5th September 2011 (8 months ago) #
Ok fixed it for real now with plenty of tests.
Line: 462 paypal-express.php
$result = $mp->create_order($_SESSION['mp_order'], $selected_cart[$bid], $shipping_info, $payment_info, $paid);Change To:
$mp->create_order($_SESSION['mp_order'], $selected_cart[$bid], $shipping_info, $payment_info, $paid);Not sure why, I'm guessing something to do with switch to blog and the caching of plugin data. Either way I would love to see if this fixes your problems as well nick.
Lead Developer — 6th September 2011 (8 months ago) #
Awesome, can you email me the entire paypal-express.php file? aaron(AT)incsub.com.
Some major rep points about to come your way...
Member — 6th September 2011 (8 months ago) #
Coming at ya. Glad I could help.
Lead Developer — 6th September 2011 (8 months ago) #
Nick, can you confirm that the attached solves your issue?
pro, points your way!
Member — 6th September 2011 (8 months ago) #
Just ran through a test order on my local install, and it looks like everything has been fixed. Going to try this on my live site now.
Thanks pro120!!!!! You're a rockstar.
Become a member