PluginProbe
ووسلام – همگام سازی ووکامرس و باسلام / 1.9.0
ووسلام – همگام سازی ووکامرس و باسلام v1.9.0
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
sync-basalam / includes / Admin / Product / Data / Strategies / QuickUpdateProductStrategy.php

QuickUpdateProductStrategy.php in ووسلام – همگام سازی ووکامرس و باسلام 1.9.0, at includes/Admin/Product/Data/Strategies/QuickUpdateProductStrategy.php

28 lines 878 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SyncBasalam\Admin\Product\Data\Strategies;
4
5 use SyncBasalam\Admin\Product\Data\Handlers\ProductDataHandlerInterface;
6 use SyncBasalam\Utilities\ProductMetaKey;
7
8 defined('ABSPATH') || exit;
9
10 class QuickUpdateProductStrategy implements DataStrategyInterface
11 {
12 public function collect($product, ProductDataHandlerInterface $handler): array
13 {
14 $data = [
15 'id' => get_post_meta($product->get_id(), ProductMetaKey::basalamProductId(), true),
16 'variants' => $handler->getVariants($product),
17 'type' => $product->get_type(),
18 ];
19
20 if (!$product->is_type('variable')) {
21 $data['primary_price'] = $handler->getPrice($product);
22 $data['stock'] = $handler->getStock($product);
23 }
24
25 return array_filter($data, fn($value) => $value !== null);
26 }
27 }
28