Posted: January 22, 2014 at 11:16 pm
|
Everything was fine, then I switched to WP core themes to troubleshoot some Add to Cart refresh issues and the error messages started. I have tried purging cart, different events, new events, only 1 event. I switched back to my original theme and still get message error. I can’t get past the cart page. Only changes made during theme testing were widgets and page template choices. Only have EE plugins, WP 3.8. Help please! |
|
The Add to Cart refresh issue is slow updating. Need to reload sometimes. Tried to isolate problem between Blue Host, Wallpress theme, or EE. Now customers cannot checkout. |
|
Solved: An error occured, a valid price is required. I had made a quick Commenting Out of text on the Event Registration page. Not sure why it caused the problem but I just deleted the content and all works now. BUT, any theories on the ajax loading. Click on Add to Cart and sometimes it just spins around for hours without going to View Cart. Almost always when I reload the page manually and click again it works. I am using |
|
Code is in the event description. Each event has different event_id. |
|
Hi, It sounds like a possible javascript error, difficult to say without seeing the site. Another thing to check is to make sure that the 3 events linked to in the add to cart are all valid events (open for registration, not in draft, etc.) |
|
I have setup a simpler link for testing |
|
|
|
Now it is not passing the value to the Shopping Cart Widget. So when you are successful adding to cart, it only shows`<div class=”widget-inner”><h2 class=”widget-title”>Preview Cart</h2><ol><li> </li></ol><br /><p class=”widget_cart_total”><strong>Total:</strong> $<span id=”event_total_price_widget”>0.00</span></p><p class=”widget_cart_link”><a href=”http://novaopen2014.com/register/event-registration/?regevent_action=show_shopping_cart”>View Cart</a> | <a href=”http://novaopen2014.com/register/registration-cancelled/”>Clear Cart</a> Here is my cart-widget.php that was edited per previous instructions from EE support. Note changes by Finding “RICK” <code><?php if (!class_exists('Espresso_CartWidget')) { class Espresso_CartWidget extends WP_Widget { /** * Register widget with WordPress. */ public function __construct() { parent::__construct( 'event-cart', // Base ID 'Event Espresso Cart Widget', // Name array('classname' => 'widget_espresso_cart', 'description' => __('An event shopping cart widget.', 'text_domain'),) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ //beginRICK documented at https://eventespresso.com/topic/shopping-cart-widget-please-have-it-show-without-adding-to-cart/ added Reload script, too. //replaces lines 24-43 of plugins/espresso-multiple/cart-widget.php public function widget($args, $instance) { //if (empty($_SESSION['espresso_session']['events_in_session'])){return;} extract($args); global $org_options; $grand_total = !empty($_SESSION['espresso_session']['grand_total']) ? $_SESSION['espresso_session']['grand_total'] : 0.00; $title = apply_filters('widget_title', $instance['title']); echo $before_widget; echo $before_title . $title . $after_title; //Debug //echo '<h4>$VARIABLE : <pre>' . print_r($_SESSION['espresso_session']) . '</pre> <span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<p><strong>Events in cart:</strong> '.count($_SESSION['espresso_session']['events_in_session']).'</p><br />'; echo '<ol>'; if (!empty($_SESSION['espresso_session']['events_in_session'])) { foreach ($_SESSION['espresso_session']['events_in_session'] as $event){ echo '<li>'.$event['event_name'].'</li>'; } } else { echo '<li>' . __('No events in cart', 'event_espresso') . '</li>'; } echo '</ol>'; echo '<br /><p class="widget_cart_total"><strong>'.__('Total:', 'event_espresso').'</strong> '.$org_options['currency_symbol'].'<span id="event_total_price_widget">'.number_format( $grand_total, 2, '.', '' ).'</span></p>'; echo '<p class="widget_cart_link"><a href="'.get_permalink($org_options['event_page_id']).'?regevent_action=show_shopping_cart">'.__('View Cart', 'event_espresso').'</a> | <a href="'.get_permalink($org_options['cancel_return']).'">'.__('Clear Cart', 'event_espresso').'</a> | <a href="javascript:document.location.reload();">Update</a></p>'; //beginRICK added Refresh (Update) script above echo '<p class="widget_cart_total"><em>'.__('You Must Update Page for Cart Items to Update. Total will Remain at $0.00 until Selecting Quantities when Viewing Cart.').'</em> '; //beginRICK added message above echo $after_widget; } //endRICK documented at https://eventespresso.com/topic/shopping-cart-widget-please-have-it-show-without-adding-to-cart/ /** * Sanitize widget form values as they are saved. * * @see WP_Widget::update() * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from database. * * @return array Updated safe values to be saved. */ public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form($instance) { $defaults = array('title' => __('Event Cart', 'event_espresso')); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?>"> <?php _e('Title:', 'event_espresso'); ?> </label> <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" size="20" type="text" /> </p> <?php } } }</code> |
|
<code><pre class="brush: php; gutter: true; first-line: 1; highlight: []; html-script: false"> <?php if (!class_exists('Espresso_CartWidget')) { class Espresso_CartWidget extends WP_Widget { /** * Register widget with WordPress. */ public function __construct() { parent::__construct( 'event-cart', // Base ID 'Event Espresso Cart Widget', // Name array('classname' => 'widget_espresso_cart', 'description' => __('An event shopping cart widget.', 'text_domain'),) // Args ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ //beginRICK documented at https://eventespresso.com/topic/shopping-cart-widget-please-have-it-show-without-adding-to-cart/ added Reload script, too. //replaces lines 24-43 of plugins/espresso-multiple/cart-widget.php public function widget($args, $instance) { //if (empty($_SESSION['espresso_session']['events_in_session'])){return;} extract($args); global $org_options; $grand_total = !empty($_SESSION['espresso_session']['grand_total']) ? $_SESSION['espresso_session']['grand_total'] : 0.00; $title = apply_filters('widget_title', $instance['title']); echo $before_widget; echo $before_title . $title . $after_title; //Debug //echo '<h4>$VARIABLE : <pre>' . print_r($_SESSION['espresso_session']) . '</pre> <span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; //echo '<p><strong>Events in cart:</strong> '.count($_SESSION['espresso_session']['events_in_session']).'</p><br />'; echo '<ol>'; if (!empty($_SESSION['espresso_session']['events_in_session'])) { foreach ($_SESSION['espresso_session']['events_in_session'] as $event){ echo '<li>'.$event['event_name'].'</li>'; } } else { echo '<li>' . __('No events in cart', 'event_espresso') . '</li>'; } echo '</ol>'; echo '<br /><p class="widget_cart_total"><strong>'.__('Total:', 'event_espresso').'</strong> '.$org_options['currency_symbol'].'<span id="event_total_price_widget">'.number_format( $grand_total, 2, '.', '' ).'</span></p>'; echo '<p class="widget_cart_link"><a href="'.get_permalink($org_options['event_page_id']).'?regevent_action=show_shopping_cart">'.__('View Cart', 'event_espresso').'</a> | <a href="'.get_permalink($org_options['cancel_return']).'">'.__('Clear Cart', 'event_espresso').'</a> | <a href="javascript:document.location.reload();">Update</a></p>'; //beginRICK added Refresh (Update) script above echo '<p class="widget_cart_total"><em>'.__('You Must Update Page for Cart Items to Update. Total will Remain at $0.00 until Selecting Quantities when Viewing Cart.').'</em> '; //beginRICK added message above echo $after_widget; } //endRICK documented at https://eventespresso.com/topic/shopping-cart-widget-please-have-it-show-without-adding-to-cart/ /** * Sanitize widget form values as they are saved. * * @see WP_Widget::update() * * @param array $new_instance Values just sent to be saved. * @param array $old_instance Previously saved values from database. * * @return array Updated safe values to be saved. */ public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form($instance) { $defaults = array('title' => __('Event Cart', 'event_espresso')); $instance = wp_parse_args((array) $instance, $defaults); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?>"> <?php _e('Title:', 'event_espresso'); ?> </label> <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" size="20" type="text" /> </p> <?php } } } </pre></code> |
|
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php /** /** //beginRICK documented at https://eventespresso.com/topic/shopping-cart-widget-please-have-it-show-without-adding-to-cart/ added Reload script, too. /** return $instance; /** $instance = wp_parse_args((array) $instance, $defaults); } |
|
Sorry. All the codes above are the same. Was trying to get line# to show. |
Hi there, I’m not seeing any speed issues with the ajax spinner. One thing that might affect this is if you’re going from the admin of the site (while you’re logged in) if the admin is forced to load as https it will open the front end pages as https too. Depending on how that’s set up it cause an issue with the ajax handler loading. |
|
|
I will continue to test based on your reply. I added issue with Shopping Cart Widget while you were looking into primary issue. Should I open a new topic instead? |
|
Further testing when signed out using Chrome (PC) reveals that the Events that add multiple items to the Cart (my reason for using the shortcode) produces the “endless spinner”. All events that are added via the link are Active, Unexpired, Waitlist. Is the Waitlist the issue? To reproduce the issue: I appreciate your help. |
|
All the “extra” events are Waitlist. The primaary event is listed first in shortcode and is “Public” |
Hi there, I’m not able to reproduce the spinner issue when I test added events to the cart on your site. Here’s a video: http://screencast.com/t/jIEBAurOUTnL What you can do is try clearing your browser’s cache if you continue to see issues with the Ajax handler. With the widget issue, we might be able to read your custom code if you paste it into a pastebin and link to it in this thread. |
|
|
I think we have the spinner issue resolved. As for widget, I have rolled back the cart.php and cart-widget files to originals. I had received a bug fix from Dean https://eventespresso.com/topic/shopping-cart-widget-please-have-it-show-without-adding-to-cart/ for cart-widget.php and from Josh https://eventespresso.com/topic/replacing-add-to-cart-link/ . They are no longer installed. Everything vanilla. Nonetheless, any event that has only one event added to cart via [ESPRESSO_CART_LINK event_id=”328″ anchor=”Add to Cart”] will not show the event title in the widget. This is the case even if the shortcode is not wrapped in <div></div>. All the shortcodes are added within the description. Would they work if loaded thru at meta field? If so, I need assistance on getting them to display from pages that load [EVENT_LIST show_recurrence=true order_by=id] My site: http://novaopen2014.com Events that won’t work are Warhammer 40k GT, Warhammer Team, Warmachine/Hordes “All Event Entry”. All others add more than more event to cart and work fine. |
Hi there, You can use the event_name parameter so it adds the event name. Example: [ESPRESSO_CART_LINK event_name=”Warhammer 40K GT” event_id=”328″ anchor=”Add to Cart”] |
|
|
This is helpful and works. In order to update the shortcode in each event I will need to charge my client for the time to update each event. Is it possible to provide me with a bug fix within the php to accomplish this? The shortcode does not render on the “description page” (the one that is linked thru the title. Why not? Also, should I being using shortcodes within the description or passing them thru a meta field. If latter, how would I get the meta field to render for each event listing. Would you like me to start a new forum topic at this point? Thank you, Josh |
Hi there, It’s not really a bug, this is a feature that allows multiple events to go into the cart. You’re running into some limitations to what the add to cart link can do because you’re using the add to cart shortcode where it is typically not supposed to be used. Normally the event list has the add to cart link automatically displayed (no need for adding add to cart links everywhere). In this case you might experiment with adding the shortcode straight into the template files, or better yet, a custom function. For example if you want the add to cart link to display on the single event view, you’d add this to a custom function file: <?php add_action('action_hook_espresso_social_display_buttons', 'nova_custom_cart_link'); function nova_custom_cart_link($event_id) { global $wpdb; $event_name = $wpdb->get_var("SELECT event_name FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'"); ?><div class="custom-cart-link" style="display:block;"> <?php echo do_shortcode('[ESPRESSO_CART_LINK event_id="'.$event_id.'" event_name="'.$event_name.'" anchor="Add this session to your cart"]'); ?> </div> <?php } |
|
|
Makes sense to forgo the custom code. The solution I think my customer will accept is leaning a certain way. I can set up accordingly. But if I don’t get my way, it won’t matter as we will only being using the default Add to Cart. Very helpful. I am still experiencing Spinner issues. I have been trying a new way for me to upload code files through Dreamweaver. I hit CTL+Shift+U and then “Y” if the file has been saved locally. Sometimes it is leaving a “Y” in my css files, etc. Potentially, big problem. I am running a code compare using Diff Merge to see if any PHP file I edited, has an unintend “Y”. If that does not solve the spinner issue, I will contact Blue Host and start a fresh EE support ticket. Once you have read my reply, consider this topic “resolved”. If there is a way for you to delete those long code snippets, I think this topic will be more beneficial to others. Thanks again. Josh, you ARE the man. |
You might try an FTP client like Cyberduck (mac) or FileZilla (PC). They will not add the Y’s to your code. |
|
|
Ended up that no “y” were introduced into the PHP. Thank goodness. I must have discovered the issue right away when I was editing CSS. But I had to check all the PHP to be sure. In fairness, I only started using that key stroke sequence yesterday and this Spinning issue has been around since the get-go. I’ve gone back to CTRL-S > CTRL-Shift-U. Too tendious using the mouse. I have nearly finished my troubleshooting and it doesn’t look good. I will send a private message instead of using the forum. |
|
Aren’t the toughest problems have the most simple answes. Like a loose wire, that sometimes works and other times does not. The issue with Spinning was a subdomain I had setp with Blue Host. My WP URLs were set to the subdirectory rather than the subdomain. Normally, not an issue but with an ajax call it is a big problem. I am a bit surprised you all didn’t catch it as it was right there in the URL in the browser. Wished I had tracked it down … no I didn’t see it in the URL either … before I did three hours of code searches and file swaps. I caught it by isolating a single event into its own page. Since it loaded, I swapped it to be the homepage, too … and it was revealed. Do appreciate your efforts. You all thought it was in the Javascript … indirectly it was … so I kept looking in the wrong places. Perhaps you can add this solution to your wheelhouse. It never hurts to suggest, “is it unplugged.” |
|
Very good catch! And yes sometimes it is the simplest solution, and definitely one to bear in mind should the issue arise with other members of the community. |
The support post ‘An error occured, a valid price is required.’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.