diff --git a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php index 14ff10f32..cf1f7b562 100755 --- a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php @@ -52,11 +52,11 @@ class LocalesDataGrid extends DataGrid 'sortable' => true, 'filterable' => true ]); - + $this->addColumn([ 'index' => 'direction', 'label' => trans('admin::app.datagrid.direction'), - 'type' => 'select', + 'type' => 'string', 'searchable' => true, 'sortable' => true, 'filterable' => true diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index 567166271..fa425e62a 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -396,7 +396,8 @@ return [ 'related-products' => 'Related Products', 'product-search-hint' => 'Start typing product name', 'no-result-found' => 'Products not found with same name.', - 'searching' => 'Searching ...' + 'searching' => 'Searching ...', + 'channel' => 'Channels' ], 'attributes' => [ @@ -448,7 +449,7 @@ return [ 'image' => 'Image', 'file' => 'File', 'checkbox' => 'Checkbox', - 'use_in_flat' => "Create in Product Flat Table" + 'use_in_flat' => "Create in Product Flat Table", ], 'families' => [ 'title' => 'Families', @@ -492,6 +493,8 @@ return [ 'meta_description' => 'Meta Description', 'meta_keywords' => 'Meta Keywords', 'image' => 'Image', + 'filterable-attributes' => 'Filterable Attributes', + 'attributes' => 'Attributes', ] ], diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/categories/create.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/categories/create.blade.php index 69485ed92..387de9164 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/categories/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/categories/create.blade.php @@ -136,6 +136,23 @@ @endif + +
+
+ + + + @{{ errors.first('attributes[]') }} + +
+
+
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.seo.before') !!} diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/categories/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/categories/edit.blade.php index 1399593e1..4c4fe5880 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/categories/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/categories/edit.blade.php @@ -148,6 +148,23 @@ @endif + +
+
+ + + + @{{ errors.first('attributes[]') }} + +
+
+
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.seo.before', ['category' => $category]) !!} diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/channels.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/channels.blade.php new file mode 100644 index 000000000..e99d11549 --- /dev/null +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/channels.blade.php @@ -0,0 +1,18 @@ + +
+
+ + + + + @{{ errors.first('channels[]') }} + +
+
+
\ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php index 60835a969..24d7d5956 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php @@ -150,6 +150,7 @@ @endforeach + @include ('admin::catalog.products.accordians.channels') {!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.inventories.before', ['product' => $product]) !!} diff --git a/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php b/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php index 78cb72fbd..fe645b534 100755 --- a/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php @@ -438,16 +438,16 @@ this_this.isRequire = true; } - var dependentElement = document.getElementById(this_this.depand); - var depandValue = this_this.value; - - if (depandValue == 'true') { - depandValue = 1; - } else if (depandValue == 'false') { - depandValue = 0; - } - $(document).ready(function(){ + var dependentElement = document.getElementById(this_this.depand); + var depandValue = this_this.value; + + if (depandValue == 'true') { + depandValue = 1; + } else if (depandValue == 'false') { + depandValue = 0; + } + $(document).on("change", "select.control", function() { if (this_this.depand == this.name) { if (this_this.value == this.value) { @@ -457,17 +457,21 @@ } } }) + + if (dependentElement && dependentElement.value == depandValue) { + this_this.isVisible = true; + } else { + this_this.isVisible = false; + } + + if (this_this.result) { + if (dependentElement.value == this_this.value) { + this_this.isVisible = true; + } else { + this_this.isVisible = false; + } + } }); - - if (dependentElement && dependentElement.value == depandValue) { - this_this.isVisible = true; - } else { - this_this.isVisible = false; - } - - if (this_this.result) { - this_this.isVisible = true; - } } }); diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php index 1cc7a63d9..5ac3d67ba 100755 --- a/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/anonymous-master.blade.php @@ -1,7 +1,3 @@ -@php - $locale = Webkul\Core\Models\Locale::where('code', app()->getLocale())->first(); -@endphp - @@ -71,7 +67,7 @@ {!! view_render_event('bagisto.admin.layout.head') !!} - direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;"> + getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;">
diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php index 47211d650..7ffa75817 100755 --- a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php @@ -1,7 +1,3 @@ -@php - $locale = Webkul\Core\Models\Locale::where('code', app()->getLocale())->first(); -@endphp - @@ -23,7 +19,7 @@ - direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;"> + getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;"> {!! view_render_event('bagisto.admin.layout.body.before') !!}
diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/nav-top.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/nav-top.blade.php index 53f228c82..3bb21692c 100755 --- a/packages/Webkul/Admin/src/Resources/views/layouts/nav-top.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/nav-top.blade.php @@ -2,7 +2,11 @@ diff --git a/packages/Webkul/Category/src/Database/Migrations/2019_07_31_143339_create_category_filterable_attributes_table.php b/packages/Webkul/Category/src/Database/Migrations/2019_07_31_143339_create_category_filterable_attributes_table.php new file mode 100644 index 000000000..3301581ad --- /dev/null +++ b/packages/Webkul/Category/src/Database/Migrations/2019_07_31_143339_create_category_filterable_attributes_table.php @@ -0,0 +1,33 @@ +integer('category_id')->unsigned(); + $table->integer('attribute_id')->unsigned(); + $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); + $table->foreign('attribute_id')->references('id')->on('attributes')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('category_filterable_attributes'); + } +} diff --git a/packages/Webkul/Category/src/Http/Controllers/CategoryController.php b/packages/Webkul/Category/src/Http/Controllers/CategoryController.php index 2c5a876f5..8268c2187 100755 --- a/packages/Webkul/Category/src/Http/Controllers/CategoryController.php +++ b/packages/Webkul/Category/src/Http/Controllers/CategoryController.php @@ -5,6 +5,7 @@ namespace Webkul\Category\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Http\Response; use Webkul\Category\Repositories\CategoryRepository as Category; +use Webkul\Attribute\Repositories\AttributeRepository as Attribute; use Webkul\Category\Models\CategoryTranslation; use Illuminate\Support\Facades\Event; @@ -30,16 +31,26 @@ class CategoryController extends Controller */ protected $category; + /** + * AttributeRepository object + * + * @var array + */ + protected $attribute; + /** * Create a new controller instance. * - * @param \Webkul\Category\Repositories\CategoryRepository $category + * @param \Webkul\Category\Repositories\CategoryRepository $category + * @param use Webkul\Attribute\Repositories\AttributeRepository $attribute * @return void */ - public function __construct(Category $category) + public function __construct(Category $category, Attribute $attribute) { $this->category = $category; + $this->attribute = $attribute; + $this->_config = request('_config'); } @@ -62,7 +73,9 @@ class CategoryController extends Controller { $categories = $this->category->getCategoryTree(null, ['id']); - return view($this->_config['view'], compact('categories')); + $attributes = $this->attribute->findWhere(['is_filterable' => 1]); + + return view($this->_config['view'], compact('categories', 'attributes')); } /** @@ -110,7 +123,9 @@ class CategoryController extends Controller $category = $this->category->findOrFail($id); - return view($this->_config['view'], compact('category', 'categories')); + $attributes = $this->attribute->findWhere(['is_filterable' => 1]); + + return view($this->_config['view'], compact('category', 'categories', 'attributes')); } /** diff --git a/packages/Webkul/Category/src/Models/Category.php b/packages/Webkul/Category/src/Models/Category.php index 48b8e3046..8a38f7c02 100755 --- a/packages/Webkul/Category/src/Models/Category.php +++ b/packages/Webkul/Category/src/Models/Category.php @@ -6,6 +6,7 @@ use Webkul\Core\Eloquent\TranslatableModel; use Kalnoy\Nestedset\NodeTrait; use Illuminate\Support\Facades\Storage; use Webkul\Category\Contracts\Category as CategoryContract; +use Webkul\Attribute\Models\AttributeProxy; class Category extends TranslatableModel implements CategoryContract { @@ -35,4 +36,12 @@ class Category extends TranslatableModel implements CategoryContract { return $this->image_url(); } + + /** + * The filterable attributes that belong to the category. + */ + public function filterableAttributes() + { + return $this->belongsToMany(AttributeProxy::modelClass(), 'category_filterable_attributes')->with('options'); + } } \ No newline at end of file diff --git a/packages/Webkul/Category/src/Repositories/CategoryRepository.php b/packages/Webkul/Category/src/Repositories/CategoryRepository.php index ccae2f210..3ddf7f649 100755 --- a/packages/Webkul/Category/src/Repositories/CategoryRepository.php +++ b/packages/Webkul/Category/src/Repositories/CategoryRepository.php @@ -63,6 +63,10 @@ class CategoryRepository extends Repository $this->uploadImages($data, $category); + if (isset($data['attributes'])) { + $category->filterableAttributes()->sync($data['attributes']); + } + Event::fire('catalog.category.create.after', $category); return $category; @@ -163,6 +167,10 @@ class CategoryRepository extends Repository $this->uploadImages($data, $category); + if (isset($data['attributes'])) { + $category->filterableAttributes()->sync($data['attributes']); + } + Event::fire('catalog.category.update.after', $id); return $category; diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index 523ec26c5..6bbb39e25 100755 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -936,27 +936,35 @@ class Cart { 'country' => $shippingAddress->country, ])->orderBy('tax_rate', 'desc')->get(); - foreach ($taxRates as $rate) { - $haveTaxRate = false; + if (count( $taxRates) > 0) { + foreach ($taxRates as $rate) { + $haveTaxRate = false; - if (! $rate->is_zip) { - if ($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) { - $haveTaxRate = true; + if (! $rate->is_zip) { + if ($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) { + $haveTaxRate = true; + } + } else { + if ($shippingAddress->postcode >= $rate->zip_from && $shippingAddress->postcode <= $rate->zip_to) { + $haveTaxRate = true; + } } - } else { - if ($shippingAddress->postcode >= $rate->zip_from && $shippingAddress->postcode <= $rate->zip_to) { - $haveTaxRate = true; + + if ($haveTaxRate) { + $item->tax_percent = $rate->tax_rate; + $item->tax_amount = ($item->total * $rate->tax_rate) / 100; + $item->base_tax_amount = ($item->base_total * $rate->tax_rate) / 100; + + $item->save(); + break; } } + } else { + $item->tax_percent = 0; + $item->tax_amount = 0; + $item->base_tax_amount = 0; - if ($haveTaxRate) { - $item->tax_percent = $rate->tax_rate; - $item->tax_amount = ($item->total * $rate->tax_rate) / 100; - $item->base_tax_amount = ($item->base_total * $rate->tax_rate) / 100; - - $item->save(); - break; - } + $item->save(); } } } diff --git a/packages/Webkul/Customer/src/Http/Controllers/ForgotPasswordController.php b/packages/Webkul/Customer/src/Http/Controllers/ForgotPasswordController.php index 78fd9a25f..29309afab 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/ForgotPasswordController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/ForgotPasswordController.php @@ -52,25 +52,31 @@ class ForgotPasswordController extends Controller */ public function store() { - $this->validate(request(), [ - 'email' => 'required|email' - ]); + try { + $this->validate(request(), [ + 'email' => 'required|email' + ]); - $response = $this->broker()->sendResetLink( - request(['email']) - ); - //dd($response); - if ($response == Password::RESET_LINK_SENT) { - session()->flash('success', trans($response)); - - return back(); - } - - return back() - ->withInput(request(['email'])) - ->withErrors( - ['email' => trans($response)] + $response = $this->broker()->sendResetLink( + request(['email']) ); + + if ($response == Password::RESET_LINK_SENT) { + session()->flash('success', trans($response)); + + return back(); + } + + return back() + ->withInput(request(['email'])) + ->withErrors( + ['email' => trans($response)] + ); + } catch (\Exception $e) { + session()->flash('error', trans($e->getMessage())); + + return redirect()->back(); + } } /** diff --git a/packages/Webkul/Customer/src/Http/Middleware/RedirectIfNotCustomer.php b/packages/Webkul/Customer/src/Http/Middleware/RedirectIfNotCustomer.php index 78f5c1436..38adeb4e3 100755 --- a/packages/Webkul/Customer/src/Http/Middleware/RedirectIfNotCustomer.php +++ b/packages/Webkul/Customer/src/Http/Middleware/RedirectIfNotCustomer.php @@ -18,7 +18,7 @@ class RedirectIfNotCustomer public function handle($request, Closure $next, $guard = 'customer') { if (! Auth::guard($guard)->check()) { - return redirect()->route('customer.profile.index'); + return redirect()->route('customer.session.index'); } else { if (Auth::guard($guard)->user()->status == 0) { Auth::guard($guard)->logout(); diff --git a/packages/Webkul/Product/src/Listeners/ProductFlat.php b/packages/Webkul/Product/src/Listeners/ProductFlat.php index d02227ddc..5cbfc80a9 100644 --- a/packages/Webkul/Product/src/Listeners/ProductFlat.php +++ b/packages/Webkul/Product/src/Listeners/ProductFlat.php @@ -104,6 +104,7 @@ class ProductFlat public function afterAttributeCreatedUpdated($attribute) { if (! $attribute->is_user_defined || ! $attribute->use_in_flat) { + $this->afterAttributeDeleted($attribute->id); return false; } @@ -169,100 +170,125 @@ class ProductFlat if ($parentProduct && ! array_key_exists($parentProduct->id, $superAttributes)) $superAttributes[$parentProduct->id] = $parentProduct->super_attributes()->pluck('code')->toArray(); - foreach (core()->getAllChannels() as $channel) { - foreach ($channel->locales as $locale) { - $productFlat = $this->productFlatRepository->findOneWhere([ - 'product_id' => $product->id, - 'channel' => $channel->code, - 'locale' => $locale->code - ]); + if (isset($product['channels'])) { + foreach ($product['channels'] as $channel) { + $channel = app('Webkul\Core\Repositories\ChannelRepository')->findOrFail($channel); + $channels[] = $channel['code']; + } + } else if (isset($parentProduct['channels'])){ + foreach ($parentProduct['channels'] as $channel) { + $channel = app('Webkul\Core\Repositories\ChannelRepository')->findOrFail($channel); + $channels[] = $channel['code']; + } + } else { + $channels[] = core()->getDefaultChannelCode(); + } - if (! $productFlat) { - $productFlat = $this->productFlatRepository->create([ + foreach (core()->getAllChannels() as $channel) { + if (in_array($channel->code, $channels)) { + foreach ($channel->locales as $locale) { + $productFlat = $this->productFlatRepository->findOneWhere([ 'product_id' => $product->id, 'channel' => $channel->code, 'locale' => $locale->code ]); - } - foreach ($familyAttributes[$product->attribute_family->id] as $attribute) { - if ($parentProduct && ! in_array($attribute->code, array_merge($superAttributes[$parentProduct->id], ['sku', 'name', 'price', 'weight', 'status']))) - continue; - - if (in_array($attribute->code, ['tax_category_id'])) - continue; - - if (! Schema::hasColumn('product_flat', $attribute->code)) - continue; - - if ($attribute->value_per_channel) { - if ($attribute->value_per_locale) { - $productAttributeValue = $product->attribute_values()->where('channel', $channel->code)->where('locale', $locale->code)->where('attribute_id', $attribute->id)->first(); - } else { - $productAttributeValue = $product->attribute_values()->where('channel', $channel->code)->where('attribute_id', $attribute->id)->first(); - } - } else { - if ($attribute->value_per_locale) { - $productAttributeValue = $product->attribute_values()->where('locale', $locale->code)->where('attribute_id', $attribute->id)->first(); - } else { - $productAttributeValue = $product->attribute_values()->where('attribute_id', $attribute->id)->first(); - } - } - - if ($product->type == 'configurable' && $attribute->code == 'price') { - $productFlat->{$attribute->code} = app('Webkul\Product\Helpers\Price')->getVariantMinPrice($product); - } else { - $productFlat->{$attribute->code} = $productAttributeValue[ProductAttributeValue::$attributeTypeFields[$attribute->type]]; - } - - if ($attribute->type == 'select') { - $attributeOption = $this->attributeOptionRepository->find($product->{$attribute->code}); - - if ($attributeOption) { - if ($attributeOptionTranslation = $attributeOption->translate($locale->code)) { - $productFlat->{$attribute->code . '_label'} = $attributeOptionTranslation->label; - } else { - $productFlat->{$attribute->code . '_label'} = $attributeOption->admin_name; - } - } - } elseif ($attribute->type == 'multiselect') { - $attributeOptionIds = explode(',', $product->{$attribute->code}); - - if (count($attributeOptionIds)) { - $attributeOptions = $this->attributeOptionRepository->findWhereIn('id', $attributeOptionIds); - - $optionLabels = []; - - foreach ($attributeOptions as $attributeOption) { - if ($attributeOptionTranslation = $attributeOption->translate($locale->code)) { - $optionLabels[] = $attributeOptionTranslation->label; - } else { - $optionLabels[] = $attributeOption->admin_name; - } - } - - $productFlat->{$attribute->code . '_label'} = implode(', ', $optionLabels); - } - } - } - - $productFlat->created_at = $product->created_at; - - $productFlat->updated_at = $product->updated_at; - - if ($parentProduct) { - $parentProductFlat = $this->productFlatRepository->findOneWhere([ - 'product_id' => $parentProduct->id, + if (! $productFlat) { + $productFlat = $this->productFlatRepository->create([ + 'product_id' => $product->id, 'channel' => $channel->code, 'locale' => $locale->code ]); - - if ($parentProductFlat) { - $productFlat->parent_id = $parentProductFlat->id; } - } - $productFlat->save(); + foreach ($familyAttributes[$product->attribute_family->id] as $attribute) { + if ($parentProduct && ! in_array($attribute->code, array_merge($superAttributes[$parentProduct->id], ['sku', 'name', 'price', 'weight', 'status']))) + continue; + + if (in_array($attribute->code, ['tax_category_id'])) + continue; + + if (! Schema::hasColumn('product_flat', $attribute->code)) + continue; + + if ($attribute->value_per_channel) { + if ($attribute->value_per_locale) { + $productAttributeValue = $product->attribute_values()->where('channel', $channel->code)->where('locale', $locale->code)->where('attribute_id', $attribute->id)->first(); + } else { + $productAttributeValue = $product->attribute_values()->where('channel', $channel->code)->where('attribute_id', $attribute->id)->first(); + } + } else { + if ($attribute->value_per_locale) { + $productAttributeValue = $product->attribute_values()->where('locale', $locale->code)->where('attribute_id', $attribute->id)->first(); + } else { + $productAttributeValue = $product->attribute_values()->where('attribute_id', $attribute->id)->first(); + } + } + + if ($product->type == 'configurable' && $attribute->code == 'price') { + $productFlat->{$attribute->code} = app('Webkul\Product\Helpers\Price')->getVariantMinPrice($product); + } else { + $productFlat->{$attribute->code} = $productAttributeValue[ProductAttributeValue::$attributeTypeFields[$attribute->type]]; + } + + if ($attribute->type == 'select') { + $attributeOption = $this->attributeOptionRepository->find($product->{$attribute->code}); + + if ($attributeOption) { + if ($attributeOptionTranslation = $attributeOption->translate($locale->code)) { + $productFlat->{$attribute->code . '_label'} = $attributeOptionTranslation->label; + } else { + $productFlat->{$attribute->code . '_label'} = $attributeOption->admin_name; + } + } + } elseif ($attribute->type == 'multiselect') { + $attributeOptionIds = explode(',', $product->{$attribute->code}); + + if (count($attributeOptionIds)) { + $attributeOptions = $this->attributeOptionRepository->findWhereIn('id', $attributeOptionIds); + + $optionLabels = []; + + foreach ($attributeOptions as $attributeOption) { + if ($attributeOptionTranslation = $attributeOption->translate($locale->code)) { + $optionLabels[] = $attributeOptionTranslation->label; + } else { + $optionLabels[] = $attributeOption->admin_name; + } + } + + $productFlat->{$attribute->code . '_label'} = implode(', ', $optionLabels); + } + } + } + + $productFlat->created_at = $product->created_at; + + $productFlat->updated_at = $product->updated_at; + + if ($parentProduct) { + $parentProductFlat = $this->productFlatRepository->findOneWhere([ + 'product_id' => $parentProduct->id, + 'channel' => $channel->code, + 'locale' => $locale->code + ]); + + if ($parentProductFlat) { + $productFlat->parent_id = $parentProductFlat->id; + } + } + + $productFlat->save(); + } + } else { + $productFlat = $this->productFlatRepository->findOneWhere([ + 'product_id' => $product->id, + 'channel' => $channel->code, + ]); + + if ($productFlat) { + $this->productFlatRepository->delete($productFlat->id); + } } } } diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php index c639af542..abdaf4ac5 100755 --- a/packages/Webkul/Product/src/Repositories/ProductRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductRepository.php @@ -260,6 +260,10 @@ class ProductRepository extends Repository $this->productImage->uploadImages($data, $product); } + if (isset($data['channels'])) { + $product['channels'] = $data['channels']; + } + Event::fire('catalog.product.update.after', $product); return $product; diff --git a/packages/Webkul/Shop/src/DataGrids/OrderDataGrid.php b/packages/Webkul/Shop/src/DataGrids/OrderDataGrid.php index 9248fab4c..15288f439 100644 --- a/packages/Webkul/Shop/src/DataGrids/OrderDataGrid.php +++ b/packages/Webkul/Shop/src/DataGrids/OrderDataGrid.php @@ -20,7 +20,7 @@ class OrderDataGrid extends DataGrid public function prepareQueryBuilder() { $queryBuilder = DB::table('orders as order') - ->addSelect('order.id', 'order.status', 'order.created_at', 'order.grand_total') + ->addSelect('order.id', 'order.status', 'order.created_at', 'order.grand_total', 'order.order_currency_code') ->where('customer_id', auth()->guard('customer')->user()->id); $this->setQueryBuilder($queryBuilder); @@ -49,10 +49,13 @@ class OrderDataGrid extends DataGrid $this->addColumn([ 'index' => 'grand_total', 'label' => trans('shop::app.customer.account.order.index.total'), - 'type' => 'price', + 'type' => 'number', 'searchable' => true, 'sortable' => true, - 'filterable' => true + 'filterable' => true, + 'wrapper' => function ($value) { + return core()->formatPrice($value->grand_total, $value->order_currency_code); + } ]); $this->addColumn([ diff --git a/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php b/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php index 190b3df2e..6d01be266 100755 --- a/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php @@ -1,7 +1,3 @@ -@php - $locale = Webkul\Core\Models\Locale::where('code', app()->getLocale())->first(); -@endphp - @@ -34,7 +30,8 @@ -direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;"> + +getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;"> {!! view_render_event('bagisto.shop.layout.body.before') !!} 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 7ef798090..e15147b98 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 @@ -2,24 +2,26 @@ @inject ('productFlatRepository', 'Webkul\Product\Repositories\ProductFlatRepository') -@inject ('productAttributeValueRepository', 'Webkul\Product\Repositories\ProductAttributeValueRepository') - getCategoryProductAttribute($category->id); + if (count($category->filterableAttributes) > 0) { + $filterAttributes = $category->filterableAttributes; + } else { + $categoryProductAttributes = $productFlatRepository->getCategoryProductAttribute($category->id); - if ($categoryProductAttributes) { - foreach ($attributeRepository->getFilterAttributes() as $filterAttribute) { - if (in_array($filterAttribute->id, $categoryProductAttributes)) { - $filterAttributes[] = $filterAttribute; - } else if ($filterAttribute ['code'] == 'price') { - $filterAttributes[] = $filterAttribute; + if ($categoryProductAttributes) { + foreach ($attributeRepository->getFilterAttributes() as $filterAttribute) { + if (in_array($filterAttribute->id, $categoryProductAttributes)) { + $filterAttributes[] = $filterAttribute; + } else if ($filterAttribute ['code'] == 'price') { + $filterAttributes[] = $filterAttribute; + } } - } - $filterAttributes = collect($filterAttributes); + $filterAttributes = collect($filterAttributes); + } } } else { $filterAttributes = $attributeRepository->getFilterAttributes();