From 8296fdb6d4feb6a7aeb39a991221393bc02f674e Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Mon, 30 Dec 2019 20:26:13 +0530 Subject: [PATCH] initial commit --- .../Webkul/Velocity/src/Config/system.php | 4 + .../Product/ProductRepository.php | 80 +++++ .../assets/sass/components/shared.scss | 2 +- .../Velocity/src/Resources/lang/en/app.php | 3 +- .../views/home/featured-products.blade.php | 9 +- .../footer/newsletter-subscription.blade.php | 47 ++- .../products/view/bundle-options.blade.php | 229 ++++++++++++ .../view/configurable-options.blade.php | 326 ++++++++++++++++++ .../products/view/downloadable.blade.php | 50 +++ .../products/view/grouped-products.blade.php | 36 ++ 10 files changed, 759 insertions(+), 27 deletions(-) create mode 100644 packages/Webkul/Velocity/src/Repositories/Product/ProductRepository.php create mode 100644 packages/Webkul/Velocity/src/Resources/views/products/view/bundle-options.blade.php create mode 100755 packages/Webkul/Velocity/src/Resources/views/products/view/configurable-options.blade.php create mode 100644 packages/Webkul/Velocity/src/Resources/views/products/view/downloadable.blade.php create mode 100644 packages/Webkul/Velocity/src/Resources/views/products/view/grouped-products.blade.php diff --git a/packages/Webkul/Velocity/src/Config/system.php b/packages/Webkul/Velocity/src/Config/system.php index 185a9cf96..a1fb25c4c 100644 --- a/packages/Webkul/Velocity/src/Config/system.php +++ b/packages/Webkul/Velocity/src/Config/system.php @@ -27,6 +27,10 @@ return [ 'value' => false ] ] + ], [ + 'name' => 'featured_product', + 'title' => 'velocity::app.admin.system.general.featured-product', + 'type' => 'text', ] ] ], [ diff --git a/packages/Webkul/Velocity/src/Repositories/Product/ProductRepository.php b/packages/Webkul/Velocity/src/Repositories/Product/ProductRepository.php new file mode 100644 index 000000000..28d5e916c --- /dev/null +++ b/packages/Webkul/Velocity/src/Repositories/Product/ProductRepository.php @@ -0,0 +1,80 @@ + + * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) + */ +class ProductRepository extends Repository +{ + /** + * AttributeRepository object + * + * @var array + */ + protected $attributeRepository; + + /** + * Create a new controller instance. + * + * @param Webkul\Attribute\Repositories\AttributeRepository $attributeRepository + * @return void + */ + public function __construct( + AttributeRepository $attributeRepository, + App $app + ) + { + $this->attributeRepository = $attributeRepository; + + parent::__construct($app); + } + + /** + * Specify Model class name + * + * @return mixed + */ + function model() + { + return 'Webkul\Product\Contracts\Product'; + } + + /** + * Returns featured product + * + * @return Collection + */ + public function getFeaturedProducts($count) + { + $results = app(ProductFlatRepository::class)->scopeQuery(function($query) { + $channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode()); + + $locale = request()->get('locale') ?: app()->getLocale(); + + return $query->distinct() + ->addSelect('product_flat.*') + ->where('product_flat.status', 1) + ->where('product_flat.visible_individually', 1) + ->where('product_flat.featured', 1) + ->where('product_flat.channel', $channel) + ->where('product_flat.locale', $locale) + ->orderBy('product_id', 'desc'); + })->paginate($count); + + return $results; + } + +} \ No newline at end of file diff --git a/packages/Webkul/Velocity/src/Resources/assets/sass/components/shared.scss b/packages/Webkul/Velocity/src/Resources/assets/sass/components/shared.scss index e1fc84813..e5df54155 100644 --- a/packages/Webkul/Velocity/src/Resources/assets/sass/components/shared.scss +++ b/packages/Webkul/Velocity/src/Resources/assets/sass/components/shared.scss @@ -147,7 +147,7 @@ margin-left: 0px; } .ml15 { - margin-left: 15px; + margin-left: 15px !important; } .body-blur { filter: blur(4px); diff --git a/packages/Webkul/Velocity/src/Resources/lang/en/app.php b/packages/Webkul/Velocity/src/Resources/lang/en/app.php index ded82d0e2..d8ae92dc1 100644 --- a/packages/Webkul/Velocity/src/Resources/lang/en/app.php +++ b/packages/Webkul/Velocity/src/Resources/lang/en/app.php @@ -20,7 +20,8 @@ return [ 'general' => [ 'status' => 'Status', 'active' => 'Active', - 'inactive' => 'Inactive' + 'inactive' => 'Inactive', + 'featured-product' => 'Featured Product' ], 'category' => [ 'icon-status' => 'Category Icon Status', diff --git a/packages/Webkul/Velocity/src/Resources/views/home/featured-products.blade.php b/packages/Webkul/Velocity/src/Resources/views/home/featured-products.blade.php index a081b007e..662c90729 100644 --- a/packages/Webkul/Velocity/src/Resources/views/home/featured-products.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/home/featured-products.blade.php @@ -1,5 +1,12 @@ @php - $featuredProducts = app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts(); + $config = core()->getConfigData('velocity.configuration.general.featured_product'); + + if ($config > 4) + $count = $config; + else + $count = 4; + + $featuredProducts = app('Webkul\Velocity\Repositories\Product\ProductRepository')->getFeaturedProducts($count); $featuredProductsCount = $featuredProducts->count(); diff --git a/packages/Webkul/Velocity/src/Resources/views/layouts/footer/newsletter-subscription.blade.php b/packages/Webkul/Velocity/src/Resources/views/layouts/footer/newsletter-subscription.blade.php index b62f5a195..6ede3c7c6 100644 --- a/packages/Webkul/Velocity/src/Resources/views/layouts/footer/newsletter-subscription.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/layouts/footer/newsletter-subscription.blade.php @@ -1,34 +1,33 @@ -
-