Getting these Notices after a successful payment to a "virtual" normal product

Home Forums Ticket Products Event Tickets Plus Getting these Notices after a successful payment to a "virtual" normal product

  • This topic has 0 replies, 3 voices, and was last updated 6 years ago by Shadi Habbal.
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1226276
    Shadi Habbal
    Participant

    Hi,

    I’m seeing these Notices after successfully paying for a “virtual” non-ticket product, and returning from the bank page to store.

    
    Notice: Undefined variable: quantity in wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php on line 696
    
    Notice: Trying to get property of non-object in wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Global_Stock.php on line 225
    

    Isn’t there supposed to be some kind of check to prevent such issues?

    according to my error_log, these warnings have existed at least since (01-Jan-2017); before that date I had my error_log cleared (how silly of me).

    PS: I haven’t switched theme or disabled plugins because I have to clone my production site into the staging subdomain first, which I currently don’t have time for, so I wanted first to double check with you if it’s something you are aware of.

    Regards
    Shadi

    #1227123
    Andras
    Keymaster

    Hello Shadi,

    Thanks for reaching out with that issue. I have checked our internal tickets and didn’t find anything that would be connected to that.

    We will investigate this and to help us in that I have a couple of questions.

    Do I understand correctly that this appears on the front-end, so users would see this after payment?

    What is the payment gateway used? Does it come with all, or only a certain one?

    This only happens with virtual tickets?

    Could you share the error log with me?

    And it would be great to have that staging site as well, if you manage.

    Looking forward to solving this with you.

    Cheers,
    Andras

    #1230596
    Shadi Habbal
    Participant

    Hello András,

    Sorry for the late replay, I was holding my breath just to confirm that this was not a single/rare accident.

    But since that it happened again after my report, I think it might be worth looking into.

    Do I understand correctly that this appears on the front-end, so users would see this after payment?

    Yes.

    What is the payment gateway used? Does it come with all, or only a certain one?

    2 plugins for Worldpay, for 2 different accounts:
    1. https://woocommerce.com/products/worldpay/
    2. https://en-gb.wordpress.org/plugins/business-worldpay-gateway-for-woocommerce/
    Then plugin #2 was replaced with another clone of plugin #1, because it was causing other issues.
    Yes, it happens with either plugin.

    This only happens with virtual tickets?

    We only have virtual tickets.

    Could you share the error log with me?

    Sure. Check next hidden replay.

    And it would be great to have that staging site as well, if you manage.

    I’ll try to.

    Regards
    Shadi

    #1230599
    Shadi Habbal
    Participant

    This reply is private.

    #1231592
    Andras
    Keymaster

    This reply is private.

    #1231734
    Shadi Habbal
    Participant

    Hello András,

    All our products are virtual products (at least for the time being). We are a pharmacy training provider, we sell courses/events.. no hard materials so far.

    To tell you the truth, I haven’t checked if it happens with courses selling as well. I’ll let you know once I check it out.

    Regards,
    Shadi

    #1231905
    Andras
    Keymaster

    Thanks for getting back to me on that.

    I did a first check on your logs. I see that these are notices only and not errors or fatals. If they are showing to your users then you should be able to switch that off.

    Check if WP_DEBUG is set to false in your wp-config.php file (on a live site that is recommended) and check your server settings whether notices should be printed out as well, or only warnings. You can set that so it only shows warnings.

    Cheers,
    Andras

    #1232011
    Shadi Habbal
    Participant

    Hi András,

    I have already hidden all warnings/notices, but that wasn’t the reason why I came here.

    I came wondering why is the warning/notice is showing up in the first place.

    Shouldn’t there be some additional check(s) in order to avoid such warnings/notices?
    Why does it happen sometimes, and sometimes not?

    That was my point.

    Thanks for looking into this.

    Best regards
    Shadi

    #1232480
    Shadi Habbal
    Participant

    Hello,

    Just giving you a heads up.

    Since 04.02.2017, there has been no new warnings/notices as the ones mentioned above, despite having several successful orders ever since.

    So, let’s hold on this for now, to save your time.. and I’ll keep watching for the next couple of days then update you.

    Regards,
    Shadi

    #1232773
    Andras
    Keymaster

    Shadi, thanks a lot for re-checking. I’m happy to hear that the notices stopped coming.

    I’ll leave the topic open, so you can report back if anything comes up regarding this topic.

    Cheers,
    Andras

    #1233277
    Shadi Habbal
    Participant

    Hi András,

    I am now certain of what’s going on.

    It happened 3 times yesterday, and by comparing the error_log records with WC orders, I have noticed that it happened only when people purchased a non-ET virtual product.

    Going back to line 696 in wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php;
    and tracing back to where $quantity is defined

    
    if ( ! empty( $event_id ) ) {
       $has_tickets = true;
    
       // Iterate over all the amount of tickets purchased (for this product)
       $quantity = intval( $item['qty'] );
       ...
    }
    
    do_action( 'event_tickets_woocommerce_tickets_generated_for_product', $product_id, $order_id, $quantity );
    

    I see that $quantity is defined inside the IF block, which is executed only for events.

    As for the second notice

    Notice: Trying to get property of non-object in wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Global_Stock.php on line 225

    
    ...
    foreach ( $order->get_items() as $item ) {
    	$product      = $order->get_product_from_item( $item );
    	$event        = $woo_tickets->get_event_for_ticket( $product->id );
    	$global_stock = new Tribe__Tickets__Global_Stock( $event->ID ); // <-----
    ...
    

    Since the product is not an event, the $event variable is undefined/null, hence $event->ID fires an exception.

    Yup. You have a small bug that need addressing with proper validations for non-events products.

    Regards,
    Shadi

    #1233757
    Andras
    Keymaster

    Shadi, that is awesome! Thank you for digging so deep into that and sharing your findings with us. It is very much appreciated.

    I will share this with our dev team so we can fix this.

    Is there anything else related to this topic I can help you with?

    Cheers,
    Andras

    #1233797
    Shadi Habbal
    Participant

    Hello András,

    Glad to be of help.

    No thank you, nothing else regarding this topic (but you’re more than welcome to check my other unanswered topics ;))

    Regards
    Shadi

    #1234347
    Andras
    Keymaster

    Hi Shadi,

    Thanks again for submitting this. I have created an internal bug ticket and we will look at the issue and get it fixed in one of the upcoming releases.

    I am going to set the status of this ticket to “pending fix” and we will update it once the fix is released. If you have any new questions or issues please create a new ticket and reference this one.

    As for your other topics, we are on them. 🙂 We take the incoming questions in a timely order. Currently we are overloaded with new questions, but you can be sure that your questions will also get an answer in a timely manner, in case they have not been picked up yet.

    Thanks and cheers,
    Andras

    #1491571

    Hi There!

    Just wanted to share with you that a new release of our plugins is out, including a fix for this issue 🙂

    Find out more about this release —> https://theeventscalendar.com/maintenance-release-week-25-march-2018/

    Please update the plugins and let us know if the fix works for your site.

    Best,
    Jaime

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Getting these Notices after a successful payment to a "virtual" normal product’ is closed to new replies.