Okay
  Public Ticket #2586045
Export CSV
Closed

Comments

  •  1
    romain started the conversation

    Hello

    When I export my Stachethemes events in CSV, and try to import them in Google Agenda, Google doesn't accept the csv, because Date and Time are in the same field.
    Is there a way to create 4 different columns at export :

    • Start date
    • End date
    • Start Time
    • End Time

    Any tips ?

    Because modify manually each row is very very very very long....

    Thanks !

  •  894
    Zhivko replied

    Hi,

    Open your theme or child-theme functions.php file and add following filters:

    add_filter('stec_csv_export_fields', function($fields) {
        $fields['start_ymd'] = esc_html__('Start YMD', 'stec');
        $fields['end_ymd']   = esc_html__('End YMD', 'stec');
        $fields['start_time'] = esc_html__('Start Time', 'stec');
        $fields['end_time']   = esc_html__('End Time', 'stec');
        return $fields;
    }); add_filter('stec_csv_export_proccess_event_custom_fields', function($data) {
        $case  = $data['case'];
        $event = $data['event_post'];     switch ($case) :
            case 'start_ymd' :
                $data['content'] = $event->get_start_date('Y-m-d');
                break;
            case 'start_time' :
                $data['content'] = $event->get_start_date('H:i:s');
                break;
            case 'end_ymd' :
                $data['content'] = $event->get_end_date('Y-m-d');
                break;
            case 'end_time' :
                $data['content'] = $event->get_end_date('H:i:s');
                break;
        endswitch;     return $data;
    });

    When you export your CSV you will now have 4 extra fields:

    Start YMD, End YMD, Start Time and End Time


    Stachethemes Developer

  •  1
    romain replied

    Hi,

    Thanks for this tip, you rocks !