Support » Plugin: WooCommerce Simply Order Export » WooCommerce TM Extra Product Options are not exporting to csv file

  • Hi, I am using the plugin WooCommerce TM Extra Product Options on my WP / Woocommerce site, along with your export.
    The export functions of your plugin are working great,
    However, the Extra Options (in this case class #’s / details) are not showing up on export.

    Can you or anyone point me in the right direction as to how to fix/ achieve this?
    Or another plugin that would do this?
    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author wpgurudev

    (@wpgurudev)

    Hi,

    Thanks for contacting support forum.

    You’ve mentioned that the data from TM Extra Options is not being exported, we can surely export this data either by custom fields section (if data is getting saved in postmeta table) OR by little bit of custom code, but for this you’ll need couple of things.

    1. I’ve to take a look at the plugin to check how the targeted data is being stored in the database. For the same, could you please provide me temporary access to your site? You can send me credentials via contact for here.

    2. You’ll need WooCommerce Simply Order Export plugin to accommodate that data in export.

    Hi Ankit, I already have WooCommerce Simply Order Export installed.
    What level of access do you need?

    Plugin Author wpgurudev

    (@wpgurudev)

    Hi,

    Sorry if I was not clear at first place.

    I was asking for wp-admin and FTP details of the site, so that I can investigate the issue.

    Please let me know if this is fine.

    Regards,
    Ankit

    I contacted you via your form. Thanks again.

    I see that you logged in, Do you think it’s doable?

    Hi !
    I’d also like those fields to be exported. Did you find a solution ?
    Thanks !

    • This reply was modified 2 years, 8 months ago by tameroski.

    Hello,

    Did you find a solution ?

    I use tm extra option but i can’t find any solution to export in CSV file. I only have normal woocommerce export.

    I managed to display TM options in the csv export by using the following code. But be warned that i only made it compatible with v2.1.6 / Woocommerce 2.6.14. This may require some adaptations for WC 3 :

    /************************************/
    /* Export des options des commandes */
    /************************************/
    
    // Hooks
    function rdm_hook() {
        add_filter( 'wpg_order_columns', 'rdm_columns' );
        add_filter( 'wpg_export_options_settings', 'rdm_columns_settings' );
    }
    add_action( 'init', 'rdm_hook', 9 );
    
    // Add column to check for options
    function rdm_columns( $columns ) {
        $columns['wc_settings_tab_order_options'] = 'Options';
    
        return $columns;
    }
    
    // Add column in CSV
    function rdm_columns_settings( $settings ) {
        
        update_option( 'wc_settings_tab_order_options', 'yes');
    
        $settings['options'] = array(
            'name' => 'Options',
            'type' => 'checkbox',
            'desc' => 'Order Options',
            'id' => 'wc_settings_tab_order_options'
        );
    
        return $settings;
    }
    
    // Add options values in CSV
    add_action('wpg_add_values_to_csv', 'rdm_add_values_to_csv');
    function rdm_add_values_to_csv( &$csv ) {
    
        $order_id = $csv[0];
        $order = new WC_Order( $order_id );
    
        $items = $order->get_items();
        $result = "-";
    
        foreach ( $items as $item_id => $item ){
                
            $item_meta = function_exists('wc_get_order_item_meta')?wc_get_order_item_meta( $item_id, '',false ):$order->get_item_meta( $item_id );
    
            $has_epo = is_array($item_meta) && isset($item_meta['_tmcartepo_data']) && isset($item_meta['_tmcartepo_data'][0]);
            
            if ($has_epo){
                $epos = maybe_unserialize($item_meta['_tmcartepo_data'][0]);
    
                if (is_array($epos)){
                    
                    $result = "";
                    foreach ($epos as $epo) {
                        $result .= $epo['name'] . " : " . $epo['value'] . "\n";
                    }
    
                }
            }
        }
        
        // Decoding HTML
        $result = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $result);
    
        array_push($csv, '"'.$result.'"');
    }

    @tameroski Thanks for the code. It’s working 100% with Woocommerce Version 3.2.2 as well. No edits to above code needed!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WooCommerce TM Extra Product Options are not exporting to csv file’ is closed to new replies.