Import and export buttons

This commit is contained in:
Mike Jolley 2017-05-16 15:06:22 +01:00
parent 6949ee162e
commit 74e2f61f0c
3 changed files with 16 additions and 6 deletions

View File

@ -1,10 +1,13 @@
/* global woocommerce_admin */
/**
* WooCommerce Admin JS
*/
jQuery( function ( $ ) {
// Add buttons to product screen.
var $product_screen = $( '.edit-php.post-type-product' ),
$title_action = $product_screen.find( '.page-title-action:first' );
$title_action.after( '<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>' );
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
// Field validation error tips
$( document.body )

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,6 @@ class WC_Admin_Assets {
/**
* @deprecated 2.3
*/
if ( has_action( 'woocommerce_admin_css' ) ) {
do_action( 'woocommerce_admin_css' );
wc_deprecated_function( 'The woocommerce_admin_css action', '2.3', 'admin_enqueue_scripts' );
@ -155,6 +154,14 @@ class WC_Admin_Assets {
'i18_sale_less_than_regular_error' => __( 'Please enter in a value less than the regular price.', 'woocommerce' ),
'decimal_point' => $decimal,
'mon_decimal_point' => wc_get_price_decimal_separator(),
'strings' => array(
'import_products' => __( 'Import', 'woocommerce' ),
'export_products' => __( 'Export', 'woocommerce' ),
),
'urls' => array(
'import_products' => esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_importer' ) ),
'export_products' => esc_url_raw( admin_url( 'edit.php?post_type=product&page=product_exporter' ) ),
),
);
wp_localize_script( 'woocommerce_admin', 'woocommerce_admin', $params );