Issue with mini calendar shortcode

Home Forums Calendar Products Events Calendar PRO Issue with mini calendar shortcode

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #913702
    gilcatt
    Participant

    My use case : I am calling a WooCommerce product page in the event description via its shortcode, using WooCommerce as a catalogue – no cart – to permanently store the description of a product in the WooCommerce shop (the product page of a training session) and put it on sale as an event when scheduled, using wootickets. So far so good. Works great.

    However I wanted to use the mini calendar to show available dates for this training session in its WooCommerce product tab. A standard feature in such a case. And the reason I bought the Event Calendar Pro version.

    When adding the mini calendar shortcode to the product description tab in a WooCommerce product page AND adding the product page shortcode in the event description text area I get the following error both in the main calendar and the event’s page :
    (The same was happening with the Event Rocket plugin)

    Fatal error: Call to a member function get_upsells() on a non-object in /var/www/dev2.sociatomdev.com/chroot/htdocs/wp-content/plugins/woocommerce/templates/single-product/up-sells.php on line 14

    For testing purposes only, I then put the mini calendar shortcode in the short description text area of the product page.
    This time no error message on the main calendar page, but the filter bar is not responding & cannot be reset (showing a dead link, ending with /#), the events in the calendar are all gone except the event in which the shortcode was put, and the following appears on the event page :

    Fatal error: Call to a member function get_sku() on a non-object in /var/www/dev2.sociatomdev.com/chroot/htdocs/wp-content/plugins/woocommerce/templates/single-product/meta.php on line 21

    My guess is that the mini calendar shortcode is interfering with the next action in the page.
    up-sells.php is called right after the full product description
    meta.php is called right after the short description
    >>> there is a pattern here : the shortcode is interfering with this logic
    note : this is happening regardless of using wootickets or not.

    (Hmm …Could you guys add automaticaly generated paragraphs in the discussion’s preview ? The result is hard to … preview.)

    #913716
    gilcatt
    Participant

    By the way : exact same behaviour using “The Events Calendar Shortcode” plugin, which otherwise works nicely. If that can be of any help.

    #914035
    Brian
    Keymaster

    Hello,

    Thanks for using out Plugins and updating to 3.9.

    There is quite a lot here so I will go through each point to start the troubleshooting process.

    I am calling a WooCommerce product page in the event description via its shortcode

    Please be ware there is a bug when adding the WooCommerce Product shortcode in an Event Content Editor that causes the month view to show incorrect titles and links for that event, we are working on a solution to this, but do not have one at this time.

    Case 1 (mini calendar shortcode to the product description tab in a WooCommerce product page AND adding the product page shortcode in the event description text area)
    I was not able to reproduce this error. But that error refers to the $product object it is saying it is not one. So something is overwriting that global.

    Case 2 (mini calendar shortcode in the short description text area of the product page)
    I was not able to reproduce this error either. I placed the mini calendar shortcode in both the short and regular description of the product and everything worked without error.

    By the way : exact same behaviour using “The Events Calendar Shortcode” plugin, which otherwise works nicely. If that can be of any help.

    This is not our plugin so we are not able to provide support for it, but thank you for the information.

    So to help narrow this down and see if we can find the exact conflict can you please follow our testing for conflicts guide:

    https://theeventscalendar.com/support/documentation/testing-for-conflicts/

    Also please confirm you are using the latest version of WooCommerce and if you have any custom templates for the Events Calendar or WooCommerce.

    Let me know and we can go from there.

    Thanks

    #914104
    gilcatt
    Participant

    Thanks for the reply, I am currently doing more tests. I shall report my findings.

    #914148
    Brian
    Keymaster

    Ok keep us posted.
    Thanks

    #914384
    gilcatt
    Participant

    Here I am again.
    I did follow the debugging guidelines rigorously
    Used the latest version of twenty thirteen
    Deactivated all plugins, including TEC Filter bar, except The Event Calendar
    (Even tried with and without TEC PRO, with and without WooCommerce Tickets)
    Flushed the browser cache
    Flushed all database transients

    I have a copy of my System Information, if needed.

    The only plugin I could not deactivate was of course WooCommerce, because it was needed to experience the bug.

    I also wish I had kept TEC 3.8 and TEC PRO 3.8 for comparison : Are there dowloadable somewhere?

    I found another bug , this time with 3.9.

    Let’s start with the first one, reported earlier on.

    CALENDAR BUG

    => Used shortcode [tribe_mini_calendar]
    => Embedded WooCommerce shotcode [product_page id=”99″] in the Event description

    then :

    1. added calendar shortcode to the Product ‘s description – main area
    AND
    added the Product page shortcode to the Event description area

    * Calendar works fine on WooCommerce Product page
    BUT
    * resulting error on Event page :

    Fatal error: Call to a member function get_upsells() on a non-object in/var/www/dev2.sociatomdev.com/chroot/htdocs/wp-content/plugins/woocommerce/templates/single-product/up-sells.php on line 14
    page.

    * there is also a never ending loading image floating above the mini calendar on “the ‘Single Event” ” page.
    * the Event is not visible on the All Events page, in Month view
    * the main calendar is truncted at the level of the start date.
    * the Event is visible on the All Events page, in List view

    2. Deleted it from the Product description main area
    AND
    added it to the Product’s Short Description field

    * Calendar works fine on WooCommerce Product page
    BUT
    * resulting error on Event page :

    Fatal error: Call to a member function get_sku() on a non-object in/var/www/dev2.sociatomdev.com/chroot/htdocs/wp-content/plugins/woocommerce/templates/single-product/meta.phpon line 21

    * there is also a never ending loading image floating above the mini calendar on “the ‘Single Event” ” page.
    * the Event is not visible on the All Events page, in Month view
    * the main calendar is truncted at the level of the start date.
    * the Event is visible on the All Events page, in List view

    And some new stuff since TEC 3.9

    => this time without using the mini calendar shortcode
    => as above tried both WooCommerce shortcodes for Product page.

    [product_page id=”99″]
    [product_page sku=”FOO”]

    to embed it in an Event description

    1. added them to the Event description text area.

    * the Ticket is not added to the cart
    (It did work with TEC 3.8)

    2. deleted them from the Event description text area

    * the Ticket is added to the cart

    In both case everything looks good from the Single Event page.
    But the Ticket seems to dislike the WooCommerce shortcode when embedded in the Event page ‘s description.

    #914386
    gilcatt
    Participant

    This reply is private.

    #914773
    Brian
    Keymaster

    Ok thanks for all the information and testing everything.

    I was able to reproduce the error in the events this time. I was using the products shortcode and not the products_page one.

    However, it looks like the conflict is because the Event Calendar uses a global called $product on the single event page. However, the WooCommerce Product also uses a global of the same name.

    That variable is used all over our plugins so it is not something that can be fixed with a snippet. I will look into this more, but I do not think I will have a resolution to fix this.

    I understand this can be a deal breaker for you so if you would like a refund, please email us with your receipt number at pro(at)tri.be

    I will look into this more and let you know what I find out.

    Thanks

    #916310
    gilcatt
    Participant

    Thanks for the reply , Brian

    Would it be possible to change the name of the global ? I mean on my side …
    I know this could be tedious, with upgrades in mind.
    Unless there would be a snippet offering the option to swap a global’s name.

    #916343
    gilcatt
    Participant

    Some thoughts, related to what I want to achieve, which I can’t with The Event Calendar.

    In my opinion, an event is not a product, but a variation of a product. A single product leading to one or many events.

    Take a band on a tour :
    Businesswise, a tour consists of a single concert program repeated multiple times in multiple places. And not of multiple gigs, each in a single venue on a single date (although this is how the customer perceives it, and most developers too, obviously…)
    The logical difference is subtle but crucial.

    The variables date/time would have to be defined in the woocommerce product settings, not outside of it. I agree, you would need a completely different plugin to do this, based on woocommerce and not “event” custom post types.

    In the first case you end up with one single page for all events associated with one product, in the second case you have to create as many pages as there are events (A post with the same description for each new date of what is basically a single product? Hello, duplicated content issues… How can this be solved using The Event Calendar, by the way ?).

    Thanks for the great support, otherwise. I have rarely experienced such a level of professionnalism as far as plugin support is concerned.

    #916348
    gilcatt
    Participant

    The variables date/time : read The Variables date/venue

    #916357
    Brian
    Keymaster

    Hi,

    So looked into this more and do not think changing the global in a plugin would be a good idea as it creates to many unintended issues and has to keep being done over and over after each update.

    I did notice that the file causing the problem is the up-sells.php you can move that to your theme here:

    \wp-content\themes\yourtheme\woocommerce\single-product\up-sells.php

    There you can safely edit it.

    In my case I added a conditional:

    if(!is_singular(‘tribe_events’)) {}

    That prevented it from running when embeded using the shortcode on an event page and stopped the fatal error for me.

    You could remove the global $product on that file and use a custom method to get the product object as a new variable there to prevent the error.

    That is about all I can help out on this, but can answer a follow up question if you have one as it relates to the Events Calendar.

    Thanks

    #916360
    gilcatt
    Participant

    Oh thanks for the tip, I will check that
    Where do I put the conditional ?

    #916365
    Brian
    Keymaster

    I wrapped all the coding starting under this line:

    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    if(!is_singular('tribe_events')) {
    global $product, $woocommerce_loop;
    //all coding here
    wp_reset_postdata();
    }

    #932254
    Brian
    Keymaster

    Since there is has not been any activity on this thread for over 2 weeks so I am now closing it. Feel free to start a new thread if you have further issues. Thanks! 🙂

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Issue with mini calendar shortcode’ is closed to new replies.