PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.10.19
ووسلام – همگام سازی ووکامرس و باسلام v1.10.19
1.10.19 1.10.20 1.10.18 1.10.17 1.10.15 1.10.14 1.10.13 1.10.12 1.10.10 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.2 1.9.1 1.9.0 1.8.8 1.8.5 1.8.6 All 53 releases
← All changes | includes/Admin/Product/Operations/UpdateProduct.php +11 -4 1.9.21.10.19 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2
3 3 namespace SyncBasalam\Admin\Product\Operations;
4 4
@@ -5,9 +5,11 @@
5 5 use SyncBasalam\Admin\Product\Operations\AbstractProductOperation;
6 6 use SyncBasalam\Services\Products\UpdateSingleProductService;
7 7 use SyncBasalam\Admin\Product\Data\ProductDataFacade;
8 8 use SyncBasalam\Logger\Logger;
9 -use SyncBasalam\Services\Products\Discount\DiscountTaskProcessor;
9 +use SyncBasalam\Services\Products\Discount\DiscountTaskProcessor;
10 +use SyncBasalam\Jobs\Exceptions\NonRetryableException;
11 +use SyncBasalam\Services\VendorSyncPolicy;
10 12
11 13 defined('ABSPATH') || exit;
12 14
13 15 class UpdateProduct extends AbstractProductOperation
@@ -25,11 +27,16 @@
25 27 $this->discountProcessor = $discountProcessor ?: syncBasalamContainer()->get(DiscountTaskProcessor::class);
26 28 }
27 29
28 30
29 - protected function run(int $productId, array $args = []): array
30 - {
31 - $categoryIds = $args['category_ids'] ?? null;
31 + protected function run(int $productId, array $args = []): array
32 + {
33 + $vendorSyncPolicy = syncBasalamContainer()->get(VendorSyncPolicy::class);
34 + if (!$vendorSyncPolicy->canUpdate()) {
35 + throw NonRetryableException::invalidData($vendorSyncPolicy->getRestrictionMessage(false));
36 + }
37 +
38 + $categoryIds = $args['category_ids'] ?? null;
32 39
33 40 $productData = ProductDataFacade::get($productId, $categoryIds);
34 41
35 42 $updateResult = $this->updateProductService->updateProductInBasalam($productData, $productId);