Merge pull request #1420 from prashant-webkul/development
Fixed translation issue in catalog rule delete notification
This commit is contained in:
commit
da8b21cab1
|
|
@ -1,6 +1,24 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'save' => 'Save',
|
||||
'create' => 'Create',
|
||||
'update' => 'Update',
|
||||
'delete' => 'Delete',
|
||||
'failed' => 'Failed',
|
||||
'store' => 'Store',
|
||||
'image' => 'Image',
|
||||
'no result' => 'No result',
|
||||
'product' => 'Product',
|
||||
'attribute' => 'Attribute',
|
||||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
'true' => 'True',
|
||||
'false' => 'False',
|
||||
'apply' => 'Apply',
|
||||
'action' => 'Action',
|
||||
'label' => 'Label',
|
||||
|
||||
'common' => [
|
||||
'no-result-found' => 'We could not find any records.',
|
||||
'country' => 'Country',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<div class="page-action">
|
||||
<button type="submi t" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.account.save-btn-title') }}
|
||||
{{ __('admin::app.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.catalog.categories.save-btn-title') }}
|
||||
{{ __('admin::app.catalog.categories.-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@
|
|||
<accordian :active="false" title="{{ __('admin::app.promotion.actions') }}">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('action_type') ? 'has-error' : '']">
|
||||
<label for="action_type" class="required">{{ __('admin::app.promotion.general-info.apply') }}</label>
|
||||
<label for="action_type" class="required">{{ __('admin::app.action') }}</label>
|
||||
|
||||
<select class="control" name="action_type" v-model="action_type" v-validate="'required'" value="{{ old('action_type') }}" data-vv-as=""{{ __('admin::app.promotion.general-info.apply') }}"" v-on:change="detectApply">
|
||||
<option v-for="(action, index) in actions" :value="index">@{{ action }}</option>
|
||||
|
|
@ -402,7 +402,7 @@
|
|||
@foreach(core()->getAllChannels() as $channel)
|
||||
@foreach($channel->locales as $locale)
|
||||
<div class="control-group" :class="[errors.has('label') ? 'has-error' : '']">
|
||||
<label for="code"><span class="locale">[{{ $channel->code }} - {{ $locale->code }}]</span></label>
|
||||
<label for="code">{{ __('admin::app.label') }}<span class="locale">[{{ $channel->code }} - {{ $locale->code }}]</span></label>
|
||||
|
||||
<input type="text" class="control" name="label[{{ $channel->code }}][{{ $locale->code }}]" v-model="label.{{ $channel->code }}.{{ $locale->code }}" data-vv-as=""{{ __('admin::app.promotion.general-info.label') }}"">
|
||||
|
||||
|
|
@ -430,25 +430,23 @@
|
|||
name: null,
|
||||
description: null,
|
||||
conditions_list: [],
|
||||
channels: [],
|
||||
customer_groups: [],
|
||||
channels: ['{{ core()->getCurrentChannel()->id }}'],
|
||||
customer_groups: ['{{ app('Webkul\Customer\Repositories\CustomerGroupRepository')->findOneWhere(["code" => "general"])->id }}'],
|
||||
ends_till: null,
|
||||
starts_from: null,
|
||||
priority: 0,
|
||||
per_customer: 0,
|
||||
status: null,
|
||||
use_coupon: null,
|
||||
status: 0,
|
||||
use_coupon: 0,
|
||||
auto_generation: false,
|
||||
usage_limit: 0,
|
||||
|
||||
action_type: null,
|
||||
apply: null,
|
||||
apply_amt: false,
|
||||
apply_prct: false,
|
||||
apply_to_shipping: 0,
|
||||
disc_amount: null,
|
||||
disc_amount: 1,
|
||||
// disc_threshold: null,
|
||||
disc_quantity: null,
|
||||
disc_quantity: 1,
|
||||
end_other_rules: 0,
|
||||
coupon_type: null,
|
||||
free_shipping: 0,
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@
|
|||
<accordian :active="false" title="{{ __('admin::app.promotion.actions') }}">
|
||||
<div slot="body">
|
||||
<div class="control-group" :class="[errors.has('action_type') ? 'has-error' : '']">
|
||||
<label for="action_type" class="required">{{ __('admin::app.promotion.general-info.apply') }}</label>
|
||||
<label for="action_type" class="required">{{ __('admin::app.action') }}</label>
|
||||
|
||||
<select class="control" name="action_type" v-model="action_type" v-validate="'required'" value="{{ old('action_type') }}" data-vv-as=""Apply As"" v-on:change="detectApply">
|
||||
<option v-for="(action, index) in actions" :value="index">@{{ action }}</option>
|
||||
|
|
@ -259,14 +259,6 @@
|
|||
<span class="control-error" v-if="errors.has('disc_amount')">@{{ errors.first('disc_amount') }}</span>
|
||||
</div>
|
||||
|
||||
{{-- <div class="control-group" :class="[errors.has('disc_threshold') ? 'has-error' : '']">
|
||||
<label for="disc_threshold" class="required">{{ __('admin::app.promotion.cart.buy-atleast') }}</label>
|
||||
|
||||
<input type="number" step="1" class="control" name="disc_threshold" v-model="disc_threshold" v-validate="'required|numeric|min_value:1'" value="{{ old('disc_threshold') }}" data-vv-as=""{{ __('admin::app.promotion.cart.buy-atleast') }}"">
|
||||
|
||||
<span class="control-error" v-if="errors.has('disc_threshold')">@{{ errors.first('disc_threshold') }}</span>
|
||||
</div> --}}
|
||||
|
||||
<div class="control-group" :class="[errors.has('disc_quantity') ? 'has-error' : '']">
|
||||
<label for="disc_quantity" class="required">{{ __('admin::app.promotion.general-info.disc_qty') }}</label>
|
||||
|
||||
|
|
@ -403,9 +395,10 @@
|
|||
<accordian :active="false" :title="'{{ __('admin::app.promotion.general-info.labels') }}'">
|
||||
<div slot="body">
|
||||
@foreach($cart_rule[3]->labels as $label)
|
||||
<span>[{{ $label->channel->code }}]</span>
|
||||
<div class="control-group" :class="[errors.has('label') ? 'has-error' : '']">
|
||||
<label for="code">{{ $label->locale->code }}</label>
|
||||
<label for="code">{{ __('admin::app.label') }}
|
||||
<span class="locale">[{{ $label->channel->code }} - {{ $label->locale->code }}]</span>
|
||||
</label>
|
||||
|
||||
<input type="text" class="control" name="label[{{ $label->channel->code }}][{{ $label->locale->code }}]" value="{{ $label->label }}" data-vv-as=""Label"">
|
||||
|
||||
|
|
@ -443,11 +436,8 @@
|
|||
|
||||
action_type: null,
|
||||
apply: null,
|
||||
apply_amt: false,
|
||||
apply_prct: false,
|
||||
apply_to_shipping: null,
|
||||
disc_amount: null,
|
||||
// disc_threshold: null,
|
||||
disc_quantity: null,
|
||||
end_other_rules: null,
|
||||
coupon_type: null,
|
||||
|
|
@ -556,10 +546,6 @@
|
|||
|
||||
this.apply = null;
|
||||
|
||||
this.apply_amt = false;
|
||||
|
||||
this.apply_prct = false;
|
||||
|
||||
this.apply_to_shipping = data.apply_to_shipping;
|
||||
|
||||
this.disc_amount = data.disc_amount;
|
||||
|
|
|
|||
|
|
@ -779,7 +779,11 @@ abstract class Discount
|
|||
$result = true;
|
||||
|
||||
foreach ($conditions as $condition) {
|
||||
if (! isset($condition->attribute) || ! isset($condition->condition) || !isset($condition->value)) {
|
||||
$result = true;
|
||||
|
||||
if (! isset($condition->attribute) || ! isset($condition->condition) || ! isset($condition->value) || ! isset($condition->type) || $condition->value != []) {
|
||||
$result = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -804,55 +808,53 @@ abstract class Discount
|
|||
$result = false;
|
||||
}
|
||||
|
||||
if (isset($condition->type) && ($condition->type == 'numeric' || $condition->type == 'string' || $condition->type == 'text')) {
|
||||
if ($condition->type == 'string') {
|
||||
$actual_value = strtolower($actual_value);
|
||||
if ($condition->type == 'string') {
|
||||
$actual_value = strtolower($actual_value);
|
||||
|
||||
$test_value = strtolower($test_value);
|
||||
$test_value = strtolower($test_value);
|
||||
}
|
||||
|
||||
if ($test_condition == '=') {
|
||||
if ($actual_value != $test_value) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '>=') {
|
||||
if (! ($actual_value >= $test_value)) {
|
||||
$result = false;
|
||||
|
||||
if ($test_condition == '=') {
|
||||
if ($actual_value != $test_value) {
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '<=') {
|
||||
if (! ($actual_value <= $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '>=') {
|
||||
if (! ($actual_value >= $test_value)) {
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '>') {
|
||||
if (! ($actual_value > $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '<=') {
|
||||
if (! ($actual_value <= $test_value)) {
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '<') {
|
||||
if (! ($actual_value < $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '>') {
|
||||
if (! ($actual_value > $test_value)) {
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '{}') {
|
||||
if (! str_contains($actual_value, $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '<') {
|
||||
if (! ($actual_value < $test_value)) {
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '!{}') {
|
||||
if (str_contains($actual_value, $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '{}') {
|
||||
if (! str_contains($actual_value, $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
} else if ($test_condition == '!{}') {
|
||||
if (str_contains($actual_value, $test_value)) {
|
||||
$result = false;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,15 +75,13 @@ class ConvertXToProductId
|
|||
$this->conditionSymbols = config('pricerules.cart.conditions.symbols');
|
||||
}
|
||||
|
||||
public function convertX($attribute_conditions)
|
||||
public function convertX($attributeConditions)
|
||||
{
|
||||
$attributeConditions = json_decode(json_decode($attribute_conditions));
|
||||
$categoryValues = $attributeConditions->categories;
|
||||
|
||||
$categoryValues = $attributeConditions->categories ?? null;
|
||||
$attributeValues = $attributeConditions->attributes;
|
||||
|
||||
$attributeValues = $attributeConditions->attributes ?? null;
|
||||
|
||||
if (!isset($categoryValues) && !isset($attributeValues)) {
|
||||
if (! isset($categoryValues) && ! isset($attributeValues)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -115,71 +113,73 @@ class ConvertXToProductId
|
|||
$products = collect();
|
||||
|
||||
foreach ($attributeOptions as $attributeOption) {
|
||||
$selectedOptions = $attributeOption->value;
|
||||
if (isset($attributeOption->type) && $attributeOption->name != null && $attributeOption->condition != null && $attributeOption->value != [] && $attributeOption->type != null) {
|
||||
$selectedOptions = $attributeOption->value;
|
||||
|
||||
if ($attributeOption->type == 'select' || $attributeOption->type == 'multiselect') {
|
||||
$attribute = $this->attribute->findWhere([
|
||||
'code' => $attributeOption->attribute
|
||||
]);
|
||||
if ($attributeOption->type == 'select' || $attributeOption->type == 'multiselect') {
|
||||
$attribute = $this->attribute->findWhere([
|
||||
'code' => $attributeOption->attribute
|
||||
]);
|
||||
|
||||
$attributeOptions = $attribute->first()->options;
|
||||
$attributeOptions = $attribute->first()->options;
|
||||
|
||||
$selectedAttributeOptions = collect();
|
||||
$selectedAttributeOptions = collect();
|
||||
|
||||
foreach ($attributeOptions as $attributeOption) {
|
||||
foreach ($selectedOptions as $key => $value) {
|
||||
if ($attributeOption->id == $value) {
|
||||
$selectedAttributeOptions->push($attributeOption);
|
||||
foreach ($attributeOptions as $attributeOption) {
|
||||
foreach ($selectedOptions as $key => $value) {
|
||||
if ($attributeOption->id == $value) {
|
||||
$selectedAttributeOptions->push($attributeOption);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($selectedAttributeOptions as $selectedAttributeOption) {
|
||||
$typeColumn = $this->pav::$attributeTypeFields[$attribute->first()->type];
|
||||
foreach ($selectedAttributeOptions as $selectedAttributeOption) {
|
||||
$typeColumn = $this->pav::$attributeTypeFields[$attribute->first()->type];
|
||||
|
||||
$pavResults = $this->pav->where(
|
||||
"{$typeColumn}",
|
||||
$selectedAttributeOption->id
|
||||
)->get();
|
||||
$pavResults = $this->pav->where(
|
||||
"{$typeColumn}",
|
||||
$selectedAttributeOption->id
|
||||
)->get();
|
||||
|
||||
foreach ($pavResults as $pavResult) {
|
||||
if ($pavResult->product->type == 'simple')
|
||||
$products->push($pavResult->product);
|
||||
foreach ($pavResults as $pavResult) {
|
||||
if ($pavResult->product->type == 'simple')
|
||||
$products->push($pavResult->product);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$attribute = $this->attribute->findWhere([
|
||||
'code' => $attributeOption->attribute
|
||||
]);
|
||||
} else {
|
||||
$attribute = $this->attribute->findWhere([
|
||||
'code' => $attributeOption->attribute
|
||||
]);
|
||||
|
||||
$pavValues = $attribute->first();
|
||||
$pavValues = $attribute->first();
|
||||
|
||||
$selectedAttributeValues = collect();
|
||||
$selectedAttributeValues = collect();
|
||||
|
||||
if ($attributeOption->attribute == 'sku') {
|
||||
$testValue = $attributeOption->value;
|
||||
$testCondition = $attributeOption->condition;
|
||||
if ($attributeOption->attribute == 'sku') {
|
||||
$testValue = $attributeOption->value;
|
||||
$testCondition = $attributeOption->condition;
|
||||
|
||||
if ($testCondition == '{}') {
|
||||
$foundProducts = $this->product->findWhere([
|
||||
['sku', 'like', '%' . $testValue . '%'],
|
||||
['type', '!=', 'configurable']
|
||||
])->flatten()->all();
|
||||
} else if ($testCondition == '!{}') {
|
||||
$foundProducts = $this->product->findWhere([
|
||||
['sku', 'not like', '%' . $testValue . '%'],
|
||||
['type', '!=', 'configurable']
|
||||
])->flatten()->all();
|
||||
} else if ($testCondition == '=') {
|
||||
$foundProducts = $this->product->findWhere([
|
||||
['sku', '=', '%' . $testValue . '%'],
|
||||
['type', '!=', 'configurable']
|
||||
])->flatten()->all();
|
||||
if ($testCondition == '{}') {
|
||||
$foundProducts = $this->product->findWhere([
|
||||
['sku', 'like', '%' . $testValue . '%'],
|
||||
['type', '!=', 'configurable']
|
||||
])->flatten()->all();
|
||||
} else if ($testCondition == '!{}') {
|
||||
$foundProducts = $this->product->findWhere([
|
||||
['sku', 'not like', '%' . $testValue . '%'],
|
||||
['type', '!=', 'configurable']
|
||||
])->flatten()->all();
|
||||
} else if ($testCondition == '=') {
|
||||
$foundProducts = $this->product->findWhere([
|
||||
['sku', '=', '%' . $testValue . '%'],
|
||||
['type', '!=', 'configurable']
|
||||
])->flatten()->all();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($foundProducts as $foundProduct) {
|
||||
$products->push($foundProduct);
|
||||
foreach ($foundProducts as $foundProduct) {
|
||||
$products->push($foundProduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ abstract class Sale
|
|||
if ($rule->conditions) {
|
||||
$conditions = $rule->conditions;
|
||||
|
||||
while(gettype($conditions) == 'string') {
|
||||
$conditions = json_decode($conditions);
|
||||
}
|
||||
|
||||
$productIDs = $this->convertX->convertX($conditions);
|
||||
} else {
|
||||
$productIDs = '*';
|
||||
|
|
|
|||
|
|
@ -407,11 +407,11 @@ class CatalogRuleController extends Controller
|
|||
$catalogRule = $this->catalogRule->findOrFail($id);
|
||||
|
||||
if ($catalogRule->delete()) {
|
||||
session()->flash('success', trans('admin::app.promotion.delete-success'));
|
||||
session()->flash('success', trans('admin::app.promotion.status.delete-success'));
|
||||
|
||||
return response()->json(['message' => true], 200);
|
||||
} else {
|
||||
session()->flash('success', trans('admin::app.promotion.delete-failed'));
|
||||
session()->flash('error', trans('admin::app.promotion.status.delete-failed'));
|
||||
|
||||
return response()->json(['message' => false], 400);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@
|
|||
|
||||
created: function () {
|
||||
if (!this.index)
|
||||
this.active = true;
|
||||
this.active = false;
|
||||
|
||||
if (this.appliedFilterValues && this.appliedFilterValues.length) {
|
||||
this.appliedFilters = this.appliedFilterValues;
|
||||
|
|
|
|||
Loading…
Reference in New Issue