Merge pull request #15309 from woocommerce/feature/product-csv-normalize-names
Normalize importer/exporter column names
This commit is contained in:
commit
780006e9c1
|
@ -402,11 +402,11 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'published' => __( 'Published', 'woocommerce' ),
|
||||
'featured' => __( 'Is featured?', 'woocommerce' ),
|
||||
'catalog_visibility' => __( 'Visibility in catalog', 'woocommerce' ),
|
||||
'short_description' => __( 'Short Description', 'woocommerce' ),
|
||||
'short_description' => __( 'Short description', 'woocommerce' ),
|
||||
'description' => __( 'Description', 'woocommerce' ),
|
||||
'date_on_sale_from' => __( 'Date sale price starts', 'woocommerce' ),
|
||||
'date_on_sale_to' => __( 'Date sale price ends', 'woocommerce' ),
|
||||
'tax_status' => __( 'Tax Class', 'woocommerce' ),
|
||||
'tax_status' => __( 'Tax class', 'woocommerce' ),
|
||||
'stock_status' => __( 'In stock?', 'woocommerce' ),
|
||||
'stock' => __( 'Stock', 'woocommerce' ),
|
||||
'backorders' => __( 'Backorders allowed?', 'woocommerce' ),
|
||||
|
@ -416,15 +416,15 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'width' => sprintf( __( 'Width (%s)', 'woocommerce' ), $dimension_unit ),
|
||||
'height' => sprintf( __( 'Height (%s)', 'woocommerce' ), $dimension_unit ),
|
||||
'reviews_allowed' => __( 'Allow customer reviews?', 'woocommerce' ),
|
||||
'purchase_note' => __( 'Purchase Note', 'woocommerce' ),
|
||||
'sale_price' => __( 'Sale Price', 'woocommerce' ),
|
||||
'regular_price' => __( 'Regular Price', 'woocommerce' ),
|
||||
'purchase_note' => __( 'Purchase note', 'woocommerce' ),
|
||||
'sale_price' => __( 'Sale price', 'woocommerce' ),
|
||||
'regular_price' => __( 'Regular price', 'woocommerce' ),
|
||||
'category_ids' => __( 'Categories', 'woocommerce' ),
|
||||
'tag_ids' => __( 'Tags', 'woocommerce' ),
|
||||
'shipping_class_id' => __( 'Shipping Class', 'woocommerce' ),
|
||||
'shipping_class_id' => __( 'Shipping class', 'woocommerce' ),
|
||||
'image_id' => __( 'Images', 'woocommerce' ),
|
||||
'download_limit' => __( 'Download Limit', 'woocommerce' ),
|
||||
'download_expiry' => __( 'Download Expiry Days', 'woocommerce' ),
|
||||
'download_limit' => __( 'Download limit', 'woocommerce' ),
|
||||
'download_expiry' => __( 'Download expiry days', 'woocommerce' ),
|
||||
'parent_id' => __( 'Parent', 'woocommerce' ),
|
||||
'upsell_ids' => __( 'Upsells', 'woocommerce' ),
|
||||
'cross_sell_ids' => __( 'Cross-sells', 'woocommerce' ),
|
||||
|
@ -436,11 +436,11 @@ class WC_Product_CSV_Importer_Controller {
|
|||
array( $this, 'sanitize_special_column_name_regex' ),
|
||||
apply_filters( 'woocommerce_csv_product_import_mapping_special_columns',
|
||||
array(
|
||||
'attributes:name' => __( 'Attribute %d Name', 'woocommerce' ),
|
||||
'attributes:value' => __( 'Attribute %d Value(s)', 'woocommerce' ),
|
||||
'attributes:visible' => __( 'Attribute %d Visible', 'woocommerce' ),
|
||||
'attributes:default' => __( 'Attribute %d Default', 'woocommerce' ),
|
||||
'downloads:name' => __( 'Download %d Name', 'woocommerce' ),
|
||||
'attributes:name' => __( 'Attribute %d name', 'woocommerce' ),
|
||||
'attributes:value' => __( 'Attribute %d value(s)', 'woocommerce' ),
|
||||
'attributes:visible' => __( 'Attribute %d visible', 'woocommerce' ),
|
||||
'attributes:default' => __( 'Attribute %d default', 'woocommerce' ),
|
||||
'downloads:name' => __( 'Download %d name', 'woocommerce' ),
|
||||
'downloads:url' => __( 'Download %d URL', 'woocommerce' ),
|
||||
'meta:' => __( 'Meta: %s', 'woocommerce' ),
|
||||
)
|
||||
|
@ -505,12 +505,12 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'published' => __( 'Published', 'woocommerce' ),
|
||||
'featured' => __( 'Is featured?', 'woocommerce' ),
|
||||
'catalog_visibility' => __( 'Visibility in catalog', 'woocommerce' ),
|
||||
'short_description' => __( 'Short Description', 'woocommerce' ),
|
||||
'short_description' => __( 'Short description', 'woocommerce' ),
|
||||
'description' => __( 'Description', 'woocommerce' ),
|
||||
'date_on_sale_from' => __( 'Date sale price starts', 'woocommerce' ),
|
||||
'date_on_sale_to' => __( 'Date sale price ends', 'woocommerce' ),
|
||||
'tax_status' => __( 'Tax Status', 'woocommerce' ),
|
||||
'tax_class' => __( 'Tax Class', 'woocommerce' ),
|
||||
'tax_status' => __( 'Tax status', 'woocommerce' ),
|
||||
'tax_class' => __( 'Tax class', 'woocommerce' ),
|
||||
'stock_status' => __( 'In stock?', 'woocommerce' ),
|
||||
'backorders' => __( 'Backorders allowed?', 'woocommerce' ),
|
||||
'sold_individually' => __( 'Sold individually?', 'woocommerce' ),
|
||||
|
@ -528,13 +528,13 @@ class WC_Product_CSV_Importer_Controller {
|
|||
),
|
||||
),
|
||||
'reviews_allowed' => __( 'Allow customer reviews?', 'woocommerce' ),
|
||||
'purchase_note' => __( 'Purchase Note', 'woocommerce' ),
|
||||
'sale_price' => __( 'Sale Price', 'woocommerce' ),
|
||||
'purchase_note' => __( 'Purchase note', 'woocommerce' ),
|
||||
'sale_price' => __( 'Sale price', 'woocommerce' ),
|
||||
'regular_price' => __( 'Regular Price', 'woocommerce' ),
|
||||
'stock' => __( 'Stock', 'woocommerce' ),
|
||||
'category_ids' => __( 'Categories', 'woocommerce' ),
|
||||
'tag_ids' => __( 'Tags', 'woocommerce' ),
|
||||
'shipping_class_id' => __( 'Shipping Class', 'woocommerce' ),
|
||||
'shipping_class_id' => __( 'Shipping class', 'woocommerce' ),
|
||||
'image_id' => __( 'Images', 'woocommerce' ),
|
||||
'parent_id' => __( 'Parent', 'woocommerce' ),
|
||||
'upsell_ids' => __( 'Upsells', 'woocommerce' ),
|
||||
|
@ -549,10 +549,10 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'downloads' => array(
|
||||
'name' => __( 'Downloads', 'woocommerce' ),
|
||||
'options' => array(
|
||||
'downloads:name' . $index => __( 'Download Name', 'woocommerce' ),
|
||||
'downloads:name' . $index => __( 'Download name', 'woocommerce' ),
|
||||
'downloads:url' . $index => __( 'Download URL', 'woocommerce' ),
|
||||
'download_limit' => __( 'Download Limit', 'woocommerce' ),
|
||||
'download_expiry' => __( 'Download Expiry Days', 'woocommerce' ),
|
||||
'download_limit' => __( 'Download limit', 'woocommerce' ),
|
||||
'download_expiry' => __( 'Download expiry days', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
'attributes' => array(
|
||||
|
|
|
@ -84,11 +84,11 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
|||
'published' => __( 'Published', 'woocommerce' ),
|
||||
'featured' => __( 'Is featured?', 'woocommerce' ),
|
||||
'catalog_visibility' => __( 'Visibility in catalog', 'woocommerce' ),
|
||||
'short_description' => __( 'Short Description', 'woocommerce' ),
|
||||
'short_description' => __( 'Short description', 'woocommerce' ),
|
||||
'description' => __( 'Description', 'woocommerce' ),
|
||||
'date_on_sale_from' => __( 'Date sale price starts', 'woocommerce' ),
|
||||
'date_on_sale_to' => __( 'Date sale price ends', 'woocommerce' ),
|
||||
'tax_status' => __( 'Tax Class', 'woocommerce' ),
|
||||
'tax_status' => __( 'Tax class', 'woocommerce' ),
|
||||
'stock_status' => __( 'In stock?', 'woocommerce' ),
|
||||
'stock' => __( 'Stock', 'woocommerce' ),
|
||||
'backorders' => __( 'Backorders allowed?', 'woocommerce' ),
|
||||
|
@ -98,15 +98,15 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
|||
'width' => sprintf( __( 'Width (%s)', 'woocommerce' ), get_option( 'woocommerce_dimension_unit' ) ),
|
||||
'height' => sprintf( __( 'Height (%s)', 'woocommerce' ), get_option( 'woocommerce_dimension_unit' ) ),
|
||||
'reviews_allowed' => __( 'Allow customer reviews?', 'woocommerce' ),
|
||||
'purchase_note' => __( 'Purchase Note', 'woocommerce' ),
|
||||
'sale_price' => __( 'Sale Price', 'woocommerce' ),
|
||||
'regular_price' => __( 'Regular Price', 'woocommerce' ),
|
||||
'purchase_note' => __( 'Purchase note', 'woocommerce' ),
|
||||
'sale_price' => __( 'Sale price', 'woocommerce' ),
|
||||
'regular_price' => __( 'Regular price', 'woocommerce' ),
|
||||
'category_ids' => __( 'Categories', 'woocommerce' ),
|
||||
'tag_ids' => __( 'Tags', 'woocommerce' ),
|
||||
'shipping_class_id' => __( 'Shipping Class', 'woocommerce' ),
|
||||
'shipping_class_id' => __( 'Shipping class', 'woocommerce' ),
|
||||
'images' => __( 'Images', 'woocommerce' ),
|
||||
'download_limit' => __( 'Download Limit', 'woocommerce' ),
|
||||
'download_expiry' => __( 'Download Expiry Days', 'woocommerce' ),
|
||||
'download_limit' => __( 'Download limit', 'woocommerce' ),
|
||||
'download_expiry' => __( 'Download expiry days', 'woocommerce' ),
|
||||
'parent_id' => __( 'Parent', 'woocommerce' ),
|
||||
'upsell_ids' => __( 'Upsells', 'woocommerce' ),
|
||||
'cross_sell_ids' => __( 'Cross-sells', 'woocommerce' ),
|
||||
|
@ -411,7 +411,7 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
|||
if ( $downloads ) {
|
||||
$i = 1;
|
||||
foreach ( $downloads as $download ) {
|
||||
$this->column_names[ 'downloads:name' . $i ] = sprintf( __( 'Download %d Name', 'woocommerce' ), $i );
|
||||
$this->column_names[ 'downloads:name' . $i ] = sprintf( __( 'Download %d name', 'woocommerce' ), $i );
|
||||
$this->column_names[ 'downloads:url' . $i ] = sprintf( __( 'Download %d URL', 'woocommerce' ), $i );
|
||||
$row[ 'downloads:name' . $i ] = $download->get_name();
|
||||
$row[ 'downloads:url' . $i ] = $download->get_file();
|
||||
|
@ -436,8 +436,8 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
|||
if ( count( $attributes ) ) {
|
||||
$i = 1;
|
||||
foreach ( $attributes as $attribute_name => $attribute ) {
|
||||
$this->column_names[ 'attributes:name' . $i ] = sprintf( __( 'Attribute %d Name', 'woocommerce' ), $i );
|
||||
$this->column_names[ 'attributes:value' . $i ] = sprintf( __( 'Attribute %d Value(s)', 'woocommerce' ), $i );
|
||||
$this->column_names[ 'attributes:name' . $i ] = sprintf( __( 'Attribute %d name', 'woocommerce' ), $i );
|
||||
$this->column_names[ 'attributes:value' . $i ] = sprintf( __( 'Attribute %d value(s)', 'woocommerce' ), $i );
|
||||
|
||||
if ( is_a( $attribute, 'WC_Product_Attribute' ) ) {
|
||||
$row[ 'attributes:name' . $i ] = wc_attribute_label( $attribute->get_name(), $product );
|
||||
|
@ -466,7 +466,7 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
|||
}
|
||||
|
||||
if ( $product->is_type( 'variable' ) && isset( $default_attributes[ sanitize_title( $attribute_name ) ] ) ) {
|
||||
$this->column_names[ 'attributes:default' . $i ] = sprintf( __( 'Attribute %d Default', 'woocommerce' ), $i );
|
||||
$this->column_names[ 'attributes:default' . $i ] = sprintf( __( 'Attribute %d default', 'woocommerce' ), $i );
|
||||
$default_value = $default_attributes[ sanitize_title( $attribute_name ) ];
|
||||
|
||||
if ( 0 === strpos( $attribute_name, 'pa_' ) ) {
|
||||
|
|
Loading…
Reference in New Issue