← All changes
|
admin/controllers/WooMailerLiteAdminSettingsController.php
+7
-7
3.1.18
→
trunk
View file →
| @@ -49,9 +49,9 @@ | ||
| 49 | 49 | ]); |
| 50 | 50 | } |
| 51 | 51 | } else { |
| 52 | 52 | $product->exclude_from_automations = $product->ignored; |
| 53 | - $this->apiClient()->syncProduct(WooMailerLiteOptions::get('shopId'), $product->toArray(), true); | |
| 53 | + $this->apiClient()->syncProduct(WooMailerLiteOptions::get('shopId'), $product->toArrayWithVariants(), true); | |
| 54 | 54 | } |
| 55 | 55 | return true; |
| 56 | 56 | } |
| 57 | 57 | |
| @@ -88,9 +88,9 @@ | ||
| 88 | 88 | $shopId = WooMailerLiteOptions::get('shopId'); |
| 89 | 89 | if ($product) { |
| 90 | 90 | $product->exclude_from_automations = $product->ignored ? 1 : 0; |
| 91 | 91 | $product->categories = $product->category_ids; |
| 92 | - $response = $this->apiClient()->syncProduct($shopId, $product->toArray(), true); | |
| 92 | + $response = $this->apiClient()->syncProduct($shopId, $product->toArrayWithVariants(), true); | |
| 93 | 93 | if ($response->success) { |
| 94 | 94 | $product->tracked = true; |
| 95 | 95 | $product->save(); |
| 96 | 96 | } else { |
| @@ -129,9 +129,9 @@ | ||
| 129 | 129 | ]); |
| 130 | 130 | } |
| 131 | 131 | } else { |
| 132 | 132 | $product->exclude_from_automations = $product->ignored; |
| 133 | - $this->apiClient()->syncProduct(WooMailerLiteOptions::get('shopId'), $product->toArray(), true); | |
| 133 | + $this->apiClient()->syncProduct(WooMailerLiteOptions::get('shopId'), $product->toArrayWithVariants(), true); | |
| 134 | 134 | } |
| 135 | 135 | } else { |
| 136 | 136 | WooMailerLiteLog()->error('product:update:not_found', [ |
| 137 | 137 | 'product_id' => $productId |
| @@ -163,9 +163,9 @@ | ||
| 163 | 163 | $this->apiClient()->deleteCategory($categoryId); |
| 164 | 164 | } |
| 165 | 165 | return true; |
| 166 | 166 | } |
| 167 | - | |
| 167 | + | |
| 168 | 168 | private function deleteProduct($product) |
| 169 | 169 | { |
| 170 | 170 | $response = $this->apiClient()->deleteProduct($product->resource_id); |
| 171 | 171 | if ($response->success) { |
| @@ -272,9 +272,9 @@ | ||
| 272 | 272 | return $this->response($response, $response->status, $message); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | public function resetIntegration() |
| 276 | - { | |
| 276 | + { | |
| 277 | 277 | $this->authorize(); |
| 278 | 278 | $this->apiClient()->toggleShop(home_url(), 0); |
| 279 | 279 | WooMailerLiteProductSyncResetJob::dispatchSync(); |
| 280 | 280 | WooMailerLiteOptions::deleteAll(); |
| @@ -285,9 +285,9 @@ | ||
| 285 | 285 | |
| 286 | 286 | public function downgradePlugin() |
| 287 | 287 | { |
| 288 | 288 | $this->authorize(); |
| 289 | - | |
| 289 | + | |
| 290 | 290 | $slug = 'woo-mailerlite'; |
| 291 | 291 | $version = '2.1.29'; |
| 292 | 292 | $zip_url = "https://downloads.wordpress.org/plugin/{$slug}.{$version}.zip"; |
| 293 | 293 | |
| @@ -306,9 +306,9 @@ | ||
| 306 | 306 | exit; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | public function enableDebugMode() |
| 310 | - { | |
| 310 | + { | |
| 311 | 311 | $this->authorize(); |
| 312 | 312 | WooMailerLiteOptions::update('debugMode', !WooMailerLiteOptions::get('debugMode')); |
| 313 | 313 | return $this->response(['success' => true, 'message' => 'Debug mode enabled'], WooMailerLiteOptions::get('debugMode') ? 200 : 201); |
| 314 | 314 | } |