Added support "Attribute %d Visible"
This commit is contained in:
parent
2c5c0133f3
commit
c08d3a356e
|
@ -438,6 +438,7 @@ class WC_Product_CSV_Importer_Controller {
|
|||
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' ),
|
||||
'downloads:url' => __( 'Download %d URL', 'woocommerce' ),
|
||||
|
@ -555,8 +556,9 @@ class WC_Product_CSV_Importer_Controller {
|
|||
'attributes' => array(
|
||||
'name' => __( 'Attributes', 'woocommerce' ),
|
||||
'options' => array(
|
||||
'attributes:name' . $index => __( 'Attributes name', 'woocommerce' ),
|
||||
'attributes:value' . $index => __( 'Attributes value', 'woocommerce' ),
|
||||
'attributes:name' . $index => __( 'Attribute name', 'woocommerce' ),
|
||||
'attributes:value' . $index => __( 'Attribute value(s)', 'woocommerce' ),
|
||||
'attributes:visible' . $index => __( 'Attribute visibility', 'woocommerce' ),
|
||||
'attributes:default' . $index => __( 'Default attribute', 'woocommerce' ),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -323,9 +323,10 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
* Match special column names.
|
||||
*/
|
||||
$regex_match_data_formatting = array(
|
||||
'/attributes:value*/' => array( $this, 'parse_comma_field' ),
|
||||
'/downloads:url*/' => 'esc_url',
|
||||
'/meta:*/' => 'wp_kses_post', // Allow some HTML in meta fields.
|
||||
'/attributes:value*/' => array( $this, 'parse_comma_field' ),
|
||||
'/attributes:visible*/' => array( $this, 'parse_bool_field' ),
|
||||
'/downloads:url*/' => 'esc_url',
|
||||
'/meta:*/' => 'wp_kses_post', // Allow some HTML in meta fields.
|
||||
);
|
||||
|
||||
$callbacks = array();
|
||||
|
@ -419,6 +420,13 @@ class WC_Product_CSV_Importer extends WC_Product_Importer {
|
|||
|
||||
unset( $data[ $key ] );
|
||||
}
|
||||
if ( $this->starts_with( $key, 'attributes:visible' ) ) {
|
||||
if ( ! empty( $value ) ) {
|
||||
$data['attributes'][ str_replace( 'attributes:visible', '', $key ) ]['visible'] = $value;
|
||||
}
|
||||
|
||||
unset( $data[ $key ] );
|
||||
}
|
||||
|
||||
// Default attributes
|
||||
if ( $this->starts_with( $key, 'attributes:default' ) ) {
|
||||
|
|
Loading…
Reference in New Issue