From 2783f7ee7ba57b02f902edd4ceb106fb9423a80a Mon Sep 17 00:00:00 2001 From: Josh Angell Date: Thu, 20 May 2021 12:08:34 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Added=20current=20product=20emabled=20statu?= =?UTF-8?q?s=20to=20import=20controller=20=E2=80=A6=E2=80=A6..=20n+1=20pro?= =?UTF-8?q?blem=20created=20but=20no=20way=20around=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProductsController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/controllers/ProductsController.php b/src/controllers/ProductsController.php index 1101f9f..19caeb0 100644 --- a/src/controllers/ProductsController.php +++ b/src/controllers/ProductsController.php @@ -13,6 +13,7 @@ use angellco\vend\models\Settings; use angellco\vend\Vend; use Craft; +use craft\commerce\elements\Product; use craft\db\Paginator; use craft\elements\Entry; use craft\helpers\DateTimeHelper; @@ -241,9 +242,16 @@ public function actionImport(): Response } } + // Get the current product if there is one + $productQuery = Product::find(); + $productQuery->status = null; + $productQuery->vendProductId = $rawProduct->vendProductId; + $commerceProduct = $productQuery->one(); + $products[] = [ 'id' => $rawProduct->vendProductId, 'name' => $rawProduct->title, + 'enabled' => $commerceProduct ? $commerceProduct->enabled : false, 'variants' => $variants ]; } From 0061aa735c6110028f5713eb41c40ed068477e95 Mon Sep 17 00:00:00 2001 From: Josh Angell Date: Thu, 20 May 2021 12:09:29 +0100 Subject: [PATCH 2/2] Changelog for 2.5.9 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8455f2a..f00400d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## Unreleased +## 2.5.9 - 2021-05-20 + +### Changed +- Added the enabled status of the current product to the Feed Me API if the product already exists. + + ## 2.5.8 - 2021-05-20 ### Fixed