Custom Fields
Re-Envisioned
Support General Taxonomy Advanced Values not saving correctly

  • Creator
    Topic
  • #6723
    thomassultana
    Participant

    Hi, 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″;}

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #6724
    thomassultana
    Participant

    Here is some screenshots:

    Before i save:
    Screen Shot 2017 08 22 at 19 03 48

    After i save:
    Screen Shot 2017 08 22 at 19 03 41

    #6728
    Truong Giang
    Participant

    Hi there,

    Can you give me the code you use to register meta box?

    #6746
    thomassultana
    Participant

    i 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;
    
    }
    #6789
    thomassultana
    Participant

    Any updates please?

    #6790
    Truong Giang
    Participant

    Hi 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?

    #6813
    thomassultana
    Participant

    Meta Box 4.12.3
    MB Term Meta 1.2
    Meta Box Columns 1.1
    Meta Box Updater 1.1.4

    #6814
    Truong Giang
    Participant

    Hi,

    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 support@metabox.io

    Thank you very much.

    #6834
    Truong Giang
    Participant

    I 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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Taxonomy Advanced Values not saving correctly’ is closed to new replies.