seiya.n1987
10/9/2019 - 1:38 AM

受注リストの対応状況ステータスを増やす

<?php
/**
 * 受注リストの対応状況ステータスを増やす
 */
add_filter( 'usces_filter_management_status', 'sas_filter_management_status' , 10);
add_filter( 'usces_filter_orderlist_process_status', 'sas_filter_orderlist_process_status', 10, 4 );
add_filter( 'usces_filter_orderlist_search_process_status', 'sas_filter_orderlist_search_process_status', 10, 1 );

function sas_filter_management_status( $management_status ) {

	$management_status += array(
		'new_order'        => '新規',
		'processing_order' => '処理中',
		'hold_order'       => '保留',
		'processed_order'  => '処理済',
		'waiting_shipment' => '発送待ち',
	);

	return $management_status;
}

function sas_filter_orderlist_process_status( $p_status, $value, $management_status, $data_id ) {

	$values = explode( ',', $value );

	if( in_array( $values[0], array(
		'new_order',
		'processing_order',
		'hold_order',
		'processed_order',
		'waiting_shipment'
	) ) ) {
		$p_status = $management_status[$values[0]];
	}

	return $p_status;
}

function sas_filter_orderlist_search_process_status( $o_status ) {

    $o_status[] = '%new_order%';
    $o_status[] = '%processing_order%';
    $o_status[] = '%hold_order%';
    $o_status[] = '%processed_order%';
    $o_status[] = '%waiting_shipment%';

    return $o_status;
}