From 165e6aef5b7d5e33db1e05686a1e78a0a971525a Mon Sep 17 00:00:00 2001 From: jitendra Date: Thu, 9 May 2019 16:49:52 +0530 Subject: [PATCH 1/6] Refactored ProductController --- .../Http/Controllers/ProductController.php | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/packages/Webkul/Product/src/Http/Controllers/ProductController.php b/packages/Webkul/Product/src/Http/Controllers/ProductController.php index c2224e161..8ce8c6332 100755 --- a/packages/Webkul/Product/src/Http/Controllers/ProductController.php +++ b/packages/Webkul/Product/src/Http/Controllers/ProductController.php @@ -7,8 +7,6 @@ use Illuminate\Http\Response; use Illuminate\Support\Facades\Event; use Webkul\Product\Http\Requests\ProductForm; use Webkul\Product\Repositories\ProductRepository as Product; -use Webkul\Product\Repositories\ProductGridRepository as ProductGrid; -use Webkul\Product\Repositories\ProductFlatRepository as ProductFlat; use Webkul\Product\Repositories\ProductAttributeValueRepository as ProductAttributeValue; use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily; use Webkul\Category\Repositories\CategoryRepository as Category; @@ -58,21 +56,20 @@ class ProductController extends Controller protected $product; /** - * ProductGrid Repository object + * ProductAttributeValueRepository object * * @var array */ - protected $productGrid; - protected $productFlat; protected $productAttributeValue; /** * Create a new controller instance. * - * @param \Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily - * @param \Webkul\Category\Repositories\CategoryRepository $category - * @param \Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource - * @param \Webkul\Product\Repositories\ProductRepository $product + * @param \Webkul\Attribute\Repositories\AttributeFamilyRepository $attributeFamily + * @param \Webkul\Category\Repositories\CategoryRepository $category + * @param \Webkul\Inventory\Repositories\InventorySourceRepository $inventorySource + * @param \Webkul\Product\Repositories\ProductRepository $product + * @param \Webkul\Product\Repositories\ProductAttributeValueRepository $productAttributeValue * @return void */ public function __construct( @@ -80,9 +77,8 @@ class ProductController extends Controller Category $category, InventorySource $inventorySource, Product $product, - ProductGrid $productGrid, - ProductFlat $productFlat, - ProductAttributeValue $productAttributeValue) + ProductAttributeValue $productAttributeValue + ) { $this->attributeFamily = $attributeFamily; @@ -92,10 +88,6 @@ class ProductController extends Controller $this->product = $product; - $this->productGrid = $productGrid; - - $this->productFlat = $productFlat; - $this->productAttributeValue = $productAttributeValue; $this->_config = request('_config'); @@ -173,8 +165,6 @@ class ProductController extends Controller $inventorySources = $this->inventorySource->all(); - $allProducts = $this->productGrid->all(); - return view($this->_config['view'], compact('product', 'categories', 'inventorySources', 'allProducts')); } From 39ae4151484f30edefd1f4bde7cf86c9f0f7b6b2 Mon Sep 17 00:00:00 2001 From: prateek srivastava Date: Fri, 10 May 2019 11:34:25 +0530 Subject: [PATCH 2/6] admin Navigation bar menu scroll issue fixed --- .../Admin/src/Resources/assets/js/app.js | 127 ++++++++---------- 1 file changed, 58 insertions(+), 69 deletions(-) diff --git a/packages/Webkul/Admin/src/Resources/assets/js/app.js b/packages/Webkul/Admin/src/Resources/assets/js/app.js index 3c2238a80..ceb6fe298 100755 --- a/packages/Webkul/Admin/src/Resources/assets/js/app.js +++ b/packages/Webkul/Admin/src/Resources/assets/js/app.js @@ -8,83 +8,72 @@ Vue.prototype.$http = axios window.eventBus = new Vue(); -window.onload = function () { - $(document).ready(function() { - navbarLeftCssTop = parseInt($('.navbar-left').css("top")); - windowHeight = $(window).height(); - menubarHeight = $('ul.menubar').height(); - documentHeight = $(document).height(); - contentHeight = $('.content').height(); - innerSectionHeight = $('.inner-section').height(); - asideNavHeight = $('.aside-nav').height(); - pageContentHeight = $('.page-content').height(); - accordianHeight = $('.accordian').height(); +window.addEventListener('DOMContentLoaded', function() { + moveDown = 60; + moveUp = -60; + count = 0; + countKeyUp = 0; + pageDown = 60; + pageUp = -60; + scroll = 0; - if (menubarHeight < windowHeight) { - differenceInHeight = windowHeight - menubarHeight; - } else { - differenceInHeight = menubarHeight - windowHeight; - } + listLastElement = $('.menubar li:last-child').offset(); + lastElementOfNavBar = listLastElement.top; - if(pageContentHeight <= innerSectionHeight - 60) { - $('.navbar-left').css("position","absolute"); - // $('.content').css({"position": "fixed", "width": "65%"}); - // $('.content-wrapper').css({"position": "sticky", "top": "60px"}); - } - else { - $('.accordian-header').on('click',function(event) { - pageContentHeightOnAccordianClick = $('.page-content').height(); + navbarTop = $('.navbar-left').css("top"); + menuTopValue = $('.navbar-left').css('top'); + menubarTopValue = menuTopValue; - if(pageContentHeightOnAccordianClick <= innerSectionHeight) { - $('.navbar-left').css("position","absolute"); - $('.content').css("position","fixed"); - $('.content-wrapper').css({"position": "sticky", "top": "60px"}); - } - }); - } + documentHeight = $(document).height(); + menubarHeight = $('ul.menubar').height(); + navbarHeight = $('.navbar-left').height(); + windowHeight = $(window).height(); + contentHeight = $('.content').height(); + innerSectionHeight = $('.inner-section').height(); + gridHeight = $('.grid-container').height(); + pageContentHeight = $('.page-content').height(); - scrollTopWhenWindowLoaded = $(document).scrollTop(); + if (menubarHeight <= windowHeight) { + differenceInHeight = windowHeight - menubarHeight; + } else { + differenceInHeight = menubarHeight - windowHeight; + } + + if (menubarHeight > windowHeight) { + document.addEventListener("keydown", function(event) { + if ((event.keyCode == 38) && count <= 0) { + count = count + moveDown; + + $('.navbar-left').css("top", count + "px"); + } else if ((event.keyCode == 40) && count >= -differenceInHeight) { + count = count + moveUp; + + $('.navbar-left').css("top", count + "px"); + } else if ((event.keyCode == 33) && countKeyUp <= 0) { + countKeyUp = countKeyUp + pageDown; + + $('.navbar-left').css("top", countKeyUp + "px"); + } else if ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) { + countKeyUp = countKeyUp + pageUp; + + $('.navbar-left').css("top", countKeyUp + "px"); + } else { + $('.navbar-left').css("position", "fixed"); + } + }); + + $("body").css({minHeight: $(".menubar").outerHeight() + 100 + "px"}); + + window.addEventListener('scroll', function() { + documentScrollWhenScrolled = $(document).scrollTop(); - if (menubarHeight > documentHeight && menubarHeight > windowHeight) { - $(document).scroll(function() { - documentScrollWhenScrolled = $(document).scrollTop(); if (documentScrollWhenScrolled <= differenceInHeight + 200) { - $('.navbar-left').css('top', documentScrollWhenScrolled + 60 + 'px'); - + $('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px'); scrollTopValueWhenNavBarFixed = $(document).scrollTop(); } - }); - } else if (menubarHeight < windowHeight) { - $('.navbar-left').css("position", "fixed"); - } else if (menubarHeight < documentHeight) { - if (scrollTopWhenWindowLoaded > differenceInHeight) { - $('.navbar-left').css('top', -differenceInHeight + 'px'); - } - - if (menubarHeight > windowHeight) { - $(document).scroll(function() { - documentScrollWhenScrolled = $(document).scrollTop(); - - if (documentScrollWhenScrolled <= differenceInHeight + 200) { - $('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px'); - - scrollTopValueWhenNavBarFixed = $(document).scrollTop(); - } - }); - } else if (menubarHeight < windowHeight) { - $(document).scroll(function() { - documentScrollWhenScrolled = $(document).scrollTop(); - if (documentScrollWhenScrolled <= differenceInHeight + 70) { - $('.navbar-left').css('top', -documentScrollWhenScrolled + 60 + 'px'); - - scrollTopValueWhenNavBarFixed = $(document).scrollTop(); - } - }); - - } - } - }); -} + }); + } +}); $(document).ready(function () { Vue.config.ignoredElements = [ From d2a5768ba6a13ed02889de0490979f42135e5344 Mon Sep 17 00:00:00 2001 From: Prashant Singh Date: Sat, 11 May 2019 17:30:27 +0530 Subject: [PATCH 3/6] fixed product card image not found issue --- .../views/products/list/card.blade.php | 2 +- tests/Browser/GuestShopTest.php | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/Browser/GuestShopTest.php diff --git a/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php b/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php index d36d0c443..c0d9f588c 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php @@ -14,7 +14,7 @@ diff --git a/tests/Browser/GuestShopTest.php b/tests/Browser/GuestShopTest.php new file mode 100644 index 000000000..6ed19f2c3 --- /dev/null +++ b/tests/Browser/GuestShopTest.php @@ -0,0 +1,47 @@ +all(); + $products = app('Webkul\Product\Repositories\ProductRepository')->all(); + + $slugs = array(); + + foreach ($categories as $category) { + if ($category->slug != 'root') { + array_push($slugs, $category->slug); + } + } + + $slugIndex = array_rand($slugs); + $testSlug = $slugs[$slugIndex]; + $testProduct = array(); + dd($testSlug); + foreach ($products as $product) { + $categories = $product->categories; + + if ($categories->last()->slug == $testSlug) { + array_push($testProduct, $product); + } + } + + $this->browse(function (Browser $browser) use($testSlug,$product) { + $browser->visit(route('shop.categories.index', $testSlug)); + $browser->assertSeeLink($linkText); + $browser->pause(4000); + }); + } +} \ No newline at end of file From 22b4e201a7988a681de39027a348517c2ecb65d0 Mon Sep 17 00:00:00 2001 From: Prashant Singh Date: Mon, 13 May 2019 11:42:02 +0530 Subject: [PATCH 4/6] making cart attributes for cart rules --- .../Admin/src/Resources/lang/en/app.php | 2 +- .../promotions/cart-rule/create.blade.php | 43 ++++++++++------- .../promotions/catalog-rule/create.blade.php | 21 ++++++--- .../Discount/src/Config/cart-attributes.php | 15 ++++++ tests/Browser/GuestShopTest.php | 47 ------------------- 5 files changed, 57 insertions(+), 71 deletions(-) create mode 100644 packages/Webkul/Discount/src/Config/cart-attributes.php delete mode 100644 tests/Browser/GuestShopTest.php diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index 7165ebd3e..1457e3a31 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -793,7 +793,7 @@ return [ 'name' => 'Name', 'description' => 'Description', 'apply-percent' => 'Apply as percentage', - 'apply-fixed' => 'Apply as fixed Amount', + 'apply-fixed' => 'Apply as fixed amount', 'adjust-to-percent' => 'Adjust to percentage', 'adjust-to-value' => 'Adjust to discount value' ] diff --git a/packages/Webkul/Admin/src/Resources/views/promotions/cart-rule/create.blade.php b/packages/Webkul/Admin/src/Resources/views/promotions/cart-rule/create.blade.php index 08da8d332..901e8938a 100644 --- a/packages/Webkul/Admin/src/Resources/views/promotions/cart-rule/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/promotions/cart-rule/create.blade.php @@ -1,12 +1,12 @@ @extends('admin::layouts.content') @section('page_title') - {{ __('admin::app.promotion.add-catalog-rule') }} + {{ __('admin::app.promotion.add-cart-rule') }} @stop @section('content')
-
+ @csrf @@ -27,14 +27,14 @@
- +
@push('scripts') -