commit
5b6b6fbcb0
|
|
@ -104,7 +104,6 @@
|
|||
<label for="status" class="required">{{ __('admin::app.promotion.general-info.status') }}</label>
|
||||
|
||||
<select type="text" class="control" name="status" v-model="status" v-validate="'required'" data-vv-as=""{{ __('admin::app.promotion.general-info.status') }}"">
|
||||
<option disabled="disabled">{{ __('admin::app.promotion.select-attribtue', ['attribute' => 'Status']) }}</option>
|
||||
<option value="1">Yes</option>
|
||||
<option value="0">No</option>
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
<label for="status" class="required">{{ __('admin::app.promotion.general-info.status') }}</label>
|
||||
|
||||
<select type="text" class="control" name="status" v-model="status" v-validate="'required'" data-vv-as=""{{ __('admin::app.promotion.general-info.status') }}"">
|
||||
<option disabled="disabled">{{ __('admin::app.promotion.select-attribute', ['attribute' => 'Status']) }}</option>
|
||||
{{-- <option disabled="disabled">{{ __('admin::app.promotion.select-attribute', ['attribute' => 'Status']) }}</option> --}}
|
||||
<option value="1">{{ __('admin::app.promotion.yes') }}</option>
|
||||
<option value="0">{{ __('admin::app.promotion.no') }}</option>
|
||||
</select>
|
||||
|
|
@ -505,23 +505,33 @@
|
|||
mounted () {
|
||||
data = @json($cart_rule[3]);
|
||||
this.name = data.name;
|
||||
|
||||
this.description = data.description;
|
||||
|
||||
this.conditions_list = [];
|
||||
|
||||
this.channels = [];
|
||||
|
||||
for (i in data.channels) {
|
||||
this.channels.push(data.channels[i].channel_id);
|
||||
}
|
||||
|
||||
this.customer_groups = data.customer_groups;
|
||||
|
||||
for (i in data.customer_groups) {
|
||||
this.customer_groups.push(data.customer_groups[i].customer_group_id);
|
||||
}
|
||||
|
||||
this.ends_till = data.ends_till;
|
||||
|
||||
this.starts_from = data.starts_from;
|
||||
|
||||
this.priority = data.priority;
|
||||
|
||||
this.per_customer = data.per_customer;
|
||||
|
||||
this.status = data.status;
|
||||
|
||||
if (data.use_coupon == 0) {
|
||||
// this.auto_generation = null;
|
||||
this.use_coupon = 0;
|
||||
|
|
@ -539,24 +549,36 @@
|
|||
}
|
||||
|
||||
this.usage_limit = data.usage_limit;
|
||||
|
||||
this.is_guest = data.is_guest;
|
||||
|
||||
this.action_type = data.action_type;
|
||||
|
||||
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;
|
||||
|
||||
// this.disc_threshold = data.disc_threshold;
|
||||
|
||||
this.disc_quantity = data.disc_quantity;
|
||||
|
||||
this.end_other_rules = data.end_other_rules;
|
||||
|
||||
this.coupon_type = data.coupon_type;
|
||||
|
||||
this.free_shipping = data.free_shipping;
|
||||
|
||||
this.all_conditions = null;
|
||||
|
||||
if (data.conditions != null) {
|
||||
this.conditions_list = JSON.parse(JSON.parse(data.conditions));
|
||||
|
||||
this.match_criteria = this.conditions_list.pop().criteria;
|
||||
}
|
||||
|
||||
|
|
@ -565,6 +587,16 @@
|
|||
|
||||
this.attribute_values = JSON.parse(JSON.parse(data.actions).attribute_conditions).attributes;
|
||||
|
||||
if (this.category_values == null) {
|
||||
this.category_values = [];
|
||||
}
|
||||
|
||||
if (this.attribute_values == null) {
|
||||
this.attribute_values = [];
|
||||
}
|
||||
|
||||
console.log(this.category_values);
|
||||
|
||||
// creating options and has option param on the frontend
|
||||
for (i in this.attribute_values) {
|
||||
for (j in this.attribute_input) {
|
||||
|
|
@ -689,9 +721,7 @@
|
|||
delete this.attribute_values[i].options;
|
||||
}
|
||||
|
||||
if (this.category_values != null && this.category_values.length > 0) {
|
||||
this.all_attributes.categories = this.category_values;
|
||||
}
|
||||
this.all_attributes.categories = this.category_values;
|
||||
|
||||
this.all_attributes.attributes = this.attribute_values;
|
||||
|
||||
|
|
@ -700,10 +730,12 @@
|
|||
this.all_attributes = null;
|
||||
}
|
||||
|
||||
if (this.conditions_list.length != 0) {
|
||||
if (this.conditions_list != null) {
|
||||
this.conditions_list.push({'criteria': this.match_criteria});
|
||||
|
||||
this.all_conditions = JSON.stringify(this.conditions_list);
|
||||
|
||||
this.conditions_list.pop();
|
||||
}
|
||||
|
||||
this.$validator.validateAll().then(result => {
|
||||
|
|
|
|||
|
|
@ -725,6 +725,10 @@ abstract class Discount
|
|||
$result = true;
|
||||
|
||||
foreach ($conditions as $condition) {
|
||||
if (! isset($condition->attribute) || ! isset($condition->condition) || !isset($condition->value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($condition->attribute)) {
|
||||
$actual_value = ${$condition->attribute};
|
||||
|
||||
|
|
@ -851,9 +855,12 @@ abstract class Discount
|
|||
}
|
||||
|
||||
foreach ($conditions as $condition) {
|
||||
if (!isset($condition->attribute) || ! isset($condition->condition) || !isset($condition->value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($condition->attribute)) {
|
||||
$actual_value = ${$condition->attribute};
|
||||
|
||||
} else {
|
||||
$result = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ class CartRuleController extends Controller
|
|||
// create a cart rule
|
||||
$ruleCreated = $this->cartRule->create($data);
|
||||
|
||||
// can execute convert x here after when the rule is updated
|
||||
// can execute convertX here after when the rule is updated
|
||||
if (isset($attribute_conditions) && $attribute_conditions != "[]" && $attribute_conditions != "") {
|
||||
$this->convertX->convertX($ruleCreated->id, $attribute_conditions);
|
||||
}
|
||||
|
|
@ -420,7 +420,9 @@ class CartRuleController extends Controller
|
|||
|
||||
$data['disc_quantity'] = $data['disc_amount'];
|
||||
} else {
|
||||
if (! isset($attribute_conditions) || $attribute_conditions == "[]" || $attribute_conditions == "") {
|
||||
$attribute_conditions = json_decode($attribute_conditions);
|
||||
|
||||
if (! (isset($attribute_conditions->categories) && count($attribute_conditions->categories)) && ! (isset($attribute_conditions->attributes) && count($attribute_conditions->attributes))) {
|
||||
$data['uses_attribute_conditions'] = 0;
|
||||
|
||||
$data['actions'] = [
|
||||
|
|
@ -435,7 +437,7 @@ class CartRuleController extends Controller
|
|||
'action_type' => $data['action_type'],
|
||||
'disc_amount' => $data['disc_amount'],
|
||||
'disc_quantity' => $data['disc_quantity'],
|
||||
'attribute_conditions' => $attribute_conditions
|
||||
'attribute_conditions' => json_encode($attribute_conditions)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -498,7 +500,7 @@ class CartRuleController extends Controller
|
|||
// update cart rule
|
||||
$ruleUpdated = $this->cartRule->update($data, $id);
|
||||
|
||||
if (isset($attribute_conditions) && $attribute_conditions != "[]" && $attribute_conditions != "") {
|
||||
if (isset($attribute_conditions) && $data['uses_attribute_conditions']) {
|
||||
// can execute convert X here after when the rule is updated
|
||||
$this->convertX->convertX($ruleUpdated->id, $attribute_conditions);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue