diff --git a/README.md b/README.md index 30a18d51b..28af95aee 100755 --- a/README.md +++ b/README.md @@ -10,15 +10,15 @@ Sponsors on Open Collective

-# Topics -1. ### [Introduction](#1-introduction-) -2. ### [Documentation](#2-documentation-) -3. ### [Requirements](#2-requirements-) -4. ### [Installation & Configuration](#3-installation--configuration-) -5. ### [License](#4-license-) -6. ### [Miscellaneous](#5-miscellaneous-) +## Topics +1. [Introduction](#introduction) +2. [Documentation](#documentation) +3. [Requirements](#requirements) +4. [Installation & Configuration](#installation-and-configuration) +5. [License](#license) +6. [Miscellaneous](#miscellaneous) -### 1. Introduction : +### Introduction [Bagisto](https://www.bagisto.com) is a hand tailored E-Commerce framework designed on some of the hottest opensource technologies such as [Laravel](https://laravel.com) a [PHP](https://secure.php.net/) framework, [Vue.js](https://vuejs.org) @@ -54,11 +54,11 @@ It packs in lots of demanding features that allows your business to scale in no Dev guys can take advantage of two of the hottest frameworks used in this project Laravel and Vue.js, both of these frameworks have been used in Bagisto. Bagisto is using power of both of these frameworks and making best out of it out of the box. -### 2. Documentation : +### Documentation #### Bagisto Documentation [https://devdocs.bagisto.com](https://devdocs.bagisto.com) -### 3. Requirements : +### Requirements * **OS**: Ubuntu 16.04 LTS or higher. * **SERVER**: Apache 2 or NGINX @@ -70,7 +70,7 @@ Bagisto is using power of both of these frameworks and making best out of it out * **Node**: 8.11.3 LTS or higher. * **Composer**: 1.6.5 or higher. -### 4. Installation & Configuration : +### Installation and Configuration **1. Try our new GUI installer to install Bagisto:** @@ -172,36 +172,26 @@ password:admin123 > *http(s)://example.com/customer/register* -### 5. License : +### License Bagisto is a truly opensource E-Commerce framework which will always be free under the [MIT License](https://github.com/bagisto/bagisto/blob/master/LICENSE). -### 6. Miscellaneous : +### Miscellaneous #### Contributors -This project exists thanks to all the people who contribute. - +This project is on [Open Collective](https://opencollective.com/bagisto) and it exists thanks to this people who contribute. + #### Backers -Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/bagisto#backer)] - - +Thank you to all our backers! 🙏 + #### Sponsors -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/bagisto#sponsor)] +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. - - - - - - - - - - + diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php index 80bcfc648..30ec08e06 100755 --- a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -58,7 +58,7 @@ class CategoryDataGrid extends DataGrid $this->addColumn([ 'index' => 'position', 'label' => trans('admin::app.datagrid.position'), - 'type' => 'string', + 'type' => 'number', 'searchable' => false, 'sortable' => true, 'filterable' => true diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php index 820b4ad03..541232d08 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerGroupDataGrid.php @@ -38,7 +38,7 @@ class CustomerGroupDataGrid extends DataGrid $this->addColumn([ 'index' => 'code', 'label' => 'Code', - 'type' => 'number', + 'type' => 'string', 'searchable' => false, 'sortable' => true, 'filterable' => true diff --git a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php index 63dc7a54a..cf1f7b562 100755 --- a/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/LocalesDataGrid.php @@ -19,7 +19,7 @@ class LocalesDataGrid extends DataGrid public function prepareQueryBuilder() { - $queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name'); + $queryBuilder = DB::table('locales')->addSelect('id', 'code', 'name', 'direction'); $this->setQueryBuilder($queryBuilder); } @@ -52,6 +52,15 @@ class LocalesDataGrid extends DataGrid 'sortable' => true, 'filterable' => true ]); + + $this->addColumn([ + 'index' => 'direction', + 'label' => trans('admin::app.datagrid.direction'), + 'type' => 'string', + 'searchable' => true, + 'sortable' => true, + 'filterable' => true + ]); } public function prepareActions() { diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index 9391c3b6a..3aefe0d71 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -115,6 +115,7 @@ return [ 'code' => 'Code', 'admin-name' => 'Name', 'name' => 'Name', + 'direction' => 'Direction', 'fullname' => 'Full Name', 'type' => 'Type', 'required' => 'Required', @@ -398,7 +399,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' => [ @@ -449,7 +451,8 @@ return [ 'swatch' => 'Swatch', 'image' => 'Image', 'file' => 'File', - 'checkbox' => 'Checkbox' + 'checkbox' => 'Checkbox', + 'use_in_flat' => "Create in Product Flat Table", ], 'families' => [ 'title' => 'Families', @@ -493,6 +496,8 @@ return [ 'meta_description' => 'Meta Description', 'meta_keywords' => 'Meta Keywords', 'image' => 'Image', + 'filterable-attributes' => 'Filterable Attributes', + 'attributes' => 'Attributes', ] ], @@ -564,6 +569,7 @@ return [ 'general' => 'General', 'code' => 'Code', 'name' => 'Name', + 'direction' => 'Direction', 'create-success' => 'Locale created successfully.', 'update-success' => 'Locale updated successfully.', 'delete-success' => 'Locale deleted successfully.', diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php index 86be00c7a..1c0450dd2 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php @@ -36,7 +36,7 @@ {!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.general.controls.before') !!}
- + @{{ errors.first('code') }}
@@ -205,6 +205,14 @@ +
+ + +
+ {!! view_render_event('bagisto.admin.catalog.attribute.create_form_accordian.configuration.controls.after') !!} diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php index 2d63cf7bf..4199277ab 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php @@ -266,6 +266,18 @@ +
+ + +
+ {!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.after', ['attribute' => $attribute]) !!} 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 4f041477f..dc413a9ad 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 7e435f8d8..639ae268e 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 6542cf416..d23fca476 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 700e3e059..d6e37d002 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 @@ -61,7 +61,7 @@ } if (! isset($field['options'])) { - $field['options'] = [['title' => 'No', 'value' => 0],['title' => 'Yes', 'value' => 1]]; + $field['options'] = ''; } $selectedOption = core()->getConfigData($name) ?? ''; @@ -100,6 +100,7 @@ + @elseif ($field['type'] == 'textarea') @@ -399,11 +400,14 @@ [@{{ channel_locale }}] - + + @{{ errors.first(name) }} @@ -422,8 +426,8 @@ data: function() { return { - isVisible: false, isRequire: false, + isVisible: false, } }, @@ -434,28 +438,40 @@ this_this.isRequire = true; } - var dependentElement = document.getElementById(this_this.depend); - var dependValue = this_this.value; + $(document).ready(function(){ + var dependentElement = document.getElementById(this_this.depend); + var dependValue = this_this.value; - if (dependValue == 'true') { - dependValue = 1; - } else if (dependValue == 'false') { - dependValue = 0; - } + if (dependValue == 'true') { + dependValue = 1; + } else if (dependValue == 'false') { + dependValue = 0; + } - $("select.control").change(function() { - if (dependentElement.value == dependValue) { + $(document).on("change", "select.control", function() { + if (this_this.depend == this.name) { + if (this_this.value == this.value) { + this_this.isVisible = true; + } else { + this_this.isVisible = false; + } + } + }) + + if (dependentElement && dependentElement.value == dependValue) { this_this.isVisible = true; } else { this_this.isVisible = false; } - }); - if (dependentElement.value == dependValue) { - 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; + } + } + }); } }); 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 9f3ca20ef..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 @@ -67,7 +67,7 @@ {!! view_render_event('bagisto.admin.layout.head') !!} - getLocale() == 'ar') class="rtl" @endif style="scroll-behavior: smooth;"> + getCurrentLocale()->direction == 'rtl') class="rtl" @endif style="scroll-behavior: smooth;">
@@ -131,4 +131,4 @@ - \ No newline at end of file + 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 3c20e22e5..d61ba724f 100755 --- a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php @@ -19,7 +19,7 @@ - getLocale() == 'ar') 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/settings/locales/create.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/locales/create.blade.php index 7f5040d5d..253d0a029 100755 --- a/packages/Webkul/Admin/src/Resources/views/settings/locales/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/locales/create.blade.php @@ -41,6 +41,15 @@ @{{ errors.first('name') }}
+ +
+ + + @{{ errors.first('direction') }} +
diff --git a/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php index e00abf45d..adf417dea 100755 --- a/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php @@ -44,6 +44,15 @@ @{{ errors.first('name') }} + +
+ + + @{{ errors.first('direction') }} +
diff --git a/packages/Webkul/Admin/src/Resources/views/settings/sliders/create.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/sliders/create.blade.php index c99de65cd..f47c07525 100755 --- a/packages/Webkul/Admin/src/Resources/views/settings/sliders/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/sliders/create.blade.php @@ -27,7 +27,7 @@
@csrf()
- + @{{ errors.first('title') }}
diff --git a/packages/Webkul/Admin/src/Resources/views/settings/sliders/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/sliders/edit.blade.php index ad6ed0cfa..bd17341f5 100755 --- a/packages/Webkul/Admin/src/Resources/views/settings/sliders/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/sliders/edit.blade.php @@ -29,7 +29,7 @@ @csrf()
- + @{{ errors.first('title') }}
diff --git a/packages/Webkul/Attribute/src/Database/Migrations/2019_07_29_142734_add_use_in_flat_column_in_attributes_table.php b/packages/Webkul/Attribute/src/Database/Migrations/2019_07_29_142734_add_use_in_flat_column_in_attributes_table.php new file mode 100644 index 000000000..d52675871 --- /dev/null +++ b/packages/Webkul/Attribute/src/Database/Migrations/2019_07_29_142734_add_use_in_flat_column_in_attributes_table.php @@ -0,0 +1,32 @@ +boolean('use_in_flat')->default(1); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('attributes', function (Blueprint $table) { + // + }); + } +} diff --git a/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php b/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php index 68bacea58..380710c38 100755 --- a/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php +++ b/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php @@ -16,30 +16,50 @@ class AttributeTableSeeder extends Seeder $now = Carbon::now(); DB::table('attributes')->insert([ - ['id' => '1','code' => 'sku','admin_name' => 'SKU','type' => 'text','validation' => NULL,'position' => '1','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '2','code' => 'name','admin_name' => 'Name','type' => 'text','validation' => NULL,'position' => '2','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '3','code' => 'url_key','admin_name' => 'URL Key','type' => 'text','validation' => NULL,'position' => '3','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '4','code' => 'tax_category_id','admin_name' => 'Tax Category','type' => 'select','validation' => NULL,'position' => '4','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '5','code' => 'new','admin_name' => 'New','type' => 'boolean','validation' => NULL,'position' => '5','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '6','code' => 'featured','admin_name' => 'Featured','type' => 'boolean','validation' => NULL,'position' => '6','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '7','code' => 'visible_individually','admin_name' => 'Visible Individually','type' => 'boolean','validation' => NULL,'position' => '7','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '8','code' => 'status','admin_name' => 'Status','type' => 'boolean','validation' => NULL,'position' => '8','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '9','code' => 'short_description','admin_name' => 'Short Description','type' => 'textarea','validation' => NULL,'position' => '9','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '10','code' => 'description','admin_name' => 'Description','type' => 'textarea','validation' => NULL,'position' => '10','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '11','code' => 'price','admin_name' => 'Price','type' => 'price','validation' => 'decimal','position' => '11','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '12','code' => 'cost','admin_name' => 'Cost','type' => 'price','validation' => 'decimal','position' => '12','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '13','code' => 'special_price','admin_name' => 'Special Price','type' => 'price','validation' => 'decimal','position' => '13','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '14','code' => 'special_price_from','admin_name' => 'Special Price From','type' => 'date','validation' => NULL,'position' => '14','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '15','code' => 'special_price_to','admin_name' => 'Special Price To','type' => 'date','validation' => NULL,'position' => '15','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '16','code' => 'meta_title','admin_name' => 'Meta Title','type' => 'textarea','validation' => NULL,'position' => '16','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '17','code' => 'meta_keywords','admin_name' => 'Meta Keywords','type' => 'textarea','validation' => NULL,'position' => '17','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '18','code' => 'meta_description','admin_name' => 'Meta Description','type' => 'textarea','validation' => NULL,'position' => '18','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '19','code' => 'width','admin_name' => 'Width','type' => 'text','validation' => 'decimal','position' => '19','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '20','code' => 'height','admin_name' => 'Height','type' => 'text','validation' => 'decimal','position' => '20','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '21','code' => 'depth','admin_name' => 'Depth','type' => 'text','validation' => 'decimal','position' => '21','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '22','code' => 'weight','admin_name' => 'Weight','type' => 'text','validation' => 'decimal','position' => '22','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '23','code' => 'color','admin_name' => 'Color','type' => 'select','validation' => NULL,'position' => '23','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '24','code' => 'size','admin_name' => 'Size','type' => 'select','validation' => NULL,'position' => '24','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now] + ['id' => '1','code' => 'sku','admin_name' => 'SKU','type' => 'text','validation' => NULL,'position' => '1','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '2','code' => 'name','admin_name' => 'Name','type' => 'text','validation' => NULL,'position' => '2','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '3','code' => 'url_key','admin_name' => 'URL Key','type' => 'text','validation' => NULL,'position' => '3','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '4','code' => 'tax_category_id','admin_name' => 'Tax Category','type' => 'select','validation' => NULL,'position' => '4','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '5','code' => 'new','admin_name' => 'New','type' => 'boolean','validation' => NULL,'position' => '5','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '6','code' => 'featured','admin_name' => 'Featured','type' => 'boolean','validation' => NULL,'position' => '6','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '7','code' => 'visible_individually','admin_name' => 'Visible Individually','type' => 'boolean','validation' => NULL,'position' => '7','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now, + 'use_in_flat' => '1','updated_at' => $now], + ['id' => '8','code' => 'status','admin_name' => 'Status','type' => 'boolean','validation' => NULL,'position' => '8','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '9','code' => 'short_description','admin_name' => 'Short Description','type' => 'textarea','validation' => NULL,'position' => '9','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0', + 'is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '10','code' => 'description','admin_name' => 'Description','type' => 'textarea','validation' => NULL,'position' => '10','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '11','code' => 'price','admin_name' => 'Price','type' => 'price','validation' => 'decimal','position' => '11','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '12','code' => 'cost','admin_name' => 'Cost','type' => 'price','validation' => 'decimal','position' => '12','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '13','code' => 'special_price','admin_name' => 'Special Price','type' => 'price','validation' => 'decimal','position' => '13','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '14','code' => 'special_price_from','admin_name' => 'Special Price From','type' => 'date','validation' => NULL,'position' => '14','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '15','code' => 'special_price_to','admin_name' => 'Special Price To','type' => 'date','validation' => NULL,'position' => '15','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0', + 'use_in_flat' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], + ['id' => '16','code' => 'meta_title','admin_name' => 'Meta Title','type' => 'textarea','validation' => NULL,'position' => '16','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '17','code' => 'meta_keywords','admin_name' => 'Meta Keywords','type' => 'textarea','validation' => NULL,'position' => '17','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '18','code' => 'meta_description','admin_name' => 'Meta Description','type' => 'textarea','validation' => NULL,'position' => '18','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '19','code' => 'width','admin_name' => 'Width','type' => 'text','validation' => 'decimal','position' => '19','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '20','code' => 'height','admin_name' => 'Height','type' => 'text','validation' => 'decimal','position' => '20','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '21','code' => 'depth','admin_name' => 'Depth','type' => 'text','validation' => 'decimal','position' => '21','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '22','code' => 'weight','admin_name' => 'Weight','type' => 'text','validation' => 'decimal','position' => '22','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '23','code' => 'color','admin_name' => 'Color','type' => 'select','validation' => NULL,'position' => '23','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + ['id' => '24','code' => 'size','admin_name' => 'Size','type' => 'select','validation' => NULL,'position' => '24','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0', + 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now] ]); diff --git a/packages/Webkul/Attribute/src/Models/Attribute.php b/packages/Webkul/Attribute/src/Models/Attribute.php index e6bf8ba94..244d94497 100755 --- a/packages/Webkul/Attribute/src/Models/Attribute.php +++ b/packages/Webkul/Attribute/src/Models/Attribute.php @@ -9,7 +9,7 @@ class Attribute extends TranslatableModel implements AttributeContract { public $translatedAttributes = ['name']; - protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'validation', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front', 'is_user_defined', 'swatch_type']; + protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'validation', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front', 'is_user_defined', 'swatch_type', 'use_in_flat']; // protected $with = ['options']; 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 0dd74be1a..e6380d55f 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/Core/src/Database/Migrations/2019_07_23_033128_alter_locales_table.php b/packages/Webkul/Core/src/Database/Migrations/2019_07_23_033128_alter_locales_table.php new file mode 100644 index 000000000..bcca3d042 --- /dev/null +++ b/packages/Webkul/Core/src/Database/Migrations/2019_07_23_033128_alter_locales_table.php @@ -0,0 +1,30 @@ +enum('direction', ['ltr', 'rtl'])->default('ltr'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + + } +} diff --git a/packages/Webkul/Core/src/Http/Controllers/LocaleController.php b/packages/Webkul/Core/src/Http/Controllers/LocaleController.php index ff8f5f058..16b28287e 100755 --- a/packages/Webkul/Core/src/Http/Controllers/LocaleController.php +++ b/packages/Webkul/Core/src/Http/Controllers/LocaleController.php @@ -72,7 +72,8 @@ class LocaleController extends Controller { $this->validate(request(), [ 'code' => ['required', 'unique:locales,code', new \Webkul\Core\Contracts\Validations\Code], - 'name' => 'required' + 'name' => 'required', + 'direction' => 'in:ltr,rtl' ]); Event::fire('core.locale.create.before'); @@ -110,7 +111,8 @@ class LocaleController extends Controller { $this->validate(request(), [ 'code' => ['required', 'unique:locales,code,' . $id, new \Webkul\Core\Contracts\Validations\Code], - 'name' => 'required' + 'name' => 'required', + 'direction' => 'in:ltr,rtl' ]); Event::fire('core.locale.update.before', $id); diff --git a/packages/Webkul/Core/src/Models/Locale.php b/packages/Webkul/Core/src/Models/Locale.php index b12be89de..572e576a5 100755 --- a/packages/Webkul/Core/src/Models/Locale.php +++ b/packages/Webkul/Core/src/Models/Locale.php @@ -13,6 +13,6 @@ class Locale extends Model implements LocaleContract * @var array */ protected $fillable = [ - 'code', 'name' + 'code', 'name', 'direction' ]; -} \ No newline at end of file +} 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/Controllers/SessionController.php b/packages/Webkul/Customer/src/Http/Controllers/SessionController.php index 29ed847ce..b98f01490 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/SessionController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/SessionController.php @@ -38,7 +38,7 @@ class SessionController extends Controller public function show() { if (auth()->guard('customer')->check()) { - return redirect()->route('customer.session.index'); + return redirect()->route('customer.profile.index'); } else { return view($this->_config['view']); } diff --git a/packages/Webkul/Discount/src/Helpers/ConvertXToProductId.php b/packages/Webkul/Discount/src/Helpers/ConvertXToProductId.php index 6f0862367..ce7114867 100644 --- a/packages/Webkul/Discount/src/Helpers/ConvertXToProductId.php +++ b/packages/Webkul/Discount/src/Helpers/ConvertXToProductId.php @@ -191,6 +191,8 @@ class ConvertXToProductId /** * This method will return product id from the attribute and attribute option params * + * @param Collection $categories + * * @return array */ public function convertFromCategories($categories) @@ -238,6 +240,10 @@ class ConvertXToProductId /** * This method will save the product ids in the datastore * + * @param integer $ruleId + * + * @param array $productIDs + * * @return boolean */ public function saveIDs($ruleId, $productIDs) @@ -252,12 +258,16 @@ class ConvertXToProductId } /** + * To get all product ids lying in the criteria + * * @param integer $categoryId + * * @return Collection */ public function getAll($categoryId = null) { - $results = app('Webkul\Product\Repositories\ProductFlatRepository')->scopeQuery(function($query) use($categoryId) { + + $results = app('Webkul\Product\Repositories\ProductFlatRepository')->scopeQuery(function($query) use ($categoryId) { $channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode()); @@ -267,6 +277,7 @@ class ConvertXToProductId ->select('products.id') ->leftJoin('products', 'product_flat.product_id', '=', 'products.id') ->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id') + ->where('products.type', '!=', 'configurable') ->whereNotNull('product_flat.url_key'); if ($categoryId) { diff --git a/packages/Webkul/Discount/src/Helpers/Discount.php b/packages/Webkul/Discount/src/Helpers/Discount.php index 5da571301..a0ef852e1 100644 --- a/packages/Webkul/Discount/src/Helpers/Discount.php +++ b/packages/Webkul/Discount/src/Helpers/Discount.php @@ -158,6 +158,13 @@ abstract class Discount return $sortedRules; } + /** + * To check where rule ends other rules + * + * @param CartRule $rule + * + * @return $rule + */ public function isEndRule($rule) { if ($rules->end_other_rules) { @@ -170,6 +177,8 @@ abstract class Discount /** * To find whether rule can be applied or not * + * @param CartRule $rule + * * @return boolean */ public function canApply($rule) @@ -257,7 +266,9 @@ abstract class Discount /** * Return the instance of the related rule's action type * - * @return object + * @param CartRule $rule + * + * @return Object */ public function getActionInstance($rule) { @@ -269,7 +280,9 @@ abstract class Discount /** * Checks whether rules is getting applied on current cart instance or not * - * @return boolean + * @param CartRule $rule + * + * @return Boolean */ public function checkApplicability($rule) { @@ -354,7 +367,7 @@ abstract class Discount * * @param CartRule $rule * - * @return boolean + * @return Boolean */ public function save($rule) { @@ -383,90 +396,42 @@ abstract class Discount } } - /** - * Checks whether rule is getting applied on shipping or not - */ - public function checkOnShipping($cart) - { - if (! isset($cart->selected_shipping_rate)) { - return false; - } - - $shippingRate = config('carriers')[$cart->selected_shipping_rate->carrier]['class']; - - $actualShippingRate = new $shippingRate; - $actualShippingRate = $actualShippingRate->calculate(); - - if (is_array($actualShippingRate)) { - foreach ($actualShippingRate as $actualRate) { - if ($actualRate->method == $cart->selected_shipping_rate->method) { - $actualShippingRate = $actualRate; - - break; - } - } - } - - $actualShippingPrice = $actualShippingRate->price; - $actualShippingBasePrice = $actualShippingRate->base_price; - - $alreadyAppliedCartRuleCart = $this->cartRuleCart->findWhere([ - 'cart_id' => $cart->id - ]); - - if (count($alreadyAppliedCartRuleCart)) { - $this->resetShipping($cart); - - $alreadyAppliedRule = $alreadyAppliedCartRuleCart->first()->cart_rule; - - $cartShippingRate = $cart->selected_shipping_rate; - - if (isset($cartShippingRate)) { - if ($cartShippingRate->base_price < $actualShippingBasePrice) { - return false; - } else { - $this->applyOnShipping($alreadyAppliedRule, $cart); - } - } else { - $this->applyOnShipping($alreadyAppliedRule, $cart); - } - } else { - $this->resetShipping($cart); - } - } - /** * Apply on shipping * + * @param CartRule $apploedRule + * + * @param Cart $cart + * * @return void */ public function applyOnShipping($appliedRule, $cart) { - // $cart = \Cart::getCart(); + $cart = \Cart::getCart(); - // if (isset($cart->selected_shipping_rate)) { - // if ($appliedRule->free_shipping && $cart->selected_shipping_rate->base_price > 0) { - // $cart->selected_shipping_rate->update([ - // 'price' => 0, - // 'base_price' => 0 - // ]); - // } else if ($appliedRule->free_shipping == 0 && $appliedRule->apply_to_shipping && $cart->selected_shipping_rate->base_price > 0) { - // $actionType = config('discount-rules')[$appliedRule->action_type]; + if (isset($cart->selected_shipping_rate)) { + if ($appliedRule->free_shipping && $cart->selected_shipping_rate->base_price > 0) { + $cart->selected_shipping_rate->update([ + 'price' => 0, + 'base_price' => 0 + ]); + } else if ($appliedRule->free_shipping == 0 && $appliedRule->apply_to_shipping && $cart->selected_shipping_rate->base_price > 0) { + $actionType = config('discount-rules')[$appliedRule->action_type]; - // if ($appliedRule->apply_to_shipping) { - // $actionInstance = new $actionType; + if ($appliedRule->apply_to_shipping) { + $actionInstance = new $actionType; - // $discountOnShipping = $actionInstance->calculateOnShipping($cart); + $discountOnShipping = $actionInstance->calculateOnShipping($cart); - // $discountOnShipping = ($discountOnShipping / 100) * $cart->selected_shipping_rate->base_price; + $discountOnShipping = ($discountOnShipping / 100) * $cart->selected_shipping_rate->base_price; - // $cart->selected_shipping_rate->update([ - // 'price' => $cart->selected_shipping_rate->price - core()->convertPrice($discountOnShipping, $cart->cart_currency_code), - // 'base_price' => $cart->selected_shipping_rate->base_price - $discountOnShipping - // ]); - // } - // } - // } + $cart->selected_shipping_rate->update([ + 'price' => $cart->selected_shipping_rate->price - core()->convertPrice($discountOnShipping, $cart->cart_currency_code), + 'base_price' => $cart->selected_shipping_rate->base_price - $discountOnShipping + ]); + } + } + } } /** @@ -545,6 +510,10 @@ abstract class Discount ]); } + if ($rule->free_shipping || $rule->apply_on_shipping) { + $this->applyOnShipping($rule); + } + Cart::collectTotals(); return true; diff --git a/packages/Webkul/Product/src/Listeners/ProductFlat.php b/packages/Webkul/Product/src/Listeners/ProductFlat.php index fc6ca23b0..07008b11a 100644 --- a/packages/Webkul/Product/src/Listeners/ProductFlat.php +++ b/packages/Webkul/Product/src/Listeners/ProductFlat.php @@ -103,7 +103,12 @@ class ProductFlat */ public function afterAttributeCreatedUpdated($attribute) { - if(! $attribute->is_user_defined || $attribute->is_visible_on_front) { + if (! $attribute->is_user_defined) { + return false; + } + + if (! $attribute->use_in_flat) { + $this->afterAttributeDeleted($attribute->id); return false; } @@ -169,100 +174,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/ProductFlatRepository.php b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php index 21c153762..d29abd4ed 100644 --- a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php @@ -44,10 +44,12 @@ class ProductFlatRepository extends Repository */ public function getCategoryProductMaximumPrice($categoryId) { - return $this->model - ->leftJoin('product_categories', 'product_flat.product_id', 'product_categories.product_id') - ->where('product_categories.category_id', $categoryId) - ->max('price'); + // return $this->model + // ->leftJoin('product_categories', 'product_flat.product_id', 'product_categories.product_id') + // ->where('product_categories.category_id', $categoryId) + // ->max('price'); + + return $this->model->max('price'); } /** @@ -65,11 +67,26 @@ class ProductFlatRepository extends Repository * * return array */ - public function getCategoryProduct($categoryId) + public function getCategoryProductAttribute($categoryId) { - return $this->model + $qb = $this->model ->leftJoin('product_categories', 'product_flat.product_id', 'product_categories.product_id') ->where('product_categories.category_id', $categoryId) - ->get(); + ->where('product_flat.channel', core()->getCurrentChannelCode()) + ->where('product_flat.locale', app()->getLocale()); + + $productArrributes = $qb + ->leftJoin('product_attribute_values as pa', 'product_flat.product_id', 'pa.product_id') + ->pluck('pa.attribute_id') + ->toArray(); + + $productSuperArrributes = $qb + ->leftJoin('product_super_attributes as ps', 'product_flat.product_id', 'ps.product_id') + ->pluck('ps.attribute_id') + ->toArray(); + + $productCategoryArrributes = array_unique(array_merge($productArrributes, $productSuperArrributes)); + + return $productCategoryArrributes; } } \ No newline at end of file diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php index bab0bffad..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; @@ -500,28 +504,39 @@ class ProductRepository extends Repository } } - $qb = $qb->where(function($query1) { - foreach (['product_flat', 'flat_variants'] as $alias) { - $query1 = $query1->orWhere(function($query2) use($alias) { - $attributes = $this->attribute->getProductDefaultAttributes(array_keys(request()->input())); + $qb = $qb->leftJoin('products as variants', 'products.id', '=', 'variants.parent_id'); - foreach ($attributes as $attribute) { - $column = $alias . '.' . $attribute->code; + $qb = $qb->where(function($query1) use($qb) { + $aliases = [ + 'products' => 'filter_', + 'variants' => 'variant_filter_' + ]; - $queryParams = explode(',', request()->get($attribute->code)); + foreach($aliases as $table => $alias) { + $query1 = $query1->orWhere(function($query2) use($qb, $table, $alias) { + + foreach ($this->attribute->getProductDefaultAttributes(array_keys(request()->input())) as $code => $attribute) { + $aliasTemp = $alias . $attribute->code; + + $qb = $qb->leftJoin('product_attribute_values as ' . $aliasTemp, $table . '.id', '=', $aliasTemp . '.product_id'); + + $column = ProductAttributeValue::$attributeTypeFields[$attribute->type]; + + $temp = explode(',', request()->get($attribute->code)); if ($attribute->type != 'price') { - $query2 = $query2->where(function($query3) use($column, $queryParams) { - foreach ($queryParams as $filterValue) { - $query3 = $query3->orwhereRaw("find_in_set($filterValue, $column)"); + $query2 = $query2->where($aliasTemp . '.attribute_id', $attribute->id); + + $query2 = $query2->where(function($query3) use($aliasTemp, $column, $temp) { + foreach($temp as $code => $filterValue) { + $columns = $aliasTemp . '.' . $column; + $query3 = $query3->orwhereRaw("find_in_set($filterValue, $columns)"); } }); } else { - if ($attribute->code != 'price') { - $query2 = $query2->where($column, '>=', current($queryParams))->where($column, '<=', end($queryParams)); - } else { - $query2 = $query2->where($column, '>=', core()->convertToBasePrice(current($queryParams)))->where($column, '<=', core()->convertToBasePrice(end($queryParams))); - } + $query2 = $query2->where($aliasTemp . '.' . $column, '>=', core()->convertToBasePrice(current($temp))) + ->where($aliasTemp . '.' . $column, '<=', core()->convertToBasePrice(end($temp))) + ->where($aliasTemp . '.attribute_id', $attribute->id); } } }); 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/Http/Middleware/Locale.php b/packages/Webkul/Shop/src/Http/Middleware/Locale.php index 2779fbb6a..4d882b192 100755 --- a/packages/Webkul/Shop/src/Http/Middleware/Locale.php +++ b/packages/Webkul/Shop/src/Http/Middleware/Locale.php @@ -29,9 +29,9 @@ class Locale */ public function handle($request, Closure $next) { - $localCode = request()->get('locale'); + $locale = request()->get('locale'); - if ($locale = $localCode) { + if ($locale) { if ($this->locale->findOneByField('code', $locale)) { app()->setLocale($locale); @@ -40,6 +40,8 @@ class Locale } else { if ($locale = session()->get('locale')) { app()->setLocale($locale); + } else { + app()->setLocale(core()->getDefaultChannel()->default_locale->code); } } diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php index d77d27bc9..5cb81774b 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/review.blade.php @@ -70,7 +70,10 @@ product; - $productBaseImage = $productImageHelper->getProductBaseImage($product); + if ($product->type == "configurable") + $productBaseImage = $productImageHelper->getProductBaseImage($item->child->product); + else + $productBaseImage = $productImageHelper->getProductBaseImage($item->product); ?>
diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php index c5378930e..3280ae310 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/orders/pdf.blade.php @@ -47,6 +47,7 @@ border-left: solid 1px #d3d3d3; color: $font-color; vertical-align: middle; + font-family: DejaVu Sans; sans-serif; } .table tbody td p { @@ -64,6 +65,7 @@ .sale-summary tr td { padding: 3px 5px; + font-family: DejaVu Sans; sans-serif; } .sale-summary tr.bold { @@ -74,7 +76,7 @@ color: #000; font-weight: 600; } - + @@ -115,7 +117,7 @@

{{ $invoice->order->billing_address->city }}

{{ $invoice->order->billing_address->state }}

{{ core()->country_name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}

- {{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->billing_address->phone }} + {{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->billing_address->phone }}

{{ $invoice->order->shipping_address->name }}

@@ -123,7 +125,7 @@

{{ $invoice->order->shipping_address->city }}

{{ $invoice->order->shipping_address->state }}

{{ core()->country_name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}

- {{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->shipping_address->phone }} + {{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->shipping_address->phone }} @@ -151,7 +153,7 @@
- +
@@ -178,11 +180,11 @@

{{ $html }}

@endif - + - - - + + + @endforeach @@ -195,25 +197,25 @@ - + - + - + - +
{{ core()->formatBasePrice($item->base_price) }}{{ core()->formatPrice($item->price, $invoice->order->order_currency_code) }} {{ $item->qty }}{{ core()->formatBasePrice($item->base_total) }}{{ core()->formatBasePrice($item->base_tax_amount) }}{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount) }}{{ core()->formatPrice($item->total, $invoice->order->order_currency_code) }}{{ core()->formatPrice($item->tax_amount, $invoice->order->order_currency_code) }}{{ core()->formatPrice(($item->total + $item->tax_amount), $invoice->order->order_currency_code) }}
{{ __('shop::app.customer.account.order.view.subtotal') }} -{{ core()->formatPrice($invoice->base_sub_total, $invoice->order->order_currency_code) }}{{ core()->formatPrice($invoice->sub_total, $invoice->order->order_currency_code) }}
{{ __('shop::app.customer.account.order.view.shipping-handling') }} -{{ core()->formatPrice($invoice->base_shipping_amount, $invoice->order->order_currency_code) }}{{ core()->formatPrice($invoice->shipping_amount, $invoice->order->order_currency_code) }}
{{ __('shop::app.customer.account.order.view.tax') }} -{{ core()->formatPrice($invoice->base_tax_amount, $invoice->order->order_currency_code) }}{{ core()->formatPrice($invoice->tax_amount, $invoice->order->order_currency_code) }}
{{ __('shop::app.customer.account.order.view.grand-total') }} -{{ core()->formatPrice($invoice->base_grand_total, $invoice->order->order_currency_code) }}{{ core()->formatPrice($invoice->grand_total, $invoice->order->order_currency_code) }}
@@ -222,4 +224,3 @@
- \ No newline at end of file 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 eec8f0d86..73d671742 100755 --- a/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php @@ -32,7 +32,8 @@ -getLocale() == 'ar') 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 2291916d5..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,41 +2,27 @@ @inject ('productFlatRepository', 'Webkul\Product\Repositories\ProductFlatRepository') -@inject ('productAttributeValueRepository', 'Webkul\Product\Repositories\ProductAttributeValueRepository') - getCategoryProduct($category->id); + if (count($category->filterableAttributes) > 0) { + $filterAttributes = $category->filterableAttributes; + } else { + $categoryProductAttributes = $productFlatRepository->getCategoryProductAttribute($category->id); - foreach ($categoryProduct as $product) { - $attributes = $productAttributeValueRepository->findByField('product_id', $product->product_id); - - if ($product->product->type == 'configurable') { - foreach ($product->product->super_attributes as $super_attribute) { - $productAttribute[] = $super_attribute->id; + if ($categoryProductAttributes) { + foreach ($attributeRepository->getFilterAttributes() as $filterAttribute) { + if (in_array($filterAttribute->id, $categoryProductAttributes)) { + $filterAttributes[] = $filterAttribute; + } else if ($filterAttribute ['code'] == 'price') { + $filterAttributes[] = $filterAttribute; + } } - } - foreach ($attributes as $attribute) { - if ($attribute) { - $productAttribute[] = $attribute->attribute_id; - } + $filterAttributes = collect($filterAttributes); } } - - if (isset($productAttribute)) { - foreach ($attributeRepository->getFilterAttributes() as $filterAttribute) { - if (in_array($filterAttribute->id, array_unique($productAttribute))) { - $filterAttributes[] = $filterAttribute; - } else if ($filterAttribute ['code'] == 'price') { - $filterAttributes[] = $filterAttribute; - } - } - } - - $filterAttributes = collect($filterAttributes); } else { $filterAttributes = $attributeRepository->getFilterAttributes(); } diff --git a/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php index 7d81738ad..45f3ce06d 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view/gallery.blade.php @@ -108,7 +108,9 @@ this.currentOriginalImageUrl = image.original_image_url; - $('img#pro-img').data('zoom-image', image.original_image_url).ezPlus(); + if ($(window).width() > 580) { + $('img#pro-img').data('zoom-image', image.original_image_url).ezPlus(); + } }, moveThumbs: function(direction) { @@ -152,7 +154,9 @@