upsell product
This commit is contained in:
parent
c02d75774d
commit
ca39b84d0b
|
|
@ -1,6 +1,76 @@
|
|||
<accordian :title="'{{ __('admin::app.catalog.products.product-link') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
|
||||
<up-selling></up-selling>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
</accordian>
|
||||
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script type="text/x-template" id="up-selling-template">
|
||||
<div>
|
||||
|
||||
<div class="control-group">
|
||||
<input type="text" class="control" autocomplete="off" v-model="search_term">
|
||||
|
||||
<span class="filter-tag" style="text-transform: capitalize; margin-top: 10px; margin-right: 0px; justify-content: flex-start">
|
||||
<span class="wrapper" style="margin-left: 0px; margin-right: 10px;" v-for='(product, index) in this.product_name'>
|
||||
@{{ product.name }}
|
||||
<span class="icon cross-icon" @click="removeProduct(product.name)"></span>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<ul>
|
||||
<li v-for='(product, index) in products' style="padding: 10px; border-bottom: 1px solid; width: 70%; cursor: pointer;" @click="addProduct(product.name)">
|
||||
@{{ product.name }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
Vue.component('up-selling', {
|
||||
|
||||
template: '#up-selling-template',
|
||||
|
||||
data: () => ({
|
||||
allProduct : @json($allProducts),
|
||||
|
||||
search_term: '',
|
||||
|
||||
product_name: [],
|
||||
}),
|
||||
|
||||
computed: {
|
||||
products () {
|
||||
if (this.search_term.length >= 1) {
|
||||
return this.allProduct.filter(product => {
|
||||
return product.name.toLowerCase().includes(this.search_term.toLowerCase())
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
addProduct(productName) {
|
||||
this.product_name.push({'name': productName});
|
||||
this.search_term = '';
|
||||
},
|
||||
|
||||
removeProduct(productName) {
|
||||
for (var index in this.product_name) {
|
||||
if ( this.product_name[index].name == productName ) {
|
||||
let data = Array.prototype.slice.call(this.product_name, index);
|
||||
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
@foreach ($product->attribute_family->attribute_groups as $attributeGroup)
|
||||
|
||||
@if (count($attributeGroup->custom_attributes))
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.' . $attributeGroup->name . '.before', ['product' => $product]) !!}
|
||||
|
||||
<accordian :title="'{{ __($attributeGroup->name) }}'" :active="true">
|
||||
|
|
@ -154,24 +154,26 @@
|
|||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.images.before', ['product' => $product]) !!}
|
||||
|
||||
@include ('admin::catalog.products.accordians.images')
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.images.after', ['product' => $product]) !!}
|
||||
|
||||
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.before', ['product' => $product]) !!}
|
||||
|
||||
@include ('admin::catalog.products.accordians.categories')
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.after', ['product' => $product]) !!}
|
||||
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.variations.before', ['product' => $product]) !!}
|
||||
|
||||
@include ('admin::catalog.products.accordians.variations')
|
||||
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.variations.after', ['product' => $product]) !!}
|
||||
|
||||
@include ('admin::catalog.products.accordians.product-links')
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
</head>
|
||||
|
||||
<body @if (app()->getLocale() == 'ar') class="rtl" @endif style="scroll-behavior: smooth;">
|
||||
<body @if (app()->getLocale() == 'ar') @endif style="scroll-behavior: smooth;">
|
||||
{!! view_render_event('bagisto.admin.layout.body.before') !!}
|
||||
|
||||
<div id="app">
|
||||
|
|
|
|||
|
|
@ -173,7 +173,9 @@ class ProductController extends Controller
|
|||
|
||||
$inventorySources = $this->inventorySource->all();
|
||||
|
||||
return view($this->_config['view'], compact('product', 'categories', 'inventorySources'));
|
||||
$allProducts = $this->productGrid->all();
|
||||
|
||||
return view($this->_config['view'], compact('product', 'categories', 'inventorySources', 'allProducts'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue