Allow external URL and button text for external products

This commit is contained in:
Claudio Sanches 2017-05-22 20:18:39 -03:00
parent 8d5f706077
commit ac304473c7
3 changed files with 10 additions and 1 deletions

View File

@ -427,6 +427,8 @@ class WC_Product_CSV_Importer_Controller {
'parent_id' => __( 'Parent', 'woocommerce' ),
'upsell_ids' => __( 'Upsells', 'woocommerce' ),
'cross_sell_ids' => __( 'Cross-sells', 'woocommerce' ),
'external_url' => __( 'External URL', 'woocommerce' ),
'button_text' => __( 'Button text', 'woocommerce' ),
) ) );
$special_columns = array_map(
array( $this, 'sanitize_special_column_name_regex' ),
@ -531,6 +533,13 @@ class WC_Product_CSV_Importer_Controller {
'parent_id' => __( 'Parent', 'woocommerce' ),
'upsell_ids' => __( 'Upsells', 'woocommerce' ),
'cross_sell_ids' => __( 'Cross-sells', 'woocommerce' ),
'external' => array(
'name' => __( 'External product', 'woocommerce' ),
'options' => array(
'external_url' => __( 'External URL', 'woocommerce' ),
'button_text' => __( 'Button text', 'woocommerce' ),
),
),
'downloads' => array(
'name' => __( 'Downloads', 'woocommerce' ),
'options' => array(

View File

@ -499,7 +499,6 @@ abstract class WC_Product_Importer implements WC_Importer_Interface {
}
// Product url and button text for external products.
// @todo
if ( $product->is_type( 'external' ) ) {
if ( isset( $data['external_url'] ) ) {
$product->set_product_url( $data['external_url'] );

View File

@ -293,6 +293,7 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
'cross_sell_ids' => array( $this, 'parse_relative_comma_field' ),
'download_limit' => 'absint',
'download_expiry' => 'absint',
'external_url' => 'esc_url',
);
/**