Only run save_category_fields for product_cat taxonomy.

Closes #7665
This commit is contained in:
Mike Jolley 2015-03-09 11:29:14 +00:00
parent fa0be55b01
commit 66e6c682ed
2 changed files with 6 additions and 6 deletions

View File

@ -30,8 +30,8 @@ class WC_Admin_Taxonomies {
// Add form
add_action( 'product_cat_add_form_fields', array( $this, 'add_category_fields' ) );
add_action( 'product_cat_edit_form_fields', array( $this, 'edit_category_fields' ), 10 );
add_action( 'created_term', array( $this, 'save_category_fields' ), 10 );
add_action( 'edit_term', array( $this, 'save_category_fields' ), 10 );
add_action( 'created_term', array( $this, 'save_category_fields' ), 10, 3 );
add_action( 'edit_term', array( $this, 'save_category_fields' ), 10, 3 );
// Add columns
add_filter( 'manage_edit-product_cat_columns', array( $this, 'product_cat_columns' ) );
@ -249,12 +249,11 @@ class WC_Admin_Taxonomies {
*
* @param mixed $term_id Term ID being saved
*/
public function save_category_fields( $term_id ) {
if ( isset( $_POST['display_type'] ) ) {
public function save_category_fields( $term_id, $tt_id = '', $taxonomy = '' ) {
if ( isset( $_POST['display_type'] ) && 'product_cat' === $taxonomy ) {
update_woocommerce_term_meta( $term_id, 'display_type', esc_attr( $_POST['display_type'] ) );
}
if ( isset( $_POST['product_cat_thumbnail_id'] ) ) {
if ( isset( $_POST['product_cat_thumbnail_id'] ) && 'product_cat' === $taxonomy ) {
update_woocommerce_term_meta( $term_id, 'thumbnail_id', absint( $_POST['product_cat_thumbnail_id'] ) );
}
}

View File

@ -151,6 +151,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Tweak - Prevent cart being cleared when accessing the login page.
* Tweak - Shipping calculator - Made state/postcode respect country locale like checkout.
* Tweak - Move default customer location to general settings tab.
* Tweak - Only run save_category_fields for product_cat taxonomy.
= 2.3.5 - 20/02/2015 =
* Fix - Plain text address formatting.