Taxonomy Advanced Values not saving correctly
- This topic has 8 replies, 2 voices, and was last updated 7 years, 7 months ago by
Truong Giang.
-
AuthorPosts
-
August 23, 2017 at 12:00 AM #6723
thomassultana
ParticipantHi, Im having an issue with taxonomy_advanced and select_tree. Seems like the data is being saved however when viewing the meta box after save the lower level tree values are not being displayed. I checked this issue and it seems like data is being saved as a:1:{i:0;s:7:"82,,431";}
August 23, 2017 at 12:06 AM #6724thomassultana
ParticipantAugust 23, 2017 at 9:06 AM #6728Truong Giang
ParticipantHi there,
Can you give me the code you use to register meta box?
August 24, 2017 at 1:14 AM #6746thomassultana
Participanti have meta box columns plugin installed.
add_filter( 'rwmb_meta_boxes', 'wba_restrictions_meta_boxes' ); function wba_restrictions_meta_boxes( $meta_boxes ) { $prefix = WBA_MB_PREFIX; $countries = new WC_Countries(); $states = $countries->get_states('US'); // 1st meta box $meta_boxes[] = array( 'id' => 'restriction_targeting', 'title' => esc_html__( 'Targeting', 'your-prefix' ), 'post_types' => array( 'restrictions' ), // List of meta fields 'fields' => array( array( 'name' => esc_html__( 'States', 'your-prefix' ), 'desc' => esc_html__( 'Target specific states in this rule.', 'your-prefix' ), 'id' => $prefix . 'states', 'type' => 'select_advanced', 'multiple' => true, 'options' => $states, //'columns' => 6 ), array( 'name' => esc_html__( 'Cities', 'your-prefix' ), 'id' => $prefix . 'cities', 'type' => 'post', 'post_type' => 'cities', 'field_type' => 'select_advanced', 'multiple' => true, 'placeholder' => esc_html__( 'Select one or more cities', 'your-prefix' ), 'query_args' => array( 'post_status' => 'publish', 'posts_per_page' => - 1, ), //'columns' => 6 ), array( 'name' => esc_html__( 'Category', 'your-prefix' ), 'id' => $prefix . 'category', 'type' => 'taxonomy_advanced', 'taxonomy' => 'product_cat', 'clone' => true, // How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional 'field_type' => 'select_tree', 'query_args' => array(), ), array( 'name' => esc_html__( 'Attribute', 'your-prefix' ), 'desc' => esc_html__( 'Select the attribute you want to target, and then the attribute value.', 'your-prefix' ), 'id' => $prefix . 'attribute', 'type' => 'select_advanced', 'options' => array( 'todo' => 'TODO', ), 'columns' => 4 ), array( 'name' => esc_html__( 'Condition', 'your-prefix' ), 'desc' => esc_html__( 'Select the attribute you want to target, and then the attribute value.', 'your-prefix' ), 'id' => $prefix . 'attribute', 'type' => 'select_advanced', 'options' => array( '=' => 'Equal', '!=' => 'Not Equal', '>=' => 'Greater Than or Equal', '>' => 'Greater Than', '<=' => 'Less Than or Equal', '<' => 'Less Than', '%' => 'LIKE', ), 'columns' => 4 ), array( 'name' => esc_html__( 'Attribute Value', 'your-prefix' ), 'desc' => esc_html__( 'Type in the attribute value you want to target', 'your-prefix' ), 'id' => $prefix . 'attribute_value', 'type' => 'text', 'columns' => 4 ), array( 'name' => esc_html__( 'Product Title Phrase', 'your-prefix' ), 'desc' => esc_html__( 'target specific products that have this phrase in the title', 'your-prefix' ), 'id' => $prefix . 'title_phrase', 'type' => 'text', ), ), ); $meta_boxes[] = array( 'id' => 'restriction_action_messages', 'title' => esc_html__( 'Action Messages', 'your-prefix' ), 'post_types' => array( 'restrictions' ), // List of meta fields 'fields' => array( array( 'name' => esc_html__( 'Cart Message', 'your-prefix' ), 'desc' => esc_html__( 'Display a specific message on the cart below the matching product.', 'your-prefix' ), 'id' => $prefix . 'cart_message', 'type' => 'textarea', 'rows' => 4, ), array( 'name' => esc_html__( 'Checkout Message', 'your-prefix' ), 'desc' => esc_html__( 'Display a specific message on the checkout below the matching product.', 'your-prefix' ), 'id' => $prefix . 'checkout_message', 'type' => 'textarea', 'rows' => 4, ), ), ); $meta_boxes[] = array( 'id' => 'restriction_actions', 'title' => esc_html__( 'Action', 'your-prefix' ), 'post_types' => array( 'restrictions' ), // List of meta fields 'fields' => array( array( 'name' => esc_html__( 'Perform Following Action', 'your-prefix' ), 'desc' => esc_html__( 'Please select the action that will be triggered on the checkout process.', 'your-prefix' ), 'id' => $prefix . 'action', 'type' => 'radio', 'options' => array( 'disallow_purchase' => 'Disallow Purchase', 'foid_card_required' => 'FOID Card Required', 'ffl_dealer_form' => 'FFL Dealer Form', ) ), ), ); return $meta_boxes; }
August 29, 2017 at 8:44 PM #6789thomassultana
ParticipantAny updates please?
August 30, 2017 at 9:10 AM #6790Truong Giang
ParticipantHi there,
Sorry for late. I have already checked with your code but it works. And meta box doesn't look like your screenshot. Which version of meta box and extensions are you using?
August 30, 2017 at 12:45 PM #6813thomassultana
ParticipantMeta Box 4.12.3
MB Term Meta 1.2
MB Columns 1.1
Meta Box Updater 1.1.4August 30, 2017 at 3:10 PM #6814Truong Giang
ParticipantHi,
I checked again and again but can't find the problem. Can you share your credential for us to check it? If yes, please send the credential to [email protected]
Thank you very much.
August 31, 2017 at 10:53 AM #6834Truong Giang
ParticipantI received your information. Please wait for me to check it. Thank you.
UPDATE: I fixed the problem. Please get latest version of meta box from github. This is the change: https://github.com/rilwis/meta-box/commit/478fed2fff7ba4396e57f328598e338013fe142f
Thank you very much.
-
AuthorPosts
- The topic ‘Taxonomy Advanced Values not saving correctly’ is closed to new replies.