Okay
  Public Ticket #1872060
Is there really no CSV import?
Closed

Comments

  • Tayler started the conversation

    I have hundreds of events to import. I assumed there would be some form of CSV import?

    ICS is no good to anyone.

  •  877
    Zhivko replied

    There's no CSV import yet but will be added in the future.

    You could use some CSV to ICS converter temporarily.


    Stachethemes Developer

  • Tayler replied

    So how do I add my huge amount of data?

  • Tayler replied

    These converters will also import the category? I'll try.

  • Tayler replied

    Got the following error...

    Fatal error: Call to undefined function ICal\mb_split() in /home/thoroughbred/public_html/wp-content/plugins/stachethemes_event_calendar/admin/libs/ics/vendor/johngrogg/ics-parser/src/ICal/ICal.php on line 2026

  •  877
    Zhivko replied

    You will have to enabled mbstring in your php.ini file. 

    I believe your host support could help you with this.


    Stachethemes Developer

  • Tayler replied

    Thanks. I'll give that a go.

  • Tayler replied

    I've now got to the point where it is importing some but I'm getting the following error...


    Notice: Undefined index: UID in /home/thoroughbred/public_html/wp-content/plugins/stachethemes_event_calendar/admin/libs/ics/vendor/johngrogg/ics-parser/src/ICal/ICal.php on line 832

  •  877
    Zhivko replied

    Hi,

    Could you send me the ics to test it out?


    Stachethemes Developer

  • Tayler replied

    It's okay I fixed it. They didn't import with the categories though, do you have any idea of how to add them in easily? They all need to go in the same category but there are 1500 of them. Adding them to the SQL DB maybe?

  •  877
    Zhivko replied

    If the events categories are kept in the ics file then perhaps it's possible via custom filter.


    Stachethemes Developer

  • Tayler replied

    I done it with SQL queries and imported via CSV and Phpmyadmin. Thanks.

  • Tayler replied

    Hello again.

    One more question. I have a custom tab for an event. The tab has a select field to choose from two values.

    So how can I move the value from this meta to the month/week view? It would be great to add some custom CSS class name or data attribute to the li.stec-layout-month-daycell-event element.

    Is there any way to do that?

  •  877
    Zhivko replied

    Hi,

    Here are the data attributes for the month day cell events:

    data-pos="1"  ( this is the event position on the cell. It can be 1 2 or 3 )
    data-pos-id="997-0" ( this is used for determine the event position on the cell )
    data-repeat-time-offset="0" ( 0 is the event repeat time offset in seconds )
    data-id="997" ( 997 is the event id )

    I think you could target specific cell event with following selector:

    .stec-layout-month-daycell-event[data-id="997"]

    Stachethemes Developer

  • Tayler replied

    Thanks, but I need to append a new data like this:

    data-pos="1"
    data-pos-id="997-0"
    data-id=="997"
    ...
    data-custom-meta="custom-meta-value"

    Is it possible?

  • Tayler replied

    Or is there any event that fires when the calendar is ready?

  •  877
    Zhivko replied

    You could use the following action. Place the code in your theme functions.php file.


    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">         (function ($) {             if (typeof $.stecExtend !== 'function') {
                    return;
                }             $.stecExtend(function (master) {
                    if ('month' === master.glob.options.view) {
                        $.each(master.$instance.$month.find('.stec-layout-month-daycell-event'), function () {
                            var eventId = $(this).data('id'); // example obtaining event id                         $(this).data('my-custom-data', 'some value'); // storing custom value
                        });
                    }
                }, 'onLayoutSet');
            })(jQuery);     </script>
        <?php
    });



    Stachethemes Developer

  • Tayler replied

    Thanks. We are gettin closer. :)

    I need something like this:

    if ('month' === master.glob.options.view) {
      $.each( master.$instance.$month.find( '.stec-layout-month-daycell-events' ), function () {
        $( this ).find( '[data-id]' ).each( function () {
          if ( /* this event has custom meta "on" */ ) {
            $( this ).data( 'custom-meta-value' );
          }
        } );
      } );
    }
    

    The main question is how to check if the current event has custom meta value.

  •  877
    Zhivko replied

    Try:

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                if (typeof $.stecExtend !== 'function') {
                    return;
                }
                $.stecExtend(function (master) {
                    if ('month' === master.glob.options.view) {
                        $.each(master.$instance.$month.find('.stec-layout-month-daycell-event'), function () {
                            
                            if ('undefined' !== $(this).data('custom-meta-value')) {
                                // event has meta data for custom-meta-value
                                console.log($(this).data('custom-meta-value')); // show value in console log
                            }
                        });
                    }
                }, 'onLayoutSet');
            })(jQuery);
        </script>
        <?php
    });



    Stachethemes Developer

  • Tayler replied

    Can I get a list of all events available to handle?

  • Tayler replied

    And is there any way to display all events for the day and to do not hide them under "+ more" label.

  •  877
    Zhivko replied

    Here's how you can obtain all events once they are loaded in the calendar.

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                if (typeof $.stecExtend !== 'function') {
                    return;
                }
                $.stecExtend(function (master) {
                    
                   var events = master.calData.eventsPool;
                   
                   $.each(events, function(){
                       
                      console.log(this); // displays each event in the console log
                      
                   });
                   
                }, 'onAddToEventsPool');
            })(jQuery);
        </script>
        <?php
    });

    To display todays events you could use the shortcode:

    [stachethemes_ec views=day view=day show_top=0]

    Currently you can't remove the "+ more" from the month view. It's something we'll address in future update.


    Stachethemes Developer