Closed bobitza closed 2 years ago
Well, you are right, the documentation is not clear about that, I'll update that.
You should define taxes and discounts in a service provider's boot method.
I did the voucher page in vue and everything work, inclusive update, show, but on the create new page i got errors... The POST method from form go with 0 data inputs values, request payload is empty: [] This is Create.vue:
<template>
<data-form class="row" :action="action" :data="voucher" #default="form">
<div class="col-12 col-lg-7 col-xl-8 form__body">
<card :title="__('General')">
<data-form-input
type="text"
name="name"
:label="__('Name')"
v-model="form.data.name"
></data-form-input>
<data-form-input
type="text"
name="unit"
:label="__('Value (unit-200 or percent-30)')"
v-model="form.data.unit"
></data-form-input>
<data-form-input
type="number"
name="uses"
:label="__('Number of uses')"
v-model="form.data.uses"
></data-form-input>
<data-form-input
handler="editor"
name="description"
:label="__('Description')"
v-model="form.data.description"
></data-form-input>
</card>
</div>
<div class="col-12 col-lg-5 col-xl-4 mt-5 mt-lg-0 form__sidebar">
<div class="sticky-helper">
<card :title="__('Actions')">
<div class="form-group d-flex justify-content-between mb-0">
<button type="submit" class="btn btn-primary" :disabled="form.busy">
{{ __('Save') }}
</button>
</div>
</card>
</div>
</div>
</data-form>
</template>
<script>
export default {
props: {
voucher: {
type: Object,
required: true,
},
},
mounted() {
this.$parent.icon = 'coupon';
this.$parent.title = this.__('Create Voucher');
},
computed: {
action() {
return '/bazar/vouchers';
},
},
}
</script>
So the problem was in Database, after i put variable $attributes with default values, only after that work and send the values i typed in inputs to payload
protected $attributes = [
'uses' => 0,
'code' => '',
'value' => 0,
'name' => '',
'description' => null,
'type' => 'fix'
];
How can i use Discount per all items ? to see price with discount when i have global discount
Description:
I don't understand from docs how to use discount...Where to put to work and call for example
And then what to call function or what to apply this on my cart items or total cart ?