Buy now button ajax problem

When I click "Buy Now" button on listing page or product page of MarketPress it shows the spinning image but nothing happens then.
How can I fix that?

  • Ash
    • WordPress Hacker

    Hello jcnjr

    I have just tested on your site. I tried to add two products - one from listing page and other from single product page and both added to the cart. Even the page was redirected to the cart after adding. Here is a screenshot:

    Would you please try again and let us know? If I am missing something, please feel free to suggest.

    Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Ash said:

    If I am missing something, please feel free to suggest....

    As discussed with Oguzhan Selcuk Bulbul in the tech support chat, I have rolled back to Marketpress version 3.2.7 in order to eliminate the error.

    Once updated to MP v3.2.8, nothing can be added to the cart. The status icon just spins and no errors appear in the browser web console or logs. We have completed standard plugin conflict troubleshooting.

    I still need to confirm that I can replicate the issue on our staging site. I will then reply here with an update. Please provide appropriate contact details so I can submit credentials via the contact form.

    Thank you for the quick response.

  • Ash
    • WordPress Hacker

    Hello jcnjr

    You can send the admin login and cPanel login to me when your staging site is ready, I will check there.

    You can send me privately in the following format:
    1. Please go to https://premium.wpmudev.org/contact/#i-have-a-different-question
    2. Select "I have a different question" if not selected
    3. In subject line put "Attn-Ash" (this will ensure that the email is assigned to me)
    4. Provide the wanted details.
    5. Add the thread link in the message so that I can track.

    Have a nice day!

    Cheers,
    Ash

  • Ash
    • WordPress Hacker

    Hello jcnjr

    Please check now. I have found the issue and reporting as a bug.

    To fix on your live site, please go to /wp-content/plugins/marketpress/includes/common/template-functions.php and add the following in line no 3341:

    if( empty( $domain ) ) return $ajax_url;

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Fastest. Fix. Ever!

    I've confirmed the issue is resolved on the staging site. I'll update our live sites with this same patch and report back with any further issues.

    FYI: Oguzhan suggested a similar but different edit to the template-functions file which he found in your "internal resources" but that did not work. Glad to see this does the trick, and hope to see it implemented in MP v.3.2.9.

    Thank you!

  • jcnjr
    • HummingBird

    UPDATE: The checkout process now completes successfully on our live site.

    HOWEVER: I don't know if this is related to the fix or not, but upon redirect after final Submit of order, a blank white screen loaded instead of the Order Confirmation/Download page. I also did not receive a confirmation email from Marketpress, only the Paypal payment notification.

    Payment was received, and the Order appears in the MP Admin, but customer received no email and got a blank page after checkout.

    I found the following in our server error log:

    [15-Mar-2018 19:04:34 UTC] PHP Fatal error: Uncaught Error: Call to undefined method DOMText::getAttribute() in /home/agredac/public_html/wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/vendors/dompdf/include/cellmap.cls.php:437
    Stack trace:
    #0 /home/agredac/public_html/wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/vendors/dompdf/include/cellmap.cls.php(399): Cellmap->add_frame(Object(Text_Frame_Decorator))
    #1 /home/agredac/public_html/wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/vendors/dompdf/include/cellmap.cls.php(399): Cellmap->add_frame(Object(Table_Row_Group_Frame_Decorator))
    #2 /home/agredac/public_html/wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/vendors/dompdf/include/table_frame_reflower.cls.php(520): Cellmap->add_frame(Object(Table_Frame_Decorator))
    #3 /home/agredac/public_html/wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/vendors/dompdf/include/table_frame_reflower.cls.php(398): Table_Frame_Reflower->get_min_max_width()
    #4 /home/agredac/public_html/wp-content/p in /home/agredac/public_html/wp-content/plugins/marketpress/includes/addons/mp-pdf-invoice/vendors/dompdf/include/cellmap.cls.php on line 437

  • jcnjr
    • HummingBird

    FYI: After I disabled the PDF Invoice add-on in Marketpress, the order completes successfully and redirects properly to the Download page. This will work for me, as we do not need the PDF invoice option.

    HOWEVER: No confirmation email is being sent to the customer, even though the notification is enabled in MP admin.

    The Admin notification in now being sent, but no confirmation/download email is being sent to the customer.

  • jcnjr
    • HummingBird

    Ash said:

    would you please check the spam box...

    Yes, I did. The email did not get spammed.

    I received the Admin email, but no order confirmation sent to the same address.
    How might I troubleshoot this further?

    Perhaps you could help me test more efficiently by addressing this other issue I just noticed.

    When I apply a coupon code for 8.95 to the 9.95 product, the code applies successfully, but upon checkout I get the error "10413 - The totals of the cart item amounts do not match order amounts."

    Another coupon for 5.00 off works, but I have tried creating other new coupons to reduce the price to $1 for testing purposes and all fail upon checkout. Please try applying the code TEST895 to this product to see if you can determine why it fails.
    https://agreda.com/store/products/income-anywhere/

    In the meantime, I will set up a product on our staging site to see if the notification email is sent there.

    Thank you for your help!

  • jcnjr
    • HummingBird

    FYI: I set up Paypal Sandbox on the staging site for more thorough testing.

    Admin Order Notification emails are sent and received for each order.

    No Order Notification email is sent to customer.

    Two Order Shipped emails are immediately sent for digital product order.

    Adding Order Notes to an order and saving changes sends a copy of Order Shipped email to customer.

  • Ash
    • WordPress Hacker

    Hello jcnjr

    About the email issue, are you using same email address for customer and admin? Some servers set some restrictions on sending emails on same address for multiple times. I am asking because, I have just tested again and I got all the correct emails.

    About the coupon, I can confirm the issue. So I am marking this as a bug and reporting to the developer. I hope, very soon the issue will be fixed. We appreciate your patience.

    Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Ash said:

    Some servers set some restrictions on sending emails on same address

    I had previously tried multiple different customer email addresses (different than admin email) to complete purchases on the live site, yet only the Admin Order Notification is sent and received. The customer receives no notification.

    I'm happy to report now that I just tested again and the customer order notification was received, twice actually. Better than not at all!

    I have just tested again and I got all the correct emails.

    I'm guessing by "tested again" you mean on your own install.

    About the coupon, I can confirm the issue. ...I hope, very soon the issue will be fixed.

    Thank you!

    I've marked this as resolved and will look forward to the coupon issue being addressed in a future update.

    Thank you for all your efforts here.

  • jcnjr
    • HummingBird

    1. FYI: I finally updated another of our Marketpress stores to v.3.2.8 and the Ajax issue returned.

    I applied this fix suggested by ash, after confirming that the line was missing from the template-functions.php file in the updated plugin folder, and checkout is working again. Looks like that edit didn't make it in to the update.

    NOTE: I did do this plugin update from /network/update-core and not the Hub or WPMU Dev admin tab, if that makes a difference...it shouldn't, just FYI.

    2. FYI: The coupon code issue has not been resolved. After receiving the same error, I created three new coupons for 90, 80 and 75% all of which failed as indicated above. Checkout completed successfully using a code for 50%.

  • Ash
    • WordPress Hacker

    Hello jcnjr

    Yes, the checkout fic was not added in the last release. As when the issue is reported, then the current version was already on the QA check. Hopefully, on the next version, it will be added :slight_smile:

    I don't have any any update yet about the coupon bug, unfortunately, but I will let you know once I get a hot fix for that.

    Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Ash

    Sigh...this issue, or another just like it is happening again after updating to WP 4.9.6.

    At the Next Step during checkout, after entering contact info, the status icon just spins...and spins.

    I confirmed that the template-functions.php edit you provided is still in place.

    The only error I get in the console when clicking the button is:

    Blocked loading mixed active content “.../wp-admin/admin-ajax.php?action=mp_update_checkout_data” jquery.js:4:26574

    Of course, I accidentally updated WordPress before performing a backup, so now this is rather urgent. Thanks in advance for any help!

  • Ash
    • WordPress Hacker

    Hello jcnjr

    Would you please add the following line on your wp-config.php?

    define( 'FORCE_SSL_ADMIN', true );

    If it doesn't fix, then please go to /wp-content/plugins/marketpress/includes/common/template-functions.php line no 3344 and replace

    $schema = 'http://';

    with

    $schema = 'https://';

    Let me know if it works for you. Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Ash
    Thank you for the prompt Reply!
    Unfortunately neither of these tips did the trick.

    1. I edited wp-config as suggested, issue persists.
    2. I edited template-functions as suggested, issue persists.
    3. I removed wp-config edit and kept template-functions edit, issue persists.

    In all cases, Chrome cosole reports:

    jquery.js?ver=1.12.4:4 Mixed Content: The page at '.../store/checkout/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint '.../wp-admin/admin-ajax.php?action=mp_update_checkout_data'. This request has been blocked; the content must be served over HTTPS.

    Additional suggestions are greatly appreciated.

  • Ash
    • WordPress Hacker

    Hello jcnjr

    Another trick, before line 3346

    $ajax_url = $schema . $domain . '/wp-admin/' . $path;

    Add one more line on 3345:

    $schema = 'https://';

    If it still doesn't work, would you please send me your admin login and cPanel details?

    You can send me privately in the following format:
    1. Please go to https://premium.wpmudev.org/contact/#i-have-a-different-question
    2. Select "I have a different question" if not selected
    3. In subject line put "Attn-Ash" (this will ensure that the email is assigned to me)
    4. Provide the wanted details.
    5. Add the thread link in the message so that I can track.

    Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Ash said:

    Add one more line on 3345:

    I had actually already tried that, based on the direction you were providing with previous suggested edits. Alas, the issue persists...

    I even edited siteurl in wp_sitemeta to https://agreda.com but that did not help. I changed it back since that also prevented me from removing items from the cart (with same admin-ajax error on /cart page)

    I will submit details via contact form ASAP.

    Thanks again for the help!

  • Ash
    • WordPress Hacker

    Hello jcnjr

    Thanks for sending details. I have tried in many way, the only way worked for me is to hard code the admin ajax url in every form, but that's not a good solution at all.

    So, I have sent your issue to our second level support team. Please note that, they deal with more complex issues, so there might be little delay. We appreciate your patience on this.

    Have a nice day!

    Cheers,
    Ash

  • jcnjr
    • HummingBird

    Ash said:

    there might be little delay...

    I understand. Thank you for escalating the issue.

    In the meantime, I am unable to receive any orders in our store, and I am reluctant to upgrade our other Marketpress sites.

    Would it be possible to get direction for the various hacks required to get this working again? Since I cannot roll-back to the previous WordPress version when Marketpress still worked...

    Thanks again!

  • jcnjr
    • HummingBird

    Hi Ash

    I understand the developers are very busy, but I need to get our store working again, and update a few other sites.

    I do not want to interfere with support access on our Agreda site, but need to know if reverting Marketpress to the previous version might fix our WP 4.9.6 incompatibility issue if I encounter then when updating our other MP store sites.

    Any tips for manually addressing the issue are also greatly appreciated.

    Thank you for your time!

  • jcnjr
    • HummingBird

    Thank you Panos I appreciate your help on this.

    Unfortunately, after replacing the patched file, the issue persists. Upon attempting to click Next Step after entering email address the status icon just spins and error console reports:

    jquery.js?ver=1.12.4:4 Mixed Content: The page at 'https://agreda.com/store/checkout/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://agreda.com/wp-admin/admin-ajax.php?action=mp_update_checkout_data'. This request has been blocked; the content must be served over HTTPS.

  • jcnjr
    • HummingBird

    UPDATE: I was finally able to complete the "Next Step" and get redirected to Paypal, but only after activating the "Really Simple SSL" plugin.

    Since I have never had to use this plugin before, and I don't know what other issues (if any) it may cause on our site, I'd love to get Marketpress working on its own as expected, and am happy to help test any other patches.

    For now, at least the store is working again! Really Simple SSL is clearly doing something to properly load admin-ajax.php via https.

    Thanks again for the help!

    Ash Panos

  • Panos
    • SLS

    Thanks for the feedback jcnjr ,

    I'm definitely interested on checking this out. I can't replicate this on my site with ssl. However I tried with mapped domain. As I can't replicate, there is another fix related to ssl, it's included in the attached file here, same file path as previously.

    If this doesn't make any difference perhaps we could check this on your site if it is a staging one.

    Thanks!

  • jcnjr
    • HummingBird

    Thanks again for your help on this Panos !

    I replaced that patch file, and tested the checkout, but the issue returned after deactivating Really Simple SSL. I guess keeping that plugin activated will be my solution for now.

    If you do spend more time trying to address this, I'm happy to keep help testing.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.