-
- {!! view_render_event('bagisto.admin.customer.edit.after', ['customer' => $customer]) !!}
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/Webkul/Paypal/src/Config/paymentmethods.php b/packages/Webkul/Paypal/src/Config/paymentmethods.php
index d5cd28675..63f792094 100755
--- a/packages/Webkul/Paypal/src/Config/paymentmethods.php
+++ b/packages/Webkul/Paypal/src/Config/paymentmethods.php
@@ -15,6 +15,7 @@ return [
'code' => 'paypal_smart_button',
'title' => 'Paypal Smart Button',
'description' => 'Paypal Smart Button',
+ 'client_id' => 'sb',
'class' => 'Webkul\Paypal\Payment\SmartButton',
'sandbox' => true,
'active' => true,
diff --git a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php
index 2f33f4a82..dc9027d3d 100644
--- a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php
+++ b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php
@@ -87,6 +87,42 @@ class ProductFlatRepository extends Repository
return $filterAttributes;
}
+ /**
+ * filter attributes according to products
+ *
+ * @param array $category
+ * @return \Illuminate\Support\Collection
+ */
+ public function getProductsRelatedFilterableAttributes($category) {
+ $products = app('Webkul\Product\Repositories\ProductRepository')->getProductsRelatedToCategory($category->id);
+
+ $filterAttributes = $this->getFilterableAttributes($category, $products);
+
+ $allProductAttributeOptionsCode = [];
+
+ foreach ($products as $key => $product) {
+ foreach ($filterAttributes as $attribute) {
+ if ($attribute->code <> 'price') {
+ if (isset($product[$attribute->code])) {
+ if (! in_array($product[$attribute->code], $allProductAttributeOptionsCode)) {
+ array_push($allProductAttributeOptionsCode, $product[$attribute->code]);
+ }
+ }
+ }
+ }
+ }
+
+ foreach ($filterAttributes as $attribute) {
+ foreach ($attribute->options as $key => $option) {
+ if (! in_array($option->id, $allProductAttributeOptionsCode)) {
+ unset($attribute->options[$key]);
+ }
+ }
+ }
+
+ return $filterAttributes;
+
+ }
/**
* update product_flat custom column
diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php
index 8245ea1e3..53559b2a6 100755
--- a/packages/Webkul/Product/src/Repositories/ProductRepository.php
+++ b/packages/Webkul/Product/src/Repositories/ProductRepository.php
@@ -110,6 +110,23 @@ class ProductRepository extends Repository
Event::dispatch('catalog.product.delete.after', $id);
}
+ /**
+ * @param int $categoryId
+ *
+ * @return \Illuminate\Support\Collection
+ */
+ public function getProductsRelatedToCategory($categoryId = null)
+ {
+ $qb = $this->model
+ ->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id');
+
+ if ($categoryId) {
+ $qb->where('product_categories.category_id', $categoryId);
+ }
+
+ return $qb->get();
+ }
+
/**
* @param int $categoryId
*
diff --git a/packages/Webkul/Shop/src/Resources/assets/js/components/image-slider.vue b/packages/Webkul/Shop/src/Resources/assets/js/components/image-slider.vue
index 18b0ed2f0..e0cb120e9 100755
--- a/packages/Webkul/Shop/src/Resources/assets/js/components/image-slider.vue
+++ b/packages/Webkul/Shop/src/Resources/assets/js/components/image-slider.vue
@@ -67,7 +67,7 @@ export default {
self.images.push({
'path': self.public_path + '/storage/' + slider.path,
'title' : slider.title,
- 'slider_path': slider.slider_path ? self.public_path+'/'+slider.slider_path : null
+ 'slider_path': slider.slider_path ? slider.slider_path : null
});
self.content.push(slider.content);
diff --git a/packages/Webkul/Shop/src/Resources/views/home/featured-products.blade.php b/packages/Webkul/Shop/src/Resources/views/home/featured-products.blade.php
index 5f8b75075..77aa48998 100755
--- a/packages/Webkul/Shop/src/Resources/views/home/featured-products.blade.php
+++ b/packages/Webkul/Shop/src/Resources/views/home/featured-products.blade.php
@@ -1,4 +1,4 @@
-@if (app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts())
+@if (count(app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts()))
diff --git a/packages/Webkul/Shop/src/Resources/views/home/new-products.blade.php b/packages/Webkul/Shop/src/Resources/views/home/new-products.blade.php
index 8fe92d434..c36bfca87 100755
--- a/packages/Webkul/Shop/src/Resources/views/home/new-products.blade.php
+++ b/packages/Webkul/Shop/src/Resources/views/home/new-products.blade.php
@@ -1,4 +1,4 @@
-@if (app('Webkul\Product\Repositories\ProductRepository')->getNewProducts())
+@if (count(app('Webkul\Product\Repositories\ProductRepository')->getNewProducts()))
diff --git a/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php b/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php
index 3c8aadd3d..51030d51e 100755
--- a/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php
+++ b/packages/Webkul/Shop/src/Resources/views/products/list/layered-navigation.blade.php
@@ -11,7 +11,7 @@
if (isset($category)) {
$products = $productRepository->getAll($category->id);
- $filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
+ $filterAttributes = $productFlatRepository->getProductsRelatedFilterableAttributes($category);
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}
diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php
index 2f57da155..1b20365c6 100644
--- a/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php
+++ b/packages/Webkul/Ui/src/Resources/views/datagrid/table.blade.php
@@ -1,6 +1,7 @@
@php
$locale = request()->get('locale') ?: app()->getLocale();
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
+ $customer_group = request()->get('customer_group');
@endphp
@@ -27,7 +28,7 @@
@foreach ($results['extraFilters']['channels'] as $channelModel)
@endforeach
diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/products/list/layered-navigation.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/products/list/layered-navigation.blade.php
index 04251d924..a3fd0cb71 100644
--- a/packages/Webkul/Velocity/src/Resources/views/shop/products/list/layered-navigation.blade.php
+++ b/packages/Webkul/Velocity/src/Resources/views/shop/products/list/layered-navigation.blade.php
@@ -9,7 +9,7 @@
if (isset($category)) {
$products = $productRepository->getAll($category->id);
- $filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
+ $filterAttributes = $productFlatRepository->getProductsRelatedFilterableAttributes($category);
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}