From 8df8c9b482e5d2aa60848bc0a370b916e1228241 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 19 Dec 2014 17:58:49 +0000 Subject: [PATCH] Make 'public', and rewrite, optional for attributes #6852 --- includes/admin/class-wc-admin-attributes.php | 29 ++++++-- includes/admin/class-wc-admin-importers.php | 2 +- includes/class-wc-install.php | 1 + includes/class-wc-post-types.php | 72 ++++++++++--------- .../helpers/class-wc-helper-product.php | 1 + 5 files changed, 64 insertions(+), 41 deletions(-) diff --git a/includes/admin/class-wc-admin-attributes.php b/includes/admin/class-wc-admin-attributes.php index bcfeec403bd..649eadfa65c 100644 --- a/includes/admin/class-wc-admin-attributes.php +++ b/includes/admin/class-wc-admin-attributes.php @@ -51,10 +51,11 @@ class WC_Admin_Attributes { } // Grab the submitted data - $attribute_label = ( isset( $_POST['attribute_label'] ) ) ? (string) stripslashes( $_POST['attribute_label'] ) : ''; - $attribute_name = ( isset( $_POST['attribute_name'] ) ) ? wc_sanitize_taxonomy_name( stripslashes( (string) $_POST['attribute_name'] ) ) : ''; - $attribute_type = ( isset( $_POST['attribute_type'] ) ) ? (string) stripslashes( $_POST['attribute_type'] ) : ''; - $attribute_orderby = ( isset( $_POST['attribute_orderby'] ) ) ? (string) stripslashes( $_POST['attribute_orderby'] ) : ''; + $attribute_label = isset( $_POST['attribute_label'] ) ? (string) stripslashes( $_POST['attribute_label'] ) : ''; + $attribute_name = isset( $_POST['attribute_name'] ) ? wc_sanitize_taxonomy_name( stripslashes( (string) $_POST['attribute_name'] ) ) : ''; + $attribute_type = isset( $_POST['attribute_type'] ) ? (string) stripslashes( $_POST['attribute_type'] ) : ''; + $attribute_orderby = isset( $_POST['attribute_orderby'] ) ? (string) stripslashes( $_POST['attribute_orderby'] ) : ''; + $attribute_public = isset( $_POST['attribute_public'] ) ? 1 : 0; // Auto-generate the label or slug if only one of both was provided if ( ! $attribute_label ) { @@ -112,6 +113,7 @@ class WC_Admin_Attributes { 'attribute_name' => $attribute_name, 'attribute_type' => $attribute_type, 'attribute_orderby' => $attribute_orderby, + 'attribute_public' => $attribute_public ); $wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute ); @@ -129,6 +131,7 @@ class WC_Admin_Attributes { 'attribute_name' => $attribute_name, 'attribute_type' => $attribute_type, 'attribute_orderby' => $attribute_orderby, + 'attribute_public' => $attribute_public ); $wpdb->update( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute, array( 'attribute_id' => $attribute_id ) ); @@ -232,6 +235,7 @@ class WC_Admin_Attributes { $att_label = $attribute_to_edit->attribute_label; $att_name = $attribute_to_edit->attribute_name; $att_orderby = $attribute_to_edit->attribute_orderby; + $att_public = $attribute_to_edit->attribute_public; ?>

@@ -257,6 +261,15 @@ class WC_Admin_Attributes {

+ + + + + + /> +

+ + @@ -329,7 +342,7 @@ class WC_Admin_Attributes {
|
attribute_name ); ?> - attribute_type ) ); ?> + attribute_type ) ); ?> attribute_public ? '(' . __( 'Public', 'woocommerce' ) . ')' : ''; ?> attribute_orderby ) { case 'name' : @@ -400,6 +413,12 @@ class WC_Admin_Attributes {

+
+ + +

+
+