| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Admin; |
| 4 |
|
| 5 |
use SyncBasalam\Admin\Product\Services\ProductQueryService; |
| 6 |
use SyncBasalam\Admin\Product\Services\ProductSyncService; |
| 7 |
use SyncBasalam\Admin\Product\Services\ProductDisconnectService; |
| 8 |
|
| 9 |
defined('ABSPATH') || exit; |
| 10 |
|
| 11 |
class ProductService |
| 12 |
{ |
| 13 |
public static function enqueueAllProductsForCreation($includeOutOfStock = false, $postsPerPage = 100) |
| 14 |
{ |
| 15 |
return (new ProductSyncService())->enqueueBulkCreate($includeOutOfStock, $postsPerPage); |
| 16 |
} |
| 17 |
|
| 18 |
public static function enqueueSelectedProductsForCreation($productIds): void |
| 19 |
{ |
| 20 |
if (is_array($productIds)) (new ProductSyncService())->enqueueSelectedForCreate($productIds); |
| 21 |
} |
| 22 |
|
| 23 |
public static function getCreatableProducts($args = []): array |
| 24 |
{ |
| 25 |
return (new ProductQueryService())->getCreatableProducts($args); |
| 26 |
} |
| 27 |
|
| 28 |
public static function enqueueSelectedProductsForUpdate($productIds): void |
| 29 |
{ |
| 30 |
if (is_array($productIds)) (new ProductSyncService())->enqueueSelectedForUpdate($productIds); |
| 31 |
} |
| 32 |
|
| 33 |
public static function disconnectSelectedProducts($productIds): void |
| 34 |
{ |
| 35 |
if (is_array($productIds)) (new ProductDisconnectService())->disconnectSelected($productIds); |
| 36 |
} |
| 37 |
|
| 38 |
public static function getUpdatableProducts($args = []): array |
| 39 |
{ |
| 40 |
return (new ProductQueryService())->getUpdatableProducts($args); |
| 41 |
} |
| 42 |
|
| 43 |
public static function autoConnectAllProducts($cursor = null): void |
| 44 |
{ |
| 45 |
(new ProductSyncService())->enqueueAutoConnect($cursor); |
| 46 |
} |
| 47 |
} |
| 48 |
|