简体   繁体   English

WooCommerce将HTML表导出到Excel

[英]WooCommerce Export HTML Table to Excel

Hello i have this table in the WooCommerce Dashboard 您好,我在WooCommerce信息中心中有此表 在此处输入图片说明

I want to add Export to Excel Button to export the HTML Table to Excel 我想添加“导出到Excel”按钮以将HTML表导出到Excel

But the problem is how can i include a javascript file in the WooCommerce->Report in dashboard 但是问题是我如何在仪表板的WooCommerce-> Report中包含一个javascript文件

/wp-admin/admin.php?page=wc-reports&tab=reports /wp-admin/admin.php?page=wc-reports&tab=reports

I have added the below code in my functions.php file: 我在我的functions.php文件中添加了以下代码:

wp_register_script( 'zumra-reports', get_template_directory_uri() . '/js/export-to-excel.js', array('jquery'), false, true );


if ( is_page('wc-reports') ) {
    wp_enqueue_script( 'zumra-reports' );
}

but when i put any javascript it doesn't show in the WooCoomerce tab in dashboard 但是当我放置任何JavaScript时,它都不会显示在仪表板的WooCoomerce选项卡中

Use the below code: 使用以下代码:

wp_register_script( 'zumra-reports', get_template_directory_uri() . '/js/export-to-excel.js', array('jquery'), false, true );


if ( is_admin() && isset( $_GET['page'] ) && 'wc-reports' === $_GET['page'] ) {
    wp_enqueue_script( 'zumra-reports' );
}

It will add your script only on the WooCommerce Report page. 它将仅在WooCommerce报告页面上添加脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM