Merge branch 'master' into small-bugfix-and-tiny-refactoring
This commit is contained in:
commit
e7c29f40e2
|
|
@ -0,0 +1,75 @@
|
|||
# CHANGELOG for v1.x.x
|
||||
|
||||
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
|
||||
|
||||
## **v0.1.0(28th of January 2020)** - *Release*
|
||||
|
||||
* [feature] Updated to laravel version 6.
|
||||
|
||||
* [feature] Added four new product types - Group, Bundle, Downloadable and Virtaul.
|
||||
|
||||
* [feature] Povided default theme (Velocity).
|
||||
|
||||
* #1971 [fixed] - Filter is not working properly for id column in autogenerated coupon codes in cart rule.
|
||||
|
||||
* #1977 [fixed] - On editing the product, selected category for that product is not checked.
|
||||
|
||||
* #1978 [fixed] - Getting exception if changing the locale from cart page, if translation is not written for that product.
|
||||
|
||||
* #1979 [fixed] - Wrong calculation at customer as well as at admin end in due amount and grandtotal.
|
||||
|
||||
* #1983 [fixed] - Getting exception on deleting admin logo.
|
||||
|
||||
* #1986 [fixed] - Subscribe to newsletter does not work.
|
||||
|
||||
* #1997 [fixed] - Getting exception on adding attribute or creating product in bagisto on php version 7.4 .
|
||||
|
||||
* #1998 [fixed] - Showing product sale amount as zero when creating a product, and a existing catalog rule apply on it.
|
||||
|
||||
* #2001 [fixed] - php artisan route:list throws error.
|
||||
|
||||
* #2012 [fixed] - FGetting exception when clicking on view all under review section at product page.
|
||||
|
||||
* #2045 [fixed] - Login option is not coming while checkout with existing customer mail id.
|
||||
|
||||
* #2051 [fixed] - Forgot password not working due to recent changes in mail keys.
|
||||
|
||||
* #2054 [fixed] -Automatically 1st item of bundle is getting selected as a default after saving product.
|
||||
|
||||
* #2058 [fixed] - Not getting any validation message if entered admin credentials are wrong.
|
||||
|
||||
* #2066 [fixed] - Exception while writing product review.
|
||||
|
||||
* #2071 [fixed] - Customer is not getting forget password email.
|
||||
|
||||
* #2074 [fixed] - Getting exception while creating bundle type product.
|
||||
|
||||
* #2075 [fixed] - Getting exception if trying to select any parent category of root.
|
||||
|
||||
* #2087 [fixed] - Getting exception while adding configurable/bundle/grouped/Downloadable Type product to cart.
|
||||
|
||||
* #2088 [fixed] - Getting exception on customer login.
|
||||
|
||||
* #2089 [fixed] - Info missing on printing invoice at customer and admin end.
|
||||
|
||||
* #2114 [fixed] - getting exception while recovering admin password in case admin did not enter the details in env.
|
||||
|
||||
* #2118 [fixed] - Installation issue, getting exception on migrate command.
|
||||
|
||||
* #2119 [fixed] - confirm password is not matching even if admin is entering similar password in password and confirm password.
|
||||
|
||||
* #2120 [fixed] - Not able to add new user as while creating user password its giving error confirm password doesn't match.
|
||||
|
||||
* #2124 [fixed] - Able to make all product as default while creating bundle product in select type option.
|
||||
|
||||
* #2128 [fixed] - Click on add attribute, error is thrown.
|
||||
|
||||
* #2132 [fixed] - Price range slider not displaying.
|
||||
|
||||
* #2145 [fixed] - Emails don't work on registration.
|
||||
|
||||
* #2146 [fixed] - Getting exception on creating bundle product without any option.
|
||||
|
||||
* #2147 [fixed] - Sort order of bundle product doesn't work..
|
||||
|
||||
* #2168 [fixed] - locale direction drop down always select ltr.
|
||||
|
|
@ -4,11 +4,13 @@ namespace Webkul\API\Http\Controllers\Shop;
|
|||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
|
||||
/**
|
||||
* Customer controller
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @author Vivek Sharma <viveksh047@webkul.com> @vivek-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerController extends Controller
|
||||
|
|
@ -28,13 +30,28 @@ class CustomerController extends Controller
|
|||
protected $customerRepository;
|
||||
|
||||
/**
|
||||
* @param CustomerRepository object $customer
|
||||
* Repository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public function __construct(CustomerRepository $customerRepository)
|
||||
{
|
||||
protected $customerGroupRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\Customer\Repositories\CustomerRepository $customerRepository
|
||||
* @param \Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
CustomerRepository $customerRepository,
|
||||
CustomerGroupRepository $customerGroupRepository
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customerRepository = $customerRepository;
|
||||
|
||||
$this->customerGroupRepository = $customerGroupRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,10 +73,11 @@ class CustomerController extends Controller
|
|||
$data = array_merge($data, [
|
||||
'password' => bcrypt($data['password']),
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'is_verified' => 1,
|
||||
'customer_group_id' => 1
|
||||
'is_verified' => 1
|
||||
]);
|
||||
|
||||
$data['customer_group_id'] = $this->customerGroupRepository->findOneWhere(['code' => 'general'])->id;
|
||||
|
||||
Event::dispatch('customer.registration.before');
|
||||
|
||||
$customer = $this->customerRepository->create($data);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class AddressDataGrid extends DataGrid
|
|||
$queryBuilder = DB::table('customer_addresses as ca')
|
||||
->leftJoin('countries', 'ca.country', '=', 'countries.code')
|
||||
->leftJoin('customers as c', 'ca.customer_id', '=', 'c.id')
|
||||
->addSelect('ca.id as address_id', 'ca.company_name', 'ca.vat_id', 'ca.address1', 'ca.country', DB::raw('' . DB::getTablePrefix() . 'countries.name as country_name'), 'ca.state', 'ca.city', 'ca.postcode', 'ca.phone', 'ca.default_address')
|
||||
->addSelect('ca.id as address_id', 'ca.company_name', 'ca.address1', 'ca.country', DB::raw('' . DB::getTablePrefix() . 'countries.name as country_name'), 'ca.state', 'ca.city', 'ca.postcode', 'ca.phone', 'ca.default_address')
|
||||
->where('c.id', $customer->id);
|
||||
|
||||
$queryBuilder = $queryBuilder->leftJoin('country_states', function($qb) {
|
||||
|
|
@ -66,7 +66,6 @@ class AddressDataGrid extends DataGrid
|
|||
|
||||
$this->addFilter('address_id', 'ca.id');
|
||||
$this->addFilter('company_name', 'ca.company_name');
|
||||
$this->addFilter('vat_id', 'ca.vat_id');
|
||||
$this->addFilter('address1', 'ca.address1');
|
||||
$this->addFilter('city', 'ca.city');
|
||||
$this->addFilter('state_name', DB::raw(DB::getTablePrefix() . 'country_states.default_name'));
|
||||
|
|
@ -134,15 +133,6 @@ class AddressDataGrid extends DataGrid
|
|||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'vat_id',
|
||||
'label' => trans('admin::app.customers.addresses.vat_id'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'default_address',
|
||||
'label' => trans('admin::app.customers.addresses.default-address'),
|
||||
|
|
|
|||
|
|
@ -59,7 +59,14 @@ class LocalesDataGrid extends DataGrid
|
|||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
'filterable' => true,
|
||||
'closure' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if ($value->direction == 'ltr')
|
||||
return trans('admin::app.datagrid.ltr');
|
||||
else
|
||||
return trans('admin::app.datagrid.rtl');
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* ProductDataGrid Class
|
||||
|
|
@ -19,20 +19,48 @@ class ProductDataGrid extends DataGrid
|
|||
|
||||
protected $itemsPerPage = 10;
|
||||
|
||||
protected $locale = 'all';
|
||||
|
||||
protected $channel = 'all';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->locale = request()->get('locale') ?? 'all';
|
||||
$this->channel = request()->get('channel') ?? 'all';
|
||||
}
|
||||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('product_flat')
|
||||
->leftJoin('products', 'product_flat.product_id', '=', 'products.id')
|
||||
->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id')
|
||||
->leftJoin('product_inventories', 'product_flat.product_id', '=', 'product_inventories.product_id')
|
||||
->select('product_flat.product_id as product_id', 'product_flat.sku as product_sku', 'product_flat.name as product_name', 'products.type as product_type', 'product_flat.status', 'product_flat.price', 'attribute_families.name as attribute_family', DB::raw('SUM(' . DB::getTablePrefix() . 'product_inventories.qty) as quantity'))
|
||||
->where('channel', core()->getCurrentChannelCode())
|
||||
->where('locale', app()->getLocale())
|
||||
->groupBy('product_flat.product_id');
|
||||
->select(
|
||||
'product_flat.product_id as product_id',
|
||||
'products.sku as product_sku',
|
||||
'product_flat.name as product_name',
|
||||
'products.type as product_type',
|
||||
'product_flat.status',
|
||||
'product_flat.price',
|
||||
'attribute_families.name as attribute_family',
|
||||
DB::raw('SUM(' . DB::getTablePrefix() . 'product_inventories.qty) as quantity')
|
||||
);
|
||||
|
||||
if ($this->locale !== 'all') {
|
||||
$queryBuilder->where('locale', $this->locale);
|
||||
}
|
||||
|
||||
if ($this->channel !== 'all') {
|
||||
$queryBuilder->where('channel', $this->channel);
|
||||
}
|
||||
|
||||
$queryBuilder->groupBy('product_flat.product_id');
|
||||
|
||||
$this->addFilter('product_id', 'product_flat.product_id');
|
||||
$this->addFilter('product_name', 'product_flat.name');
|
||||
$this->addFilter('product_sku', 'product_flat.sku');
|
||||
$this->addFilter('product_sku', 'products.sku');
|
||||
$this->addFilter('status', 'product_flat.status');
|
||||
$this->addFilter('product_type', 'products.type');
|
||||
$this->addFilter('attribute_family', 'attribute_families.name');
|
||||
|
|
|
|||
|
|
@ -150,7 +150,9 @@ return [
|
|||
'role' => 'الدور',
|
||||
'sub-total' => 'المجموع الفرعي',
|
||||
'no-of-products' => 'عدد المنتجات',
|
||||
'refunded' => 'Refunded'
|
||||
'refunded' => 'Refunded',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
],
|
||||
|
||||
'account' => [
|
||||
|
|
|
|||
|
|
@ -213,7 +213,9 @@ return [
|
|||
'times-used' => 'Times Used',
|
||||
'created-date' => 'Created Date',
|
||||
'expiration-date' => 'Expiration Date',
|
||||
'delete' => 'Delete'
|
||||
'delete' => 'Delete',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
],
|
||||
|
||||
'account' => [
|
||||
|
|
@ -776,7 +778,8 @@ return [
|
|||
'seo' => 'Home page SEO',
|
||||
'seo-title' => 'Meta title',
|
||||
'seo-description' => 'Meta description',
|
||||
'seo-keywords' => 'Meta keywords'
|
||||
'seo-keywords' => 'Meta keywords',
|
||||
|
||||
],
|
||||
|
||||
'sliders' => [
|
||||
|
|
@ -1263,7 +1266,9 @@ return [
|
|||
'order-number-length' => 'Order Number Length',
|
||||
'order-number-suffix' => 'Order Number Suffix',
|
||||
'default' => 'Default',
|
||||
'sandbox' => 'Sandbox'
|
||||
'sandbox' => 'Sandbox',
|
||||
'all-channels' => 'All',
|
||||
'all-locales' => 'All'
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -167,7 +167,9 @@ return [
|
|||
'disc_quantity' => 'مقدار استفاده نشده',
|
||||
'disc_threshold' => 'آستانه استفاده نشده',
|
||||
'use_coupon' => 'استافده از کوپن',
|
||||
'refunded' => 'Refunded'
|
||||
'refunded' => 'Refunded',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
],
|
||||
|
||||
'account' => [
|
||||
|
|
|
|||
|
|
@ -155,7 +155,9 @@ return [
|
|||
'per-cust' => 'Por cliente',
|
||||
'usage-throttle' => 'Tempos de uso',
|
||||
'for-guest' => 'Para convidados',
|
||||
'refunded' => 'Refunded'
|
||||
'refunded' => 'Refunded',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
],
|
||||
'account' => [
|
||||
'title' => 'Minha Conta',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<accordian :title="'{{ __('admin::app.catalog.products.categories') }}'" :active="false">
|
||||
<div slot="body">
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.before', ['product' => $product]) !!}
|
||||
|
||||
<tree-view behavior="normal" value-field="id" name-field="categories" input-type="checkbox" items='@json($categories)' value='@json($product->categories->pluck("id"))'></tree-view>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,45 @@
|
|||
|
||||
@section('content')
|
||||
<div class="content" style="height: 100%;">
|
||||
<?php $locale = request()->get('locale') ?: null; ?>
|
||||
<?php $channel = request()->get('channel') ?: null; ?>
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.catalog.products.title') }}</h1>
|
||||
|
||||
<div class="control-group">
|
||||
<select class="control" id="channel-switcher" name="channel" onchange="reloadPage('channel', this.value)" >
|
||||
<option value="all" {{ ! isset($channel) ? 'selected' : '' }}>
|
||||
{{ __('admin::app.admin.system.all-channels') }}
|
||||
</option>
|
||||
|
||||
@foreach (core()->getAllChannels() as $channelModel)
|
||||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale" onchange="reloadPage('locale', this.value)" >
|
||||
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
|
||||
{{ __('admin::app.admin.system.all-locales') }}
|
||||
</option>
|
||||
|
||||
@foreach (core()->getAllLocales() as $localeModel)
|
||||
|
||||
<option
|
||||
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}>
|
||||
{{ $localeModel->name }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
|
|
@ -46,4 +82,14 @@
|
|||
|
||||
@push('scripts')
|
||||
@include('admin::export.export', ['gridName' => $products])
|
||||
<script>
|
||||
|
||||
function reloadPage(getVar, getVal) {
|
||||
let url = new URL(window.location.href);
|
||||
url.searchParams.set(getVar, getVal);
|
||||
|
||||
window.location.href = url.href;
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
|
||||
</div>
|
||||
|
||||
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country') ?? '', 'stateCode' => old('state') ?? ''])
|
||||
@include ('admin::customers.country-state', ['countryCode' => old('country') ?? config('app.default_country'), 'stateCode' => old('state') ?? ''])
|
||||
|
||||
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
|
||||
<label for="postcode" class="required">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
|
||||
<label for="gender" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
|
||||
<select name="gender" class="control" v-validate="'required'" data-vv-as=""{{ __('shop::app.customers.customers.gender') }}"">
|
||||
<select name="gender" class="control" v-validate="'required'" data-vv-as=""{{ __('admin::app.customers.customers.gender') }}"">
|
||||
<option value=""></option>
|
||||
<option value="Other">{{ __('admin::app.customers.customers.other') }}</option>
|
||||
<option value="Male">{{ __('admin::app.customers.customers.male') }}</option>
|
||||
<option value="Female">{{ __('admin::app.customers.customers.female') }}</option>
|
||||
|
|
|
|||
|
|
@ -55,9 +55,10 @@
|
|||
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
|
||||
<label for="gender" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
|
||||
<select name="gender" class="control" value="{{ $customer->gender }}" v-validate="'required'" data-vv-as=""{{ __('shop::app.customers.customers.gender') }}"">
|
||||
<option value="" {{ $customer->gender == "" ? 'selected' : '' }}></option>
|
||||
<option value="Other" {{ $customer->gender == "Other" ? 'selected' : '' }}>{{ __('admin::app.customers.customers.other') }}</option>
|
||||
<option value="Male" {{ $customer->gender == "Male" ? 'selected' : '' }}>{{ __('admin::app.customers.customers.male') }}</option>
|
||||
<option value="Female" {{ $customer->gender == "Female" ? 'selected' : '' }}>{{ __('admin::app.customers.customers.female') }}</option>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
<thead>
|
||||
<tr>
|
||||
@foreach ($columns as $key => $value)
|
||||
<th>{{ $value }}</th>
|
||||
<?php
|
||||
$title = $value == 'increment_id' ? 'order_id' : $value;
|
||||
?>
|
||||
<th>{{ $title }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@
|
|||
|
||||
attribute_type_indexes: {
|
||||
'product': 0
|
||||
},
|
||||
},
|
||||
|
||||
condition_operators: {
|
||||
'price': [{
|
||||
|
|
@ -516,7 +516,7 @@
|
|||
if (matchedAttribute[0]['type'] == 'multiselect' || matchedAttribute[0]['type'] == 'checkbox') {
|
||||
this.condition.operator = '{}';
|
||||
|
||||
this.condition.value = this.condition.value == '' && this.condition.value != undefined ? [] : this.condition.value;
|
||||
this.condition.value = this.condition.value == '' && this.condition.value != undefined ? [] : [ this.condition.value ];
|
||||
}
|
||||
|
||||
return matchedAttribute[0];
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ class CategoryController extends Controller
|
|||
session()->flash('warning', trans('admin::app.response.delete-category-root', ['name' => 'Category']));
|
||||
} else {
|
||||
try {
|
||||
Event:: fire('catalog.category.delete.before', $id);
|
||||
Event::dispatch('catalog.category.delete.before', $id);
|
||||
|
||||
$this->categoryRepository->delete($id);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Checkout\Models\CartAddress;
|
||||
|
||||
$factory->define(CartAddress::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
return [
|
||||
'first_name' => $faker->firstName(),
|
||||
'last_name' => $faker->lastName,
|
||||
'email' => $faker->email,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
'address_type' => 'billing',
|
||||
];
|
||||
});
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Webkul\Customer\Models\Customer;
|
||||
use Webkul\Checkout\Models\Cart;
|
||||
use Webkul\Checkout\Models\CartAddress;
|
||||
|
||||
$factory->define(Cart::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
|
||||
$lastOrder = DB::table('orders')
|
||||
->orderBy('id', 'desc')
|
||||
->select('id')
|
||||
->first();
|
||||
|
||||
$customer = factory(Customer::class)->create();
|
||||
$cartAddress = factory(CartAddress::class)->create();
|
||||
|
||||
return [
|
||||
'is_guest' => 0,
|
||||
'is_active' => 1,
|
||||
'customer_id' => $customer->id,
|
||||
'customer_email' => $customer->email,
|
||||
'customer_first_name' => $customer->first_name,
|
||||
'customer_last_name' => $customer->last_name,
|
||||
'is_gift' => 0,
|
||||
'base_currency_code' => 'EUR',
|
||||
'channel_currency_code' => 'EUR',
|
||||
'grand_total' => 0.0000,
|
||||
'base_grand_total' => 0.0000,
|
||||
'sub_total' => 0.0000,
|
||||
'base_sub_total' => 0.0000,
|
||||
'channel_id' => 1,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Checkout\Models\CartItem;
|
||||
|
||||
$factory->define(CartItem::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
|
||||
return [
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Checkout\Models\CartPayment;
|
||||
|
||||
$factory->define(CartPayment::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
|
||||
return [
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -5,6 +5,7 @@ namespace Webkul\Checkout\Providers;
|
|||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Webkul\Checkout\Facades\Cart;
|
||||
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
||||
|
||||
class CheckoutServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -17,6 +18,8 @@ class CheckoutServiceProvider extends ServiceProvider
|
|||
$this->app->register(ModuleServiceProvider::class);
|
||||
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
|
||||
$this->registerEloquentFactoriesFrom(__DIR__ . '/../Database/Factories');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -48,4 +51,16 @@ class CheckoutServiceProvider extends ServiceProvider
|
|||
|
||||
$this->app->bind('cart', 'Webkul\Checkout\Cart');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register factories.
|
||||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerEloquentFactoriesFrom($path): void
|
||||
{
|
||||
$this->app->make(EloquentFactory::class)->load($path);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Core\Models\Currency;
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
$factory->define(Currency::class, function (Faker $faker, array $attributes) {
|
||||
|
||||
return [
|
||||
'code' => $faker->unique()->currencyCode,
|
||||
'name' => $faker->word,
|
||||
];
|
||||
|
||||
});
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Core\Models\Locale;
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
$factory->define(Locale::class, function (Faker $faker, array $attributes) {
|
||||
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterNameColumnInCountryStateTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('country_state_translations', function (Blueprint $table) {
|
||||
$table->renameColumn('name', 'default_name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('country_state_translations', function (Blueprint $table) {
|
||||
$table->renameColumn('default_name', 'name');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Arr;
|
||||
use DB;
|
||||
|
||||
class CountryStateTranslationSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
|
||||
foreach (['ar', 'fa', 'pt_BR'] as $code) {
|
||||
DB::table('country_translations')->where('locale', $code)->delete();
|
||||
|
||||
DB::table('country_state_translations')->where('locale', $code)->delete();
|
||||
|
||||
$countryTranslations = json_decode(file_get_contents(__DIR__ . '/../../Data/country_state_translation/countries_' . $code . '.json'), true);
|
||||
|
||||
data_fill($countryTranslations, '*.locale', $code);
|
||||
|
||||
$stateTranslations = json_decode(file_get_contents(__DIR__ . '/../../Data/country_state_translation/states_' . $code . '.json'), true);
|
||||
|
||||
data_fill($stateTranslations, '*.locale', $code);
|
||||
|
||||
DB::table('country_translations')->insert($countryTranslations);
|
||||
DB::table('country_state_translations')->insert($stateTranslations);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ class DatabaseSeeder extends Seeder
|
|||
$this->call(CurrencyTableSeeder::class);
|
||||
$this->call(CountriesTableSeeder::class);
|
||||
$this->call(StatesTableSeeder::class);
|
||||
$this->call(CountryStateTranslationSeeder::class);
|
||||
$this->call(ChannelTableSeeder::class);
|
||||
$this->call(ConfigTableSeeder::class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,23 @@ namespace Webkul\Core\Models;
|
|||
use Webkul\Core\Eloquent\TranslatableModel;
|
||||
use Webkul\Core\Contracts\CountryState as CountryStateContract;
|
||||
|
||||
|
||||
class CountryState extends TranslatableModel implements CountryStateContract
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
public $translatedAttributes = ['name'];
|
||||
public $translatedAttributes = ['default_name'];
|
||||
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$array = parent::toArray();
|
||||
|
||||
$array['default_name'] = $this->default_name;
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,5 +9,5 @@ class CountryStateTranslation extends Model implements CountryStateTranslationCo
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['name'];
|
||||
protected $fillable = ['default_name'];
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Webkul\Inventory\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
|
||||
|
||||
class InventoryServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -14,6 +15,8 @@ class InventoryServiceProvider extends ServiceProvider
|
|||
public function boot()
|
||||
{
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->app->make(EloquentFactory::class)->load(__DIR__ . '/../Database/Factories');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ $factory->define(ProductDownloadableLinkTranslation::class, function (Faker $fak
|
|||
'locale' => 'en',
|
||||
'title' => $faker->word,
|
||||
];
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
if (isset($options[$attribute->id][$optionId])) {
|
||||
$attributeOptionsData[] = [
|
||||
'id' => $optionId,
|
||||
'label' => $attributeOption->label,
|
||||
'label' => $attributeOption->label ? $attributeOption->label : $attributeOption->admin_name,
|
||||
'swatch_value' => $attribute->swatch_type == 'image' ? $attributeOption->swatch_value_url : $attributeOption->swatch_value,
|
||||
'products' => $options[$attribute->id][$optionId]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ class ProductServiceProvider extends ServiceProvider
|
|||
{
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
|
||||
$this->app->make(EloquentFactory::class)->load(__DIR__ . '/../Database/Factories');
|
||||
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
|
||||
$this->publishes([
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ class Configurable extends AbstractType
|
|||
$data['attributes'][$attribute->code] = [
|
||||
'attribute_name' => $attribute->name ? $attribute->name : $attribute->admin_name,
|
||||
'option_id' => $option->id,
|
||||
'option_label' => $option->label,
|
||||
'option_label' => $option->label ? $option->label : $option->admin_name,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Product\Models\Product;
|
||||
use Webkul\Sales\Models\Invoice;
|
||||
use Webkul\Sales\Models\InvoiceItem;
|
||||
use Webkul\Sales\Models\OrderItem;
|
||||
|
||||
$factory->define(InvoiceItem::class, function (Faker $faker, array $attributes) {
|
||||
|
||||
$basePrice = $faker->randomFloat(2);
|
||||
$quantity = $faker->randomNumber();
|
||||
|
||||
if (! $attributes['order_item_id']) {
|
||||
$attributes['order_item_id'] = function () {
|
||||
return factory(OrderItem::class)->create()->id;
|
||||
};
|
||||
}
|
||||
|
||||
$orderItem = OrderItem::find($attributes['order_item_id']);
|
||||
|
||||
return [
|
||||
'name' => $faker->word,
|
||||
'sku' => $faker->unique()->ean13,
|
||||
'qty' => $quantity,
|
||||
'price' => $basePrice,
|
||||
'base_price' => $basePrice,
|
||||
'total' => $quantity * $basePrice,
|
||||
'base_total' => $quantity * $basePrice,
|
||||
'tax_amount' => 0,
|
||||
'base_tax_amount' => 0,
|
||||
'product_id' => $orderItem->product_id,
|
||||
'product_type' => $orderItem->product_type,
|
||||
'order_item_id' => $attributes['order_item_id'],
|
||||
'invoice_id' => function () {
|
||||
return factory(Invoice::class)->create()->id;
|
||||
},
|
||||
];
|
||||
});
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Webkul\Product\Models\Product;
|
||||
use Webkul\Sales\Models\Order;
|
||||
use Webkul\Sales\Models\OrderItem;
|
||||
|
||||
$factory->define(OrderItem::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
|
||||
$product = factory(Product::class, 'simple')->create();
|
||||
|
||||
return [
|
||||
'sku' => $product->sku,
|
||||
'type' => $product->type,
|
||||
'name' => $product->name,
|
||||
'price' => $product->price,
|
||||
'base_price' => $product->price,
|
||||
'total' => $product->price,
|
||||
'base_total' => $product->price,
|
||||
'product_id' => $product->id,
|
||||
'qty_ordered' => 1,
|
||||
'qty_shipped' => 0,
|
||||
'qty_invoiced' => 0,
|
||||
'qty_canceled' => 0,
|
||||
'qty_refunded' => 0,
|
||||
'order_id' => function () {
|
||||
return factory(Order::class)->create()->id;
|
||||
},
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Webkul\Sales\Models\OrderPayment;
|
||||
|
||||
$factory->define(OrderPayment::class, function (Faker $faker) {
|
||||
$now = date("Y-m-d H:i:s");
|
||||
|
||||
return [
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
];
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=d0a3f597b439d75f4a4e",
|
||||
"/css/shop.css": "/css/shop.css?id=617c680f279cb4a73734"
|
||||
"/css/shop.css": "/css/shop.css?id=dbbd9009872174a61946"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -927,7 +927,6 @@ section.slider-block {
|
|||
|
||||
.dropdown-content {
|
||||
padding-top: 8px;
|
||||
margin-bottom: 55px;
|
||||
width: 100%;
|
||||
max-height: 329px;
|
||||
overflow-y: auto;
|
||||
|
|
@ -975,11 +974,9 @@ section.slider-block {
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 16px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-top: 1px solid $border-color;
|
||||
|
||||
.btn {
|
||||
margin: 0;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=d6802d7d61cdbdfc21e5",
|
||||
"/js/ui.js": "/js/ui.js?id=d4f31631ea9c862c6dc5",
|
||||
"/css/ui.css": "/css/ui.css?id=0895b560bbc19259cee8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,14 +35,9 @@
|
|||
},
|
||||
|
||||
mounted: function() {
|
||||
var this_this = this;
|
||||
this.addHasErrorClass()
|
||||
|
||||
eventBus.$on('onFormError', function() {
|
||||
$(this_this.$el).find('.control-group').each(function(index, element) {
|
||||
if ($(element).hasClass('has-error'))
|
||||
this_this.hasError = true;
|
||||
});
|
||||
})
|
||||
eventBus.$on('onFormError', this.addHasErrorClass);
|
||||
|
||||
this.isActive = this.active;
|
||||
},
|
||||
|
|
@ -50,6 +45,18 @@
|
|||
methods: {
|
||||
toggleAccordian: function() {
|
||||
this.isActive = ! this.isActive;
|
||||
},
|
||||
|
||||
addHasErrorClass: function() {
|
||||
var this_this = this;
|
||||
|
||||
setTimeout(function() {
|
||||
$(this_this.$el).find('.control-group').each(function(index, element) {
|
||||
if ($(element).hasClass('has-error')) {
|
||||
this_this.hasError = true;
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,10 @@
|
|||
},
|
||||
|
||||
created () {
|
||||
let index = this.savedValues.indexOf(this.items[this.valueField])
|
||||
if (! this.savedValues)
|
||||
return;
|
||||
|
||||
let index = this.savedValues.indexOf(this.items[this.valueField].toString())
|
||||
if(index !== -1) {
|
||||
this.value.push(this.items);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
computed: {
|
||||
savedValues () {
|
||||
if(!this.value)
|
||||
if(! this.value)
|
||||
return [];
|
||||
|
||||
if(this.inputType == 'radio')
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Tests\Functional\Admin\Catalog;
|
||||
|
||||
|
||||
use FunctionalTester;
|
||||
use Webkul\Attribute\Models\Attribute;
|
||||
|
||||
|
|
@ -76,7 +75,7 @@ class AttributeCest
|
|||
private function fillForm(FunctionalTester $I, bool $skipType = false): array
|
||||
{
|
||||
$testData = [
|
||||
'code' => $I->fake()->word,
|
||||
'code' => $I->fake()->firstName,
|
||||
'type' => $I->fake()->randomElement([
|
||||
'text',
|
||||
'textarea',
|
||||
|
|
@ -85,7 +84,7 @@ class AttributeCest
|
|||
'select',
|
||||
'multiselect'
|
||||
]),
|
||||
'admin_name' => $I->fake()->word,
|
||||
'admin_name' => $I->fake()->firstName,
|
||||
];
|
||||
|
||||
$I->fillField('code', $testData['code']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue