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/Data/Services/AttributeService.php +14 -0 1.8.81.10.19 View file →
@@ -10,12 +10,14 @@
10 10
11 11 class AttributeService
12 12 {
13 13 private $mobileDataHandler;
14 + private $goldDataHandler;
14 15
15 16 public function __construct()
16 17 {
17 18 $this->mobileDataHandler = new MobileDataHandler();
19 + $this->goldDataHandler = new GoldDataHandler();
18 20 }
19 21
20 22 public function getAttributeSuffix($product): ?string
21 23 {
@@ -75,8 +77,10 @@
75 77 $attributes = [];
76 78
77 79 if ($this->isMobileProduct($product)) $attributes = array_merge($attributes, $this->getMobileAttributes($product));
78 80
81 + if ($this->isGoldProduct($product)) $attributes = array_merge($attributes, $this->getGoldAttributes($product));
82 +
79 83 $wooAttributes = $this->getMappedAttributes($product);
80 84 if (!empty($wooAttributes)) $attributes = array_merge($attributes, $wooAttributes);
81 85
82 86 return $attributes;
@@ -175,8 +179,13 @@
175 179 {
176 180 return $this->mobileDataHandler->getMobileAttributesAsArray($product);
177 181 }
178 182
183 + private function getGoldAttributes($product): array
184 + {
185 + return $this->goldDataHandler->getGoldAttributesAsArray($product);
186 + }
187 +
179 188 private function getMappedCategoryOptions(): array
180 189 {
181 190 global $wpdb;
182 191 $categoryOptionsManager = new \SyncBasalam\Admin\Product\Category\CategoryOptions($wpdb);
@@ -185,6 +194,11 @@
185 194
186 195 private function isMobileProduct($product): bool
187 196 {
188 197 return get_post_meta($product->get_id(), '_sync_basalam_is_mobile_product_checkbox', true) === 'yes';
198 + }
199 +
200 + private function isGoldProduct($product): bool
201 + {
202 + return get_post_meta($product->get_id(), '_sync_basalam_is_gold_product_checkbox', true) === 'yes';
189 203 }
190 204 }