From e581c950df70b8076b761721126858740732dadd Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Fri, 19 Feb 2021 13:34:39 +0530 Subject: [PATCH 1/2] Issue #4643 fixed --- .../Core/src/Http/Controllers/SubscriptionController.php | 7 ++++--- resources/themes/.gitignore | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) delete mode 100755 resources/themes/.gitignore diff --git a/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php b/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php index f019d40ce..f6fb83eca 100755 --- a/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php +++ b/packages/Webkul/Core/src/Http/Controllers/SubscriptionController.php @@ -72,9 +72,10 @@ class SubscriptionController extends Controller $customer = $subscriber->customer; - $customer->subscribed_to_news_letter = $data['is_subscribed']; - - $customer->save(); + if (! is_null($customer)) { + $customer->subscribed_to_news_letter = $data['is_subscribed']; + $customer->save(); + } $result = $subscriber->update($data); diff --git a/resources/themes/.gitignore b/resources/themes/.gitignore deleted file mode 100755 index d6b7ef32c..000000000 --- a/resources/themes/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore From ea66157655a2078771fd09b8249ee5d8dd5a33a5 Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Fri, 19 Feb 2021 15:43:21 +0530 Subject: [PATCH 2/2] Issue #4645 fixed and product videos added in product api --- .../API/Http/Resources/Catalog/Product.php | 5 +++- .../Http/Resources/Catalog/ProductVideo.php | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 packages/Webkul/API/Http/Resources/Catalog/ProductVideo.php diff --git a/packages/Webkul/API/Http/Resources/Catalog/Product.php b/packages/Webkul/API/Http/Resources/Catalog/Product.php index ef7e1ed74..649e2c36f 100644 --- a/packages/Webkul/API/Http/Resources/Catalog/Product.php +++ b/packages/Webkul/API/Http/Resources/Catalog/Product.php @@ -17,6 +17,8 @@ class Product extends JsonResource $this->productReviewHelper = app('Webkul\Product\Helpers\Review'); $this->wishlistHelper = app('Webkul\Customer\Helpers\Wishlist'); + + parent::__construct($resource); } /** @@ -45,7 +47,8 @@ class Product extends JsonResource 'formated_price' => core()->currency($productTypeInstance->getMinimalPrice()), 'short_description' => $product->short_description, 'description' => $product->description, - 'images' => ProductImageFacade::collection($product->images), + 'images' => ProductImage::collection($product->images), + 'videos' => ProductVideo::collection($product->videos), 'base_image' => ProductImageFacade::getProductBaseImage($product), 'created_at' => $product->created_at, 'updated_at' => $product->updated_at, diff --git a/packages/Webkul/API/Http/Resources/Catalog/ProductVideo.php b/packages/Webkul/API/Http/Resources/Catalog/ProductVideo.php new file mode 100644 index 000000000..c45239561 --- /dev/null +++ b/packages/Webkul/API/Http/Resources/Catalog/ProductVideo.php @@ -0,0 +1,23 @@ + $this->id, + 'type' => $this->type, + 'url' => $this->url + ]; + } +} \ No newline at end of file