| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Admin\Product\elements\ProductList; |
| 4 |
|
| 5 |
use SyncBasalam\Admin\Components\ProductListComponents; |
| 6 |
use SyncBasalam\Utilities\ProductMetaKey; |
| 7 |
|
| 8 |
defined('ABSPATH') || exit; |
| 9 |
class StatusColumn |
| 10 |
{ |
| 11 |
public static function registerStatusColumn($columns) |
| 12 |
{ |
| 13 |
$newColumns = []; |
| 14 |
foreach ($columns as $key => $value) { |
| 15 |
$newColumns[$key] = $value; |
| 16 |
if ($key === 'price') { |
| 17 |
$newColumns['sync_basalam_status'] = 'وضعیت � |
| 18 |
حصول'; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
return $newColumns; |
| 23 |
} |
| 24 |
|
| 25 |
public static function renderStatusColumnContent($column, $productId) |
| 26 |
{ |
| 27 |
if ($column === 'sync_basalam_status') { |
| 28 |
$product = get_post_meta($productId, ProductMetaKey::basalamProductSyncStatus(), true); |
| 29 |
if ($product && $product == 'synced') { |
| 30 |
ProductListComponents::renderSyncProductStatusSynced(); |
| 31 |
} elseif ($product == 'pending') { |
| 32 |
ProductListComponents::renderSyncProductStatusPending(); |
| 33 |
} else { |
| 34 |
ProductListComponents::renderSyncProductStatusUnsync(); |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
|