refactor(Core): optimize admin panel and refactor
This commit is contained in:
@@ -25,8 +25,8 @@ class Sodino_Rules_List_Table extends WP_List_Table {
|
||||
return [
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'name' => __('عنوان قانون', 'sodino'),
|
||||
'condition_type' => __('نوع کاربر', 'sodino'),
|
||||
'action_value' => __('درصد تخفیف', 'sodino'),
|
||||
'condition_type' => __('شرط', 'sodino'),
|
||||
'action_value' => __('عملیات', 'sodino'),
|
||||
'enabled' => __('وضعیت', 'sodino'),
|
||||
'actions' => __('عملیات', 'sodino'),
|
||||
];
|
||||
@@ -69,15 +69,30 @@ class Sodino_Rules_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
public function column_condition_type($item) {
|
||||
$value = __('کاربر جدید', 'sodino');
|
||||
if ($item->condition_value === 'returning') {
|
||||
$value = __('کاربر بازگشتی', 'sodino');
|
||||
}
|
||||
return esc_html($value);
|
||||
$labels = [
|
||||
'user_type' => __('نوع کاربر', 'sodino'),
|
||||
'product_category' => __('دستهبندی محصول', 'sodino'),
|
||||
'product_ids' => __('محصولات خاص', 'sodino'),
|
||||
'cart_total_min' => __('حداقل مبلغ سبد', 'sodino'),
|
||||
'cart_total_max' => __('حداکثر مبلغ سبد', 'sodino'),
|
||||
'cart_item_count_min' => __('حداقل تعداد سبد', 'sodino'),
|
||||
'cart_item_count_max' => __('حداکثر تعداد سبد', 'sodino'),
|
||||
];
|
||||
|
||||
$type = $labels[$item->condition_type] ?? $item->condition_type;
|
||||
return esc_html(sprintf('%s: %s', $type, $item->condition_value));
|
||||
}
|
||||
|
||||
public function column_action_value($item) {
|
||||
return sprintf('%s %%', esc_html($item->action_value));
|
||||
$labels = [
|
||||
'discount_percent' => __('درصد تخفیف', 'sodino'),
|
||||
'discount_fixed' => __('تخفیف ثابت', 'sodino'),
|
||||
'set_price' => __('قیمت ثابت', 'sodino'),
|
||||
'free_shipping' => __('ارسال رایگان', 'sodino'),
|
||||
];
|
||||
|
||||
$type = $labels[$item->action_type] ?? $item->action_type;
|
||||
return esc_html(sprintf('%s: %s', $type, $item->action_value));
|
||||
}
|
||||
|
||||
public function column_enabled($item) {
|
||||
|
||||
Reference in New Issue
Block a user