Performence Optimized

This commit is contained in:
jitendra 2018-10-12 13:52:06 +05:30
parent 7a7e25b11d
commit 71ea17d9d7
30 changed files with 864 additions and 129 deletions

View File

@ -18,6 +18,7 @@
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0",
"nwidart/laravel-modules": "^3.2",
"pragmarx/countries": "^0.5.9",
"prettus/l5-repository": "^2.6",
"propaganistas/laravel-intl": "^2.0"
},

607
composer.lock generated
View File

@ -4,8 +4,72 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "762c5c196d8a9a7814101fd53d60b1cf",
"content-hash": "78d80b8455ca268cc52ce6456fee6ee0",
"packages": [
{
"name": "colinodell/json5",
"version": "v1.0.5",
"source": {
"type": "git",
"url": "https://github.com/colinodell/json5.git",
"reference": "8c73e1a5cd933ed0e29fb5d5997f23902bd9804c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/colinodell/json5/zipball/8c73e1a5cd933ed0e29fb5d5997f23902bd9804c",
"reference": "8c73e1a5cd933ed0e29fb5d5997f23902bd9804c",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"php": "^5.4.8|^7.0"
},
"require-dev": {
"mikehaertl/php-shellcommand": "^1.2.5",
"phpunit/phpunit": "^4.8.36|^7.3",
"squizlabs/php_codesniffer": "^2.3",
"symfony/finder": "^2.8|^3.4|^4.1"
},
"bin": [
"bin/json5"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"ColinODell\\Json5\\": "src"
},
"files": [
"src/global.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Colin O'Dell",
"email": "colinodell@gmail.com",
"homepage": "https://www.colinodell.com",
"role": "Developer"
}
],
"description": "UTF-8 compatible JSON5 parser for PHP",
"homepage": "https://github.com/colinodell/json5",
"keywords": [
"JSON5",
"json",
"json5_decode",
"json_decode"
],
"time": "2018-09-20T15:43:07+00:00"
},
{
"name": "commerceguys/intl",
"version": "v1.0.1",
@ -1506,6 +1570,219 @@
],
"time": "2018-03-19T15:50:49+00:00"
},
{
"name": "nette/caching",
"version": "v2.5.8",
"source": {
"type": "git",
"url": "https://github.com/nette/caching.git",
"reference": "7fba7c7ab2585fafb7b31152f2595e1551120555"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/caching/zipball/7fba7c7ab2585fafb7b31152f2595e1551120555",
"reference": "7fba7c7ab2585fafb7b31152f2595e1551120555",
"shasum": ""
},
"require": {
"nette/finder": "^2.2 || ~3.0.0",
"nette/utils": "^2.4 || ~3.0.0",
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"latte/latte": "^2.4",
"nette/di": "^2.4 || ~3.0.0",
"nette/tester": "^2.0",
"tracy/tracy": "^2.4"
},
"suggest": {
"ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "⏱ Nette Caching: library with easy-to-use API and many cache backends.",
"homepage": "https://nette.org",
"keywords": [
"cache",
"journal",
"memcached",
"nette",
"sqlite"
],
"time": "2018-03-21T11:04:32+00:00"
},
{
"name": "nette/finder",
"version": "v2.4.2",
"source": {
"type": "git",
"url": "https://github.com/nette/finder.git",
"reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/finder/zipball/ee951a656cb8ac622e5dd33474a01fd2470505a0",
"reference": "ee951a656cb8ac622e5dd33474a01fd2470505a0",
"shasum": ""
},
"require": {
"nette/utils": "~2.4",
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "~2.0",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🔍 Nette Finder: find files and directories with an intuitive API.",
"homepage": "https://nette.org",
"keywords": [
"filesystem",
"glob",
"iterator",
"nette"
],
"time": "2018-06-28T11:49:23+00:00"
},
{
"name": "nette/utils",
"version": "v2.5.3",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/17b9f76f2abd0c943adfb556e56f2165460b15ce",
"reference": "17b9f76f2abd0c943adfb556e56f2165460b15ce",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "~2.0",
"tracy/tracy": "^2.3"
},
"suggest": {
"ext-gd": "to use Image",
"ext-iconv": "to use Strings::webalize() and toAscii()",
"ext-intl": "for script transliteration in Strings::webalize() and toAscii()",
"ext-json": "to use Nette\\Utils\\Json",
"ext-mbstring": "to use Strings::lower() etc...",
"ext-xml": "to use Strings::length() etc. when mbstring is not available"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"classmap": [
"src/"
],
"files": [
"src/loader.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
"homepage": "https://nette.org",
"keywords": [
"array",
"core",
"datetime",
"images",
"json",
"nette",
"paginator",
"password",
"slugify",
"string",
"unicode",
"utf-8",
"utility",
"validation"
],
"time": "2018-09-18T10:22:16+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.0.3",
@ -1672,6 +1949,334 @@
],
"time": "2018-07-02T15:55:56+00:00"
},
{
"name": "pragmarx/coollection",
"version": "v0.6.1",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/coollection.git",
"reference": "3a155ded3186f723774e65c9ea2d79ab439c4a84"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/coollection/zipball/3a155ded3186f723774e65c9ea2d79ab439c4a84",
"reference": "3a155ded3186f723774e65c9ea2d79ab439c4a84",
"shasum": ""
},
"require": {
"php": ">=7.0",
"pragmarx/ia-arr": ">=5.5.33",
"pragmarx/ia-collection": ">=5.5.33",
"pragmarx/ia-str": ">=5.5.33"
},
"require-dev": {
"mockery/mockery": "~1.0",
"phpunit/php-timer": ">=1.0|>=2.0",
"phpunit/phpunit": ">=6.0|>=7.0",
"squizlabs/php_codesniffer": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"PragmaRX\\Coollection\\Package\\": "src/package",
"PragmaRX\\Coollection\\Tests\\": "tests",
"IlluminateExtracted\\": "src/package/Support/IlluminateExtracted",
"IlluminateExtracted\\Tests\\": "tests/IlluminateExtracted"
},
"files": [
"src/package/Support/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"homepage": "https://antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "Laravel Illuminate collection with objectified properties",
"homepage": "https://github.com/antonioribeiro/coollection",
"keywords": [
"collection",
"laravel",
"pragmarx"
],
"time": "2018-09-26T21:11:58+00:00"
},
{
"name": "pragmarx/countries",
"version": "v0.5.9",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/countries.git",
"reference": "26290e847ebc7fbed4cf6226ab7ad89a1fe74ccf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/countries/zipball/26290e847ebc7fbed4cf6226ab7ad89a1fe74ccf",
"reference": "26290e847ebc7fbed4cf6226ab7ad89a1fe74ccf",
"shasum": ""
},
"require": {
"colinodell/json5": "^1.0",
"nette/caching": "^2.5",
"php": ">=7.0",
"pragmarx/coollection": "^0.6",
"psr/simple-cache": "^1.0"
},
"require-dev": {
"gasparesganga/php-shapefile": "^2.4",
"phpunit/phpunit": "~6.0|~7.0",
"squizlabs/php_codesniffer": "^2.3"
},
"type": "library",
"autoload": {
"psr-4": {
"PragmaRX\\Countries\\Package\\": "src/package",
"PragmaRX\\Countries\\Update\\": "src/update"
},
"files": [
"src/package/Support/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "PHP Countries and Currencies",
"keywords": [
"borders",
"cities",
"countries",
"currencies",
"flag",
"geometry",
"states",
"taxes",
"timezones",
"topology"
],
"time": "2018-09-28T16:50:37+00:00"
},
{
"name": "pragmarx/ia-arr",
"version": "v5.6.33",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/ia-arr.git",
"reference": "4c0fd512616064822b6d50ca0e6bc8aa8eb3c067"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/ia-arr/zipball/4c0fd512616064822b6d50ca0e6bc8aa8eb3c067",
"reference": "4c0fd512616064822b6d50ca0e6bc8aa8eb3c067",
"shasum": ""
},
"require": {
"php": ">=7.0",
"symfony/var-dumper": "~3.3|~4.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
"nesbot/carbon": "~1.20",
"phpunit/phpunit": ">=6.0",
"squizlabs/php_codesniffer": "^2.3"
},
"suggest": {
"nesbot/carbon": "Required to use Carbon datetime."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"IlluminateAgnostic\\Arr\\": "src/",
"IlluminateAgnostic\\Arr\\Tests\\": "tests/"
},
"files": [
"src/Support/helpers.php",
"src/Support/alias.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"homepage": "https://antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "Laravel Illuminate Agnostic Arr",
"homepage": "https://github.com/antonioribeiro/ia-arr",
"keywords": [
"arr",
"array",
"helpers",
"laravel",
"pragmarx"
],
"time": "2018-08-19T20:20:32+00:00"
},
{
"name": "pragmarx/ia-collection",
"version": "v5.7.5",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/ia-collection.git",
"reference": "a7bdd40c452e60f55ce81a9af01e12fea0c60a93"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/ia-collection/zipball/a7bdd40c452e60f55ce81a9af01e12fea0c60a93",
"reference": "a7bdd40c452e60f55ce81a9af01e12fea0c60a93",
"shasum": ""
},
"require": {
"nesbot/carbon": "~1.22",
"php": ">=7.0",
"ramsey/uuid": "^3.7",
"symfony/var-dumper": "~3.3|~4.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
"moontoast/math": "^1.1",
"phpunit/phpunit": ">=6.0",
"squizlabs/php_codesniffer": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"IlluminateAgnostic\\Collection\\": "src/",
"IlluminateAgnostic\\Collection\\Tests\\": "tests/"
},
"files": [
"src/Support/helpers.php",
"src/Support/alias.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"homepage": "https://antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "Laravel Illuminate Agnostic Collection",
"homepage": "https://github.com/antonioribeiro/ia-collection",
"keywords": [
"collection",
"helpers",
"laravel",
"pragmarx"
],
"time": "2018-09-20T18:19:48+00:00"
},
{
"name": "pragmarx/ia-str",
"version": "v5.6.33",
"source": {
"type": "git",
"url": "https://github.com/antonioribeiro/ia-str.git",
"reference": "1572361ef0472404e3f3c53d9448a933fa86e33b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/antonioribeiro/ia-str/zipball/1572361ef0472404e3f3c53d9448a933fa86e33b",
"reference": "1572361ef0472404e3f3c53d9448a933fa86e33b",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"doctrine/inflector": "^1.2",
"mockery/mockery": "~1.0",
"moontoast/math": "^1.1",
"nesbot/carbon": "~1.22",
"phpunit/phpunit": ">=6.0",
"ramsey/uuid": "^3.7",
"squizlabs/php_codesniffer": "^2.3",
"symfony/var-dumper": "~3.3|~4.0"
},
"suggest": {
"doctrine/inflector": "",
"nesbot/carbon": "",
"ramsey/uuid": "",
"symfony/var-dumper": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"IlluminateAgnostic\\Str\\": "src/",
"IlluminateAgnostic\\Str\\Tests\\": "tests/"
},
"files": [
"src/Support/helpers.php",
"src/Support/alias.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Antonio Carlos Ribeiro",
"email": "acr@antoniocarlosribeiro.com",
"homepage": "https://antoniocarlosribeiro.com",
"role": "Creator"
}
],
"description": "Laravel Illuminate Agnostic Str",
"homepage": "https://github.com/antonioribeiro/ia-str",
"keywords": [
"helpers",
"laravel",
"pragmarx",
"str",
"string"
],
"time": "2018-08-19T20:21:49+00:00"
},
{
"name": "prettus/l5-repository",
"version": "2.6.32",

View File

@ -0,0 +1,23 @@
<?php
namespace Webkul\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Attribute\Database\Seeders\DatabaseSeeder as AttributeSeeder;
use Webkul\Core\Database\Seeders\DatabaseSeeder as CoreSeeder;
use Webkul\User\Database\Seeders\DatabaseSeeder as UserSeeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(AttributeSeeder::class);
$this->call(CoreSeeder::class);
$this->call(UserSeeder::class);
}
}

View File

@ -99,13 +99,13 @@
@foreach($configurableFamily->configurable_attributes as $attribute)
<tr>
<td>
{{ $attribute->name }}
{{ $attribute->admin_name }}
</td>
<td>
@foreach($attribute->options as $option)
<span class="label">
<input type="hidden" name="super_attributes[{{$attribute->code}}][]" value="{{ $option->id }}"/>
{{ $option->label }}
{{ $option->admin_name }}
<i class="icon cross-icon"></i>
</span>

View File

@ -63,16 +63,16 @@
<span class="control-error" v-if="errors.has('locales[]')">@{{ errors.first('locales[]') }}</span>
</div>
<div class="control-group" :class="[errors.has('default_locale') ? 'has-error' : '']">
<label for="default_locale" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<select v-validate="'required'" class="control" id="default_locale" name="default_locale">
<div class="control-group" :class="[errors.has('default_locale_id') ? 'has-error' : '']">
<label for="default_locale_id" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<select v-validate="'required'" class="control" id="default_locale_id" name="default_locale_id">
@foreach(core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ old('default_locale') == $locale->id ? 'selected' : '' }}>
<option value="{{ $locale->id }}" {{ old('default_locale_id') == $locale->id ? 'selected' : '' }}>
{{ $locale->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('default_locale')">@{{ errors.first('default_locale') }}</span>
<span class="control-error" v-if="errors.has('default_locale_id')">@{{ errors.first('default_locale_id') }}</span>
</div>
<div class="control-group" :class="[errors.has('currencies[]') ? 'has-error' : '']">
@ -87,16 +87,16 @@
<span class="control-error" v-if="errors.has('currencies[]')">@{{ errors.first('currencies[]') }}</span>
</div>
<div class="control-group" :class="[errors.has('base_currency') ? 'has-error' : '']">
<label for="base_currency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<select v-validate="'required'" class="control" id="base_currency" name="base_currency">
<div class="control-group" :class="[errors.has('base_currency_id') ? 'has-error' : '']">
<label for="base_currbase_currency_idency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<select v-validate="'required'" class="control" id="base_currency_id" name="base_currency_id">
@foreach(core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ old('base_currency') == $currency->id ? 'selected' : '' }}>
<option value="{{ $currency->id }}" {{ old('base_currency_id') == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('base_currency')">@{{ errors.first('base_currency') }}</span>
<span class="control-error" v-if="errors.has('base_currency_id')">@{{ errors.first('base_currency_id') }}</span>
</div>
</div>

View File

@ -66,9 +66,9 @@
</div>
<div class="control-group" :class="[errors.has('default_locale_id') ? 'has-error' : '']">
<label for="default_locale" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<?php $selectedOption = old('default_locale') ?: $channel->default_locale_id ?>
<select v-validate="'required'" class="control" id="default_locale" name="default_locale_id">
<label for="default_locale_id" class="required">{{ __('admin::app.settings.channels.default-locale') }}</label>
<?php $selectedOption = old('default_locale_id') ?: $channel->default_locale_id ?>
<select v-validate="'required'" class="control" id="default_locale_id" name="default_locale_id">
@foreach(core()->getAllLocales() as $locale)
<option value="{{ $locale->id }}" {{ $selectedOption == $locale->id ? 'selected' : '' }}>
{{ $locale->name }}
@ -92,9 +92,9 @@
</div>
<div class="control-group" :class="[errors.has('base_currency_id') ? 'has-error' : '']">
<label for="base_currency" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<?php $selectedOption = old('base_currency') ?: $channel->base_currency_id ?>
<select v-validate="'required'" class="control" id="base_currency" name="base_currency_id">
<label for="base_currency_id" class="required">{{ __('admin::app.settings.channels.base-currency') }}</label>
<?php $selectedOption = old('base_currency_id') ?: $channel->base_currency_id ?>
<select v-validate="'required'" class="control" id="base_currency_id" name="base_currency_id">
@foreach(core()->getAllCurrencies() as $currency)
<option value="{{ $currency->id }}" {{ $selectedOption == $currency->id ? 'selected' : '' }}>
{{ $currency->name }}

View File

@ -103,7 +103,7 @@
<div class="control-group">
<label for="country">{{ __('admin::app.settings.inventory_sources.country') }}</label>
<select class="control" id="country" name="country">
@foreach(country()->all() as $countryCoode => $countryName)
@foreach(core()->countries() as $countryCoode => $countryName)
<option value="{{ $countryCoode }}" {{ old('country') == $countryCoode ? 'selected' : '' }}>
{{ $countryName }}
</option>

View File

@ -105,7 +105,7 @@
<?php $selectedCountry = old('country') ?: $inventorySource->country ?>
<label for="country">{{ __('admin::app.settings.inventory_sources.country') }}</label>
<select class="control" id="country" name="country">
@foreach(country()->all() as $countryCoode => $countryName)
@foreach(core()->countries() as $countryCoode => $countryName)
<option value="{{ $countryCoode }}" {{ $selectedCountry == $countryCoode ? 'selected' : '' }}>
{{ $countryName }}
</option>

View File

@ -31,17 +31,26 @@ class AttributeFamilyTableSeeder extends Seeder
'code' => 'url_key',
'position' => 3
], [
'code' => 'new',
'code' => 'tax_category_id',
'position' => 4
], [
'code' => 'featured',
'code' => 'new',
'position' => 5
], [
'code' => 'visible_individually',
'code' => 'featured',
'position' => 6
], [
'code' => 'status',
'code' => 'visible_individually',
'position' => 7
], [
'code' => 'status',
'position' => 8
], [
'code' => 'color',
'position' => 9
], [
'code' => 'size',
'position' => 10
]
]
], [

View File

@ -55,6 +55,21 @@ class AttributeTableSeeder extends Seeder
'is_filterable' => 0,
'is_configurable' => 0,
'is_user_defined' => 0
], [
'code' => 'tax_category_id',
'admin_name' => 'Tax Category',
'en' => [
'name' => 'Tax Category'
],
'type' => 'text',
'position' => 4,
'is_unique' => 0,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 1,
'is_filterable' => 0,
'is_configurable' => 0,
'is_user_defined' => 0
], [
'code' => 'new',
'admin_name' => 'New',
@ -62,7 +77,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'New'
],
'type' => 'boolean',
'position' => 4,
'position' => 5,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -76,7 +91,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Featured'
],
'type' => 'boolean',
'position' => 5,
'position' => 6,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -90,7 +105,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Visible Individually'
],
'type' => 'boolean',
'position' => 6,
'position' => 7,
'is_required' => 1,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -104,7 +119,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Status'
],
'type' => 'boolean',
'position' => 7,
'position' => 8,
'is_required' => 1,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -118,7 +133,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Short Description'
],
'type' => 'textarea',
'position' => 8,
'position' => 9,
'is_required' => 1,
'value_per_locale' => 1,
'value_per_channel' => 1,
@ -132,7 +147,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Description'
],
'type' => 'textarea',
'position' => 9,
'position' => 10,
'is_required' => 1,
'value_per_locale' => 1,
'value_per_channel' => 1,
@ -146,7 +161,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Price'
],
'type' => 'price',
'position' => 10,
'position' => 11,
'is_required' => 1,
'value_per_locale' => 0,
'value_per_channel' => 1,
@ -160,7 +175,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Cost'
],
'type' => 'price',
'position' => 11,
'position' => 12,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 1,
@ -174,7 +189,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Special Price'
],
'type' => 'price',
'position' => 12,
'position' => 13,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 1,
@ -188,7 +203,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Special Price From'
],
'type' => 'date',
'position' => 13,
'position' => 14,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 1,
@ -202,7 +217,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Special Price To'
],
'type' => 'date',
'position' => 14,
'position' => 15,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 1,
@ -216,7 +231,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Meta Description'
],
'type' => 'textarea',
'position' => 15,
'position' => 16,
'is_required' => 0,
'value_per_locale' => 1,
'value_per_channel' => 1,
@ -230,7 +245,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Meta Keywords'
],
'type' => 'textarea',
'position' => 16,
'position' => 17,
'is_required' => 0,
'value_per_locale' => 1,
'value_per_channel' => 1,
@ -244,7 +259,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Meta Description'
],
'type' => 'textarea',
'position' => 17,
'position' => 18,
'is_required' => 0,
'value_per_locale' => 1,
'value_per_channel' => 1,
@ -259,7 +274,7 @@ class AttributeTableSeeder extends Seeder
],
'type' => 'text',
'validation' => 'numeric',
'position' => 18,
'position' => 19,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -274,7 +289,7 @@ class AttributeTableSeeder extends Seeder
],
'type' => 'text',
'validation' => 'numeric',
'position' => 19,
'position' => 20,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -289,7 +304,7 @@ class AttributeTableSeeder extends Seeder
],
'type' => 'text',
'validation' => 'numeric',
'position' => 20,
'position' => 21,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -304,7 +319,7 @@ class AttributeTableSeeder extends Seeder
],
'type' => 'text',
'validation' => 'numeric',
'position' => 21,
'position' => 22,
'is_required' => 1,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -318,7 +333,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Color'
],
'type' => 'select',
'position' => 22,
'position' => 23,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -327,26 +342,31 @@ class AttributeTableSeeder extends Seeder
'is_user_defined' => 1,
'options' => [
[
'admin_name' => 'Red',
'en' => [
'label' => 'Red'
],
'sort_order' => 1
], [
'admin_name' => 'Green',
'en' => [
'label' => 'Green'
],
'sort_order' => 2
], [
'admin_name' => 'Yellow',
'en' => [
'label' => 'Yellow'
],
'sort_order' => 3
], [
'admin_name' => 'Black',
'en' => [
'label' => 'Black'
],
'sort_order' => 4
], [
'admin_name' => 'White',
'en' => [
'label' => 'White'
],
@ -360,7 +380,7 @@ class AttributeTableSeeder extends Seeder
'name' => 'Size'
],
'type' => 'select',
'position' => 23,
'position' => 24,
'is_required' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
@ -369,21 +389,25 @@ class AttributeTableSeeder extends Seeder
'is_user_defined' => 1,
'options' => [
[
'admin_name' => 'S',
'en' => [
'label' => 'S'
],
'sort_order' => 1
], [
'admin_name' => 'M',
'en' => [
'label' => 'M'
],
'sort_order' => 2
], [
'admin_name' => 'L',
'en' => [
'label' => 'L'
],
'sort_order' => 3
], [
'admin_name' => 'XL',
'en' => [
'label' => 'XL'
],
@ -413,6 +437,8 @@ class AttributeTableSeeder extends Seeder
public function run()
{
\Illuminate\Database\Eloquent\Model::reguard();
foreach($this->rawData as $row) {
$this->attribute->create($row);
}

View File

@ -98,7 +98,7 @@ class AttributeFamilyController extends Controller
*/
public function edit(Attribute $attribute, $id)
{
$attributeFamily = $this->attributeFamily->find($id, ['*'], ['attribute_groups.custom_attributes']);
$attributeFamily = $this->attributeFamily->with(['attribute_groups.custom_attributes'])->find($id, ['*']);
$custom_attributes = $attribute->all(['id', 'code', 'admin_name', 'type']);

View File

@ -128,4 +128,30 @@ class AttributeRepository extends Repository
{
return $this->model->filterableAttributes()->get();
}
/**
* @return array
*/
public function getProductDefaultAttributes($codes = null)
{
$attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable'];
if(!is_array($codes) && !$codes)
return $this->findWhereIn('code', [
'name',
'description',
'short_description',
'url_key',
'price',
'special_price',
'special_price_from',
'special_price_to',
'status'
], $attributeColumns);
if(in_array('*', $codes))
return $this->all($attributeColumns);
return $this->findWhereIn('code', $codes, $attributeColumns);
}
}

View File

@ -639,8 +639,6 @@ class Cart {
}
}
$this->calulateTax();
return true;
}

View File

@ -11,6 +11,7 @@ use Webkul\Core\Models\TaxRate as TaxRate;
use Webkul\Core\Repositories\CurrencyRepository;
use Webkul\Core\Repositories\ExchangeRateRepository;
use Illuminate\Support\Facades\Config;
use PragmaRX\Countries\Package\Countries;
class Core
{
@ -35,7 +36,10 @@ class Core
* @param Webkul\Core\Repositories\ExchangeRateRepository $exchangeRateRepository
* @return void
*/
public function __construct(CurrencyRepository $currencyRepository, ExchangeRateRepository $exchangeRateRepository)
public function __construct(
CurrencyRepository $currencyRepository,
ExchangeRateRepository $exchangeRateRepository
)
{
$this->currencyRepository = $currencyRepository;
@ -278,7 +282,7 @@ class Core
public function currency($amount = 0)
{
if(is_null($amount))
$price = 0;
$amount = 0;
$currencyCode = $this->getCurrentCurrency()->code;
@ -439,4 +443,49 @@ class Core
return Config::get($field);
}
/**
* Retrieve all countries
*
* @return Collection
*/
public function countries()
{
$countries = new Countries;
return $countries->all()->pluck('name.common', 'cca2');
}
/**
* Retrieve all country states
*
* @return Collection
*/
public function states($countryCode)
{
$countries = new Countries;
return $countries->where('cca2', $countryCode)
->first()
->hydrateStates()
->states
->sortBy('name')
->pluck('name', 'postal');
}
/**
* Retrieve all grouped states by country code
*
* @return Collection
*/
public function groupedStatesByCountries()
{
$collection = [];
foreach ($this->countries() as $countryCode => $countryName) {
$collection[$countryCode] = $this->states($countryCode)->toArray();
}
return $collection;
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Webkul\Core\Database\Seeders;
use Illuminate\Database\Seeder;
use Webkul\Core\Models\Currency;
class CurrencyTableSeeder extends Seeder
{
public function run()
{
$currency = new Currency();
$locale->code = 'USD';
$locale->name = 'US Dollar';
$locale->symbol = '$';
$locale->save();
}
}

View File

@ -9,6 +9,8 @@ class LocalesTableSeeder extends Seeder
{
public function run()
{
\Illuminate\Database\Eloquent\Model::reguard();
$locale = new Locale();
$locale->code = 'en';
$locale->name = 'English';

View File

@ -75,9 +75,9 @@ class ChannelController extends Controller
'code' => ['required', 'unique:channels,code', new \Webkul\Core\Contracts\Validations\Code],
'name' => 'required',
'locales' => 'required|array|min:1',
'default_locale' => 'required',
'default_locale_id' => 'required',
'currencies' => 'required|array|min:1',
'base_currency' => 'required'
'base_currency_id' => 'required'
]);
$this->channel->create(request()->all());

View File

@ -8,7 +8,7 @@ use Webkul\Core\Models\Currency;
class Channel extends Model
{
protected $fillable = ['code', 'name', 'description', 'default_locale', 'base_currency'];
protected $fillable = ['code', 'name', 'description', 'default_locale_id', 'base_currency_id'];
/**
* Get the channel locales.

View File

@ -60,12 +60,7 @@ class AttributeToSelectCriteria extends AbstractProduct implements CriteriaInter
{
$model = $model->select('products.*');
foreach ($this->attributeToSelect as $code) {
$attribute = $this->attribute->findOneByField('code', $code);
if(!$attribute)
continue;
foreach ($this->attribute->getProductDefaultAttributes() as $attribute) {
$productValueAlias = 'pav_' . $attribute->code;
$model = $model->leftJoin('product_attribute_values as ' . $productValueAlias, function($qb) use($attribute, $productValueAlias) {
@ -76,7 +71,7 @@ class AttributeToSelectCriteria extends AbstractProduct implements CriteriaInter
->where($productValueAlias . '.attribute_id', $attribute->id);
});
$model = $model->addSelect($productValueAlias . '.' . ProductAttributeValue::$attributeTypeFields[$attribute->type] . ' as ' . $code);
$model = $model->addSelect($productValueAlias . '.' . ProductAttributeValue::$attributeTypeFields[$attribute->type] . ' as ' . $attribute->code);
}
return $model;

View File

@ -5,13 +5,14 @@ namespace Webkul\Product\Contracts\Criteria;
use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;
use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Product\Product\AbstractProduct;
/**
* Class MyCriteria.
*
* @package namespace App\Criteria;
*/
class FeaturedProductsCriteria implements CriteriaInterface
class FeaturedProductsCriteria extends AbstractProduct implements CriteriaInterface
{
/**
* @var AttributeRepository
@ -41,6 +42,8 @@ class FeaturedProductsCriteria implements CriteriaInterface
$model = $model->leftJoin('product_attribute_values as filter_featured', 'products.id', '=', 'filter_featured.product_id');
$model = $this->applyChannelLocaleFilter($attribute, $model, 'filter_featured');
$model->where('filter_featured.boolean_value', 1)
->where('filter_featured.attribute_id', $attribute->id);

View File

@ -50,13 +50,8 @@ class FilterByAttributesCriteria extends AbstractProduct implements CriteriaInte
foreach($aliases as $table => $alias) {
$query1 = $query1->orWhere(function($query2) use($model, $table, $alias) {
foreach (request()->input() as $code => $value) {
$aliasTemp = $alias . $code;
$attribute = $this->attribute->findOneByField('code', $code);
if(!$attribute)
continue;
foreach ($this->attribute->getProductDefaultAttributes(array_keys(request()->input())) as $code => $attribute) {
$aliasTemp = $alias . $attribute->code;
$model = $model->leftJoin('product_attribute_values as ' . $aliasTemp, $table . '.id', '=', $aliasTemp . '.product_id');
@ -64,7 +59,7 @@ class FilterByAttributesCriteria extends AbstractProduct implements CriteriaInte
$column = ProductAttributeValue::$attributeTypeFields[$attribute->type];
$temp = explode(',', $value);
$temp = explode(',', request()->get($attribute->code));
if($attribute->type != 'price') {
$query2 = $query2->where($aliasTemp . '.attribute_id', $attribute->id);

View File

@ -5,13 +5,14 @@ namespace Webkul\Product\Contracts\Criteria;
use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;
use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Product\Product\AbstractProduct;
/**
* Class MyCriteria.
*
* @package namespace App\Criteria;
*/
class NewProductsCriteria implements CriteriaInterface
class NewProductsCriteria extends AbstractProduct implements CriteriaInterface
{
/**
* @var AttributeRepository
@ -41,6 +42,8 @@ class NewProductsCriteria implements CriteriaInterface
$model = $model->leftJoin('product_attribute_values as filter_new', 'products.id', '=', 'filter_new.product_id');
$model = $this->applyChannelLocaleFilter($attribute, $model, 'filter_featured');
$model->where('filter_new.boolean_value', 1)
->where('filter_new.attribute_id', $attribute->id);

View File

@ -124,16 +124,6 @@ class Product extends Model
return $this->belongsToMany(self::class, 'product_cross_sells');
}
/**
* @param string $key
*
* @return bool
*/
public function isCustomAttribute($attribute)
{
return $this->attribute_family->custom_attributes->pluck('code')->contains($attribute);
}
/**
* @param string $key
*
@ -180,16 +170,15 @@ class Product extends Model
public function getAttribute($key)
{
if (!method_exists(self::class, $key) && !in_array($key, ['parent_id', 'attribute_family_id']) && !isset($this->attributes[$key])) {
if (isset($this->id) && $this->isCustomAttribute($key)) {
if (isset($this->id)) {
$this->attributes[$key] = '';
$attributeModel = $this->attribute_family->custom_attributes()->where('attributes.code', $key)->first();
$attribute = app(\Webkul\Attribute\Repositories\AttributeRepository::class)->findOneByField('code', $key);
$this->attributes[$key] = $this->getCustomAttributeValue($attributeModel);
$this->attributes[$key] = $this->getCustomAttributeValue($attribute);
return $this->getAttributeValue($key);
}
}
return parent::getAttribute($key);
@ -227,7 +216,7 @@ class Product extends Model
if(!$attribute)
return;
$channel = request()->get('channel') ?: core()->getDefaultChannelCode();
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
$locale = request()->get('locale') ?: app()->getLocale();

View File

@ -3,6 +3,7 @@
namespace Webkul\Product\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Inventory\Models\InventorySource;
class ProductInventory extends Model
{
@ -21,4 +22,12 @@ class ProductInventory extends Model
// public function checkInventoryStatus() {
// return $this->leftjoin('inventory_sources', 'inventory_sources.id', 'inventory_source_id')->select('status')->where('status', '=','1');
// }
/**
* Get the product attribute family that owns the product.
*/
public function inventory_source()
{
return $this->belongsTo(InventorySource::class);
}
}

View File

@ -16,9 +16,9 @@ abstract class AbstractProduct
*/
public function applyChannelLocaleFilter($attribute, $qb, $alias = 'product_attribute_values')
{
$channel = core()->getCurrentChannelCode();
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
$locale = app()->getLocale();
$locale = request()->get('locale') ?: app()->getLocale();
if($attribute->value_per_channel) {
if($attribute->value_per_locale) {

View File

@ -5,6 +5,8 @@ namespace Webkul\Product\Product;
use Webkul\Attribute\Repositories\AttributeOptionRepository as AttributeOption;
use Webkul\Product\Product\ProductImage;
use Webkul\Product\Product\Price;
use Webkul\Product\Models\Product;
use Webkul\Product\Models\ProductAttributeValue;
class ConfigurableOption extends AbstractProduct
{
@ -56,9 +58,12 @@ class ConfigurableOption extends AbstractProduct
* @param Product $product
* @return float
*/
public function getAllowProducts($product)
public function getAllowedProducts($product)
{
$variants = [];
static $variants = [];
if(count($variants))
return $variants;
foreach ($product->variants as $variant) {
if ($variant->isSaleable()) {
@ -77,7 +82,7 @@ class ConfigurableOption extends AbstractProduct
*/
public function getConfigurationConfig($product)
{
$options = $this->getOptions($product, $this->getAllowProducts($product));
$options = $this->getOptions($product, $this->getAllowedProducts($product));
$config = [
'attributes' => $this->getAttributesData($product, $options),
@ -203,7 +208,7 @@ class ConfigurableOption extends AbstractProduct
{
$prices = [];
foreach ($this->getAllowProducts($product) as $variant) {
foreach ($this->getAllowedProducts($product) as $variant) {
$prices[$variant->id] = [
'regular_price' => [
'formated_price' => core()->currency($variant->price),
@ -229,20 +234,10 @@ class ConfigurableOption extends AbstractProduct
{
$images = [];
foreach ($this->getAllowProducts($product) as $variant) {
foreach ($this->getAllowedProducts($product) as $variant) {
$images[$variant->id] = $this->productImage->getGalleryImages($variant);
}
return $images;
}
/**
* Get product images for configurable variations
*
* @param Product $product
* @return array
*/
protected function is($product)
{
}
}

View File

@ -409,17 +409,20 @@ class ProductRepository extends Repository
* @param string $slug
* @return mixed
*/
public function findBySlugOrFail($slug)
public function findBySlugOrFail($slug, $columns = null)
{
$attribute = $this->attribute->findOneByField('code', 'url_key');
$attributeValue = $this->attributeValue->findOneWhere([
'attribute_id' => $attribute->id,
ProductAttributeValue::$attributeTypeFields[$attribute->type] => $slug
]);
], ['product_id']);
if($attributeValue && $attributeValue->product)
return $attributeValue->product;
if($attributeValue && $attributeValue->product_id) {
$this->pushCriteria(app(AttributeToSelectCriteria::class)->addAttribueToSelect($columns));
return $this->find($attributeValue->product_id);
}
throw (new ModelNotFoundException)->setModel(
get_class($this->model), $slug
@ -434,15 +437,7 @@ class ProductRepository extends Repository
public function getNewProducts()
{
$this->pushCriteria(app(NewProductsCriteria::class));
$this->pushCriteria(app(AttributeToSelectCriteria::class)->addAttribueToSelect([
'name',
'description',
'short_description',
'price',
'special_price',
'special_price_from',
'special_price_to'
]));
$this->pushCriteria(app(AttributeToSelectCriteria::class));
$params = request()->input();
@ -459,15 +454,7 @@ class ProductRepository extends Repository
public function getFeaturedProducts()
{
$this->pushCriteria(app(FeaturedProductsCriteria::class));
$this->pushCriteria(app(AttributeToSelectCriteria::class)->addAttribueToSelect([
'name',
'description',
'short_description',
'price',
'special_price',
'special_price_from',
'special_price_to'
]));
$this->pushCriteria(app(AttributeToSelectCriteria::class));
$params = request()->input();

View File

@ -70,6 +70,8 @@ class OnepageController extends Controller
if(Cart::hasError() || !Cart::saveCustomerAddress(request()->all()) || !$rates = Shipping::collectRates())
return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403);
Cart::collectTotals();
return response()->json($rates);
}

View File

@ -124,7 +124,7 @@
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country">
<option value=""></option>
@foreach (country()->all() as $code => $country)
@foreach (core()->countries() as $code => $country)
<option value="{{ $code }}">{{ $country }}</option>
@ -264,7 +264,7 @@
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country">
<option value=""></option>
@foreach (country()->all() as $code => $country)
@foreach (core()->countries() as $code => $country)
<option value="{{ $code }}">{{ $country }}</option>

View File

@ -4,7 +4,7 @@
let handler = function(e) {
setTimeout(function(){
e.target.value = e.target.value.toString().toLowerCase()
.replace(/[^\w ]+/g,'')
.replace(/[^\w_ ]+/g,'')
.trim()
.replace(/ +/g,'-');
}, 100);