Fixed issue #749 for all customer resources profile, wishlist, reviews, orders and addresses

This commit is contained in:
Prashant Singh 2019-04-01 12:45:56 +05:30
commit 06aa4dd6bf
22 changed files with 214 additions and 50 deletions

View File

@ -19,7 +19,7 @@ class TaxRateDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate');
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'zip_code', 'zip_from', 'zip_to', 'tax_rate');
$this->setQueryBuilder($queryBuilder);
}
@ -62,6 +62,33 @@ class TaxRateDataGrid extends DataGrid
'filterable' => true
]);
$this->addColumn([
'index' => 'zip_code',
'label' => trans('admin::app.configuration.tax-rates.zip_code'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true
]);
$this->addColumn([
'index' => 'zip_from',
'label' => trans('admin::app.configuration.tax-rates.zip_from'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true
]);
$this->addColumn([
'index' => 'zip_to',
'label' => trans('admin::app.configuration.tax-rates.zip_to'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true
]);
$this->addColumn([
'index' => 'tax_rate',
'label' => trans('admin::app.datagrid.tax-rate'),

View File

@ -94,8 +94,8 @@
</div>
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
<textarea v-validate="'required'" class="control" id="description" name="description" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old('description') }}</textarea>
<label for="description" id="descript-label" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
<textarea v-validate="''" class="control" id="description" name="description" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old('description') }}</textarea>
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
</div>
@ -189,6 +189,14 @@
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | code',
image_advtab: true
});
$('#display_mode').on('change', function (e) {
if ($('#display_mode').val() != 'products_only') {
$("#descript-label").addClass("required");
} else {
$("#descript-label").removeClass("required");
}
})
});
</script>
@endpush

View File

@ -107,8 +107,8 @@
</div>
<div class="control-group" :class="[errors.has('{{$locale}}[description]') ? 'has-error' : '']">
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
<textarea v-validate="'required'" class="control" id="description" name="{{$locale}}[description]" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old($locale)['description'] ?: $category->translate($locale)['description'] }}</textarea>
<label for="description">{{ __('admin::app.catalog.categories.description') }}</label>
<textarea class="control" id="description" name="{{$locale}}[description]" data-vv-as="&quot;{{ __('admin::app.catalog.categories.description') }}&quot;">{{ old($locale)['description'] ?: $category->translate($locale)['description'] }}</textarea>
<span class="control-error" v-if="errors.has('{{$locale}}[description]')">@{{ errors.first('{!!$locale!!}[description]') }}</span>
</div>

View File

@ -75,7 +75,8 @@ class CategoryController extends Controller
$this->validate(request(), [
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug],
'name' => 'required',
'image.*' => 'mimes:jpeg,jpg,bmp,png'
'image.*' => 'mimes:jpeg,jpg,bmp,png',
'description' => 'required_if:display_mode,==,description_only,products_and_description'
]);
if (strtolower(request()->input('name')) == 'root') {

View File

@ -16,6 +16,17 @@ class Currency extends Model implements CurrencyContract
'code', 'name'
];
/**
* Set currency code in capital
*
* @param string $value
* @return void
*/
public function setCodeAttribute($code)
{
$this->attributes['code'] = strtoupper($code);
}
/**
* Get the currency_exchange associated with the currency.
*/

View File

@ -37,9 +37,17 @@ class SearchRepository extends Repository
}
public function search($data) {
$term = $data['term'];
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
$searchTerm = explode("?", $query);
$serachQuery = '';
$products = $this->product->searchProductByAttribute($term);
foreach($searchTerm as $term){
if (strpos($term, 'term') !== false) {
$serachQuery = last(explode("=", $term));
}
}
$products = $this->product->searchProductByAttribute($serachQuery);
return $products;
}

View File

@ -4,6 +4,7 @@ namespace Webkul\Sales\Repositories;
use Illuminate\Container\Container as App;
use Webkul\Core\Eloquent\Repository;
use Illuminate\Support\Facades\Event;
/**
* ShipmentItem Reposotory
@ -31,16 +32,16 @@ class ShipmentItemRepository extends Repository
{
if (! $data['product'])
return;
$orderedInventory = $data['product']->ordered_inventories()
->where('channel_id', $data['shipment']->order->channel->id)
->first();
if ($orderedInventory) {
if (($orderedQty = $orderedInventory->qty - $data['qty']) < 0) {
$orderedQty = 0;
}
$orderedInventory->update([
'qty' => $orderedQty
]);
@ -59,7 +60,7 @@ class ShipmentItemRepository extends Repository
if (!$inventory)
return;
if (($qty = $inventory->qty - $data['qty']) < 0) {
$qty = 0;
}
@ -67,5 +68,7 @@ class ShipmentItemRepository extends Repository
$inventory->update([
'qty' => $qty
]);
Event::fire('catalog.product.update.after', $data['product']);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=412d129ed770afb5dee3",
"/css/shop.css": "/css/shop.css?id=aa96d0d4c9331da1e0c2"
"/css/shop.css": "/css/shop.css?id=d98996a63bdc266f7832"
}

View File

@ -104,7 +104,7 @@ class CartController extends Controller
if ($result) {
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
return redirect()->route($this->_config['redirect']);
return redirect()->back();
} else {
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
@ -177,7 +177,9 @@ class CartController extends Controller
Cart::collectTotals();
if ($this->suppressFlash) {
session()->flash('success', trans('shop::app.checkout.cart.partial-cart-update'));
session()->forget('success');
session()->forget('warning');
session()->flash('info', trans('shop::app.checkout.cart.partial-cart-update'));
}
return redirect()->back();

View File

@ -29,7 +29,17 @@ class Currency
*/
public function handle($request, Closure $next)
{
if ($currency = $request->get('currency')) {
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
$currencyTerm = preg_split('/(\?|&)/', $query);
$currencyCode = '';
foreach($currencyTerm as $term){
if (strpos($term, 'currency') !== false) {
$currencyCode = last(explode("=", $term));
}
}
if ($currency = $currencyCode) {
if ($this->currency->findOneByField('code', $currency)) {
session()->put('currency', $currency);
}

View File

@ -29,7 +29,17 @@ class Locale
*/
public function handle($request, Closure $next)
{
if ($locale = $request->get('locale')) {
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
$localeTerm = preg_split('/(\?|&)/', $query);
$localCode = '';
foreach($localeTerm as $term){
if (strpos($term, 'locale') !== false) {
$localCode = last(explode("=", $term));
}
}
if ($locale = $localCode) {
if ($this->locale->findOneByField('code', $locale)) {
app()->setLocale($locale);

View File

@ -1083,7 +1083,6 @@ section.slider-block {
.nav li {
position: relative;
height:45px;
}
.nav > li {
@ -1101,6 +1100,9 @@ section.slider-block {
.nav li li a {
margin-top: 1px;
white-space: initial;
word-break: break-word;
width: 200px;
}
.nav li a:first-child:nth-last-child(2):before {
@ -3653,7 +3655,7 @@ section.review {
// product card
.main-container-wrapper .product-card .sticker {
left: auto;
right: 10px;
right: 20px;
}
.main-container-wrapper .product-card .cart-wish-wrap .addtocart {
@ -4025,6 +4027,14 @@ section.review {
left: auto;
}
}
.product-list {
.product-card .product-information {
padding-left: 0px;
padding-right: 30px;
float: left;
}
}
}
/// rtl css end here

View File

@ -9,7 +9,7 @@ return [
'wishlist' => 'قائمة الأماني',
'orders' => 'الأوامر',
],
'common' => [
'error' => 'حدث شيء خاطئ ، رجاء حاول ثانية لاحقا.'
],
@ -385,7 +385,8 @@ return [
],
'quantity-error' => 'الكمية المطلوبة غير متوفرة',
'cart-subtotal' => 'المجموع الفرعي للعربات',
'cart-remove-action' => 'هل تريد حقا أن تفعل هذا ؟'
'cart-remove-action' => 'هل تريد حقا أن تفعل هذا ؟',
'partial-cart-update' => 'Only some of the product(s) were updated'
],
'onepage' => [

View File

@ -390,7 +390,8 @@ return [
],
'quantity-error' => 'Quantidade solicitada não está disponível',
'cart-subtotal' => 'Subtotal do carrinho',
'cart-remove-action' => 'Você realmente quer fazer isso ?'
'cart-remove-action' => 'Você realmente quer fazer isso ?',
'partial-cart-update' => 'Only some of the product(s) were updated'
],
'onepage' => [

View File

@ -30,13 +30,28 @@
</form>
</div>
<?php
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
$searchTerm = explode("?", $query);
foreach($searchTerm as $term){
if (strpos($term, 'term') !== false) {
$serachQuery = $term;
}
}
?>
<span class="list-heading">{{ __('shop::app.footer.locale') }}</span>
<div class="form-container">
<div class="control-group">
<select class="control locale-switcher" onchange="window.location.href = this.value">
@foreach (core()->getCurrentChannel()->locales as $locale)
<option value="?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
@if(isset($serachQuery))
<option value="?{{ $serachQuery }}?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
@else
<option value="?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
@endif
@endforeach
</select>
@ -50,7 +65,11 @@
<select class="control locale-switcher" onchange="window.location.href = this.value">
@foreach (core()->getCurrentChannel()->currencies as $currency)
<option value="?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
@if(isset($serachQuery))
<option value="?{{ $serachQuery }}?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
@else
<option value="?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
@endif
@endforeach
</select>

View File

@ -28,6 +28,16 @@
</ul>
</div>
<?php
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
$searchTerm = explode("?", $query);
foreach($searchTerm as $term){
if (strpos($term, 'term') !== false) {
$serachQuery = $term;
}
}
?>
<div class="right-content">
@ -48,7 +58,11 @@
<ul class="dropdown-list currency">
@foreach (core()->getCurrentChannel()->currencies as $currency)
<li>
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
@if(isset($serachQuery))
<a href="?{{ $serachQuery }}?currency={{ $currency->code }}">{{ $currency->code }}</a>
@else
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
@endif
</li>
@endforeach
</ul>

View File

@ -189,11 +189,20 @@ class TaxRateController extends Controller
foreach ($excelData as $data) {
foreach ($data as $column => $uploadData) {
if (!is_null($uploadData['zip_from']) && !is_null($uploadData['zip_to'])) {
$uploadData['is_zip'] = 1;
}
$validator = Validator::make($uploadData, [
'identifier' => 'required|string',
'state' => 'required|string',
'country' => 'required|string',
'tax_rate' => 'required|numeric'
'tax_rate' => 'required|numeric',
'is_zip' => 'sometimes',
'zip_code' => 'sometimes|required_without:is_zip',
'zip_from' => 'nullable|required_with:is_zip',
'zip_to' => 'nullable|required_with:is_zip,zip_from',
]);
if ($validator->fails()) {
@ -230,6 +239,12 @@ class TaxRateController extends Controller
$errorMsg[$coulmn] = $fail->first('country');
} else if ($fail->first('state')) {
$errorMsg[$coulmn] = $fail->first('state');
} else if ($fail->first('zip_code')) {
$errorMsg[$coulmn] = $fail->first('zip_code');
} else if ($fail->first('zip_from')) {
$errorMsg[$coulmn] = $fail->first('zip_from');
} else if ($fail->first('zip_to')) {
$errorMsg[$coulmn] = $fail->first('zip_to');
}
}
@ -250,6 +265,11 @@ class TaxRateController extends Controller
foreach ($excelData as $data) {
foreach ($data as $column => $uploadData) {
if (!is_null($uploadData['zip_from']) && !is_null($uploadData['zip_to'])) {
$uploadData['is_zip'] = 1;
$uploadData['zip_code'] = NULL;
}
if (isset($rateIdentifier)) {
$id = array_search($uploadData['identifier'], $rateIdentifier);
if ($id) {

View File

@ -116,6 +116,30 @@ class Requirement {
];
}
/**
* Check composer installation.
*
* @return array
*/
public function composerInstall()
{
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php';
if (file_exists($autoLoadFile)) {
$data['composer_install'] = 0;
} else {
$data['composer_install'] = 1;
$data['composer'] = 'Composer dependencies is not Installed.Go to root of project, run "composer install" command to install composer dependencies & refresh page again.';
}
return $data;
}
/**
* Render view for class.
*
@ -126,6 +150,8 @@ class Requirement {
$phpVersion = $this->checkPHPversion();
$composerInstall = $this->composerInstall();
ob_start();
include __DIR__ . '/../Views/requirements.blade.php';

View File

@ -1,25 +1,7 @@
<?php
// array to pass back data
$data = array();
$location = str_replace('\\', '/', getcwd());
$currentLocation = explode("/", $location);
array_pop($currentLocation);
array_pop($currentLocation);
$desiredLocation = implode("/", $currentLocation);
$autoLoadFile = $desiredLocation . '/' . 'vendor' . '/' . 'autoload.php';
if (file_exists($autoLoadFile)) {
$data['install'] = 0;
} else {
$data['install'] = 1;
$data['composer'] = 'Composer dependencies is not Installed.Go to root of project, run "composer install" command to install composer dependencies & refresh page again.';
}
// return a response
//return all our data to an AJAX call
$data['install'] = 0;
echo json_encode($data);

View File

@ -75,9 +75,6 @@
<div style="text-align: center;">
<span> Click the below button to run following : </span>
</div>
<div class="message" style="margin-top: 20px">
<span> Check Composer dependency </span>
</div>
<div class="message">
<span>Database Migartion </span>
</div>

View File

@ -39,9 +39,23 @@
<?php endforeach; ?>
<?php endforeach; ?>
<php class="check" style="margin-left: 25%">
<?php if(($composerInstall['composer_install'] == 0) ? $src = $greenCheck : $src = $redCheck ): ?>
<img src="<?php echo $src ?>">
<span style="margin-left: 10px"><b>Composer</b></span>
<?php endif; ?>
</php>
<div style="margin-left: 30%;">
<?php if(!($composerInstall['composer_install'] == 0)): ?>
<span style="margin-left: 10px; color: red;"><?php echo $composerInstall['composer'] ?></span>
<?php endif; ?>
</div>
</div>
<?php if(!isset($requirements['errors']) && $phpVersion['supported']): ?>
<?php if(!isset($requirements['errors']) && ($phpVersion['supported'] && $composerInstall['composer_install'] == 0)): ?>
<div>
<button type="button" class="prepare-btn" id="requirement-check">Continue</button>
</div>