Viewing 1 replies (of 1 total)
  • Plugin Author algol.plus

    (@algolplus)

    hello

    we don’t code user interface for conditional fields yet, it’s a complex thing.

    could you add following lines to functions.php and review results?

    //1. add fields to  section "Setup Fields"
    add_filter('woe_get_order_fields', 'woe_func_add_order_fields');
    function woe_func_add_order_fields($fields) {
    	$fields['payment_method_custom_id'] = array( 'label' => 'Payment Method Id', 'colname' => 'Payment Method Id', 'segment' => 'common', 'checked' => 1 );
    	return $fields;
    }
    
    //2. prepare field for xls,csv
    add_filter('woe_get_order_xls_value_payment_method_custom_id', 'woe_get_value_payment_method_custom_id', 10, 2);
    add_filter('woe_get_order_csv_value_payment_method_custom_id', 'woe_get_value_payment_method_custom_id', 10, 2);
    function woe_get_value_payment_method_custom_id($value,$obj_order) {
    	if($obj_order->payment_method_title == "Direct Bank Transfer")
    		return 1;
    	else if($obj_order->payment_method_title == "Cash on Delivery")
    		return 2;
    	else
    		return 0;
    }

    thanks, alex

Viewing 1 replies (of 1 total)
  • The topic ‘add condition to field’ is closed to new replies.