Home › Forums › Ticket Products › Event Tickets Plus › Ajax Add to Cart instead of going to Cart Page
- This topic has 13 replies, 4 voices, and was last updated 5 years, 11 months ago by Support Droid.
-
AuthorPosts
-
October 25, 2016 at 8:32 am #1182470slny311Participant
New issue not related to
https://theeventscalendar.com/support/forums/topic/get-all-attendees-email-address/http://5cf.563.mwp.accessdomain.com/event/lireg-golf-and-tennis-tournament/
On the page above there is a add to cart button which sends the user to the cart page
The problem with that is
– when user use the back button it adds the empty tickets back onto the pages.
– on cart page when user refresh the post data gets resubmitted for a duplicated ticket everytime.October 25, 2016 at 9:13 pm #1182967HunterModeratorHi and welcome,
Before I try reproduce the issues on my test environment, can you please review our Testing for conflicts guide and reply back with your findings?
when user use the back button it adds the empty tickets back onto the pages.
I believe WooCommerce does not reduce tickets from the alotted stock until the order has been completed. So I think this behavior is by design.
on cart page when user refresh the post data gets resubmitted for a duplicated ticket everytime.
Does this happen before or after selecting the ‘Place Order’ button?
Thank you for working with me on the issues and I look forward to your response. Cheers!
October 26, 2016 at 7:20 am #1183152slny311ParticipantI have done the steps on your no-conflict testing
with 2016 theme & Woocom & event calendar & tickets & tickets plus enabled. *everything else disabled*Steps to reproduce error
[Plus 1 on a ticket] -> [add to cart] -> [Lands on Cart Page -> Refresh Page]
**Another ticket is added here**
The extra tickets that are added this way does not have the form meta info filled out in the backend, also there shouldn’t be any extra tickets added by refresh which will allow someone adding more tickets than the stock.[After being on the Cart Page] -> [Back button] -> [Lands on Single event Page]
**The tickets forms you have filled out are displayed again without any info in them, when going back it should just load the empty page without extra forms that has been previously submitted.Specially with my current setup where I disable editing of member only tickets and pulls the ticket info from user roles, allowing the user to back and put new tickets in causes a big issue with the workflow.
October 26, 2016 at 4:57 pm #1183493HunterModeratorHi and welcome back,
Excellent job describing the exact behavior I needed to reproduce the issues. I can confirm both problems you’ve voiced and have logged a couple bug reports for the developers to review while making improvements in upcoming maintenance releases.
I don’t have any specific timeframe when these fixes will be addressed, but please keep an eye on your WordPress admin dashboard and our Release Notes for more info.
I truly apologize you’ve having to deal with these issues and please let me know if you have any more questions or concerns. Cheers!
October 27, 2016 at 7:01 am #1183686slny311ParticipantIs there any Temp solution that can help “workaround” this interaction?
October 28, 2016 at 11:38 pm #1184785HunterModeratorHello,
I’ll bring this thread to the attention of some more savvy developers to see if they’re able to come up with a temporary workaround, but I can’t promise anything. Try reaching out on Monday to see if I was able to come up with anything helpful.
Sorry I don’t have anything for you in the mean time and thanks for understanding. Have a great rest of your weekend 🙂
November 1, 2016 at 6:55 am #1185712slny311ParticipantAny update ?
I think a workaround would be having a ajax add to cart button but I didn’t see that function for your event ticket plugin.
November 1, 2016 at 10:07 pm #1186175HunterModeratorHi and welcome back,
Unfortunately, these bugs are prioritized fairly low. Reason being is the metrics show users very rarely hit the Refresh button. Additionally, the issue that occurs when the Back button is pressed is more related to which browser users are using, so I can’t say whether that will be considered a bug in the eyes of the developer. With that said, I still don’t have any updates on when a fix will be released. Please refrain creating new topics/responses asking for dates. We are unable to provide them under any circumstance and almost 100% of the time, I do not know myself.
If you would like to submit data via Ajax, you could certainly do that. We do not have a preexisting set of functions you could use, but you could absolutely build it yourself using the Tribe APIs. The function we use to add stuff to the cart is:
Tribe__Tickets_Plus__Commerce__WooCommerce__Main::process_front_end_tickets_form(). If you submit the tickets data via ajax then call that, it will process the ticket and add it to the cart.For future reference, please refer to our Release Notes for feature and fix info.
Thank you for your understanding and have a good evening 🙂
November 3, 2016 at 2:52 pm #1187371slny311Participantforcefully set Quality back to 0 on single event load prevents it from keeping the old values and showing up new ticket forms when pressing the back button
upon process_front_end_tickets_form()
I Just add a new redirect header to prevent data being kept on the cart page which causes new items to be added to cart when user refresh this page.
November 5, 2016 at 6:22 pm #1188301HunterModeratorHello,
Thank you for sharing your solutions with us! I’ve gone ahead and added them into the logged bug reports for others to use if they need. Thanks again and have a great rest of your weekend. I’ll mark this thread as ‘Pending Fix’ for the time being, so please create a new thread if you have any additional questions or concerns. Cheers!
November 10, 2016 at 2:26 pm #1190649slny311ParticipantJust incase – Below is what I used.
public function process_front_end_tickets_form() { parent::process_front_end_tickets_form(); global $woocommerce; if ( empty( $_REQUEST['wootickets_process'] ) || intval( $_REQUEST['wootickets_process'] ) !== 1 || empty( $_POST['product_id'] ) ) { return; } foreach ( (array) $_POST['product_id'] as $product_id ) { $quantity = isset( $_POST[ 'quantity_' . $product_id ] ) ? intval( $_POST[ 'quantity_' . $product_id ] ) : 0; $optout = isset( $_POST[ 'optout_' . $product_id ] ) ? (bool) $_POST[ 'optout_' . $product_id ] : false; $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity ); $cart_data = array( 'attendee_optout' => $optout, ); if ( $passed_validation && $quantity > 0 ) { $woocommerce->cart->add_to_cart( $product_id, $quantity, 0, array(), $cart_data ); } } wp_redirect( "http://$_SERVER[HTTP_HOST]/cart/" ); exit; }
You Guys actually already have this code in event-tickets-plus/src/tribe/commerce/edd/main.php
but doesn’t seem to carry over to the child function.public function process_front_end_tickets_form() { // We're only interested in EDD Tickets submissions if ( ! isset( $_GET['eddtickets_process'] ) || empty( $_POST['product_id'] ) ) { return; } // Add each ticket product to the cart foreach ( (array) $_POST['product_id'] as $product_id ) { $quantity = isset( $_POST[ 'quantity_' . $product_id ] ) ? (int) $_POST[ 'quantity_' . $product_id ] : 0; if ( $quantity > 0 ) $this->add_ticket_to_cart( $product_id, $quantity ); } // To minimize accidental re-submissions, redirect back to self wp_redirect( edd_get_checkout_uri() ); edd_die(); }
November 18, 2016 at 10:53 am #1194638HunterModeratorThank you for that update. Reason it doesn’t pick up the override is due to it not being included in files we’ve allowed for overrides, essentially meaning you’ll lose the customizations you’ve made when you update the plugin.
Thanks again and as previously mentioned, stay tuned to our Release Notes for more info. Have a great weekend ahead!
May 10, 2018 at 7:18 am #1527200VictorKeymasterHi There!
Just wanted to share with you that a new release of our plugins is out, in which this issue is no longer present.
Find out more about this release → https://theeventscalendar.com/maintenance-release-for-the-week-of-6-may-2018/
We truly apologize for the long delay in getting back to this.
Please update the plugins and let us know if it works for your site.
Best,
VictorJune 1, 2018 at 9:35 am #1543982Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Ajax Add to Cart instead of going to Cart Page’ is closed to new replies.