fixes
This commit is contained in:
@@ -27,11 +27,11 @@ class Articles
|
|||||||
return $export;
|
return $export;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getOffersGroupedByNature($id, $sale_channel_id = false)
|
public static function getOffersGroupedByNature($id, $saleChannelId = false)
|
||||||
{
|
{
|
||||||
$article_ids = self::getSiblingsIds($id);
|
$articleIds = self::getSiblingsIds($id);
|
||||||
$article_ids[] = $id;
|
$articleIds[] = $id;
|
||||||
$offers = Offers::getOffersByArticles($article_ids, $sale_channel_id);
|
$offers = Offers::getOffersByArticles($articleIds, $saleChannelId);
|
||||||
foreach ($offers as $offer) {
|
foreach ($offers as $offer) {
|
||||||
$data[strtolower($offer->article_nature->name)][] = [
|
$data[strtolower($offer->article_nature->name)][] = [
|
||||||
'id' => $offer->id,
|
'id' => $offer->id,
|
||||||
@@ -90,10 +90,10 @@ class Articles
|
|||||||
return Article::orderBy('name', 'asc')->get();
|
return Article::orderBy('name', 'asc')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getArticleToSell($id, $sale_channel_id = false)
|
public static function getArticleToSell($id, $saleChannelId = false)
|
||||||
{
|
{
|
||||||
$data = self::getArticle($id);
|
$data = self::getArticle($id);
|
||||||
$data['offers'] = self::getOffersGroupedByNature($id, $sale_channel_id);
|
$data['offers'] = self::getOffersGroupedByNature($id, $saleChannelId);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@@ -220,20 +220,20 @@ class Articles
|
|||||||
|
|
||||||
public static function getArticlesWithOffers($options = false)
|
public static function getArticlesWithOffers($options = false)
|
||||||
{
|
{
|
||||||
$sale_channel_id = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
$saleChannelId = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||||
$model = self::getModelByOptions($options);
|
$model = self::getModelByOptions($options);
|
||||||
$data = $model->withAvailableOffers($sale_channel_id)->with([
|
$data = $model->withAvailableOffers($saleChannelId)->with([
|
||||||
'image',
|
'image',
|
||||||
'product',
|
'product',
|
||||||
'article_nature',
|
'article_nature',
|
||||||
'offers' => function ($query) use ($sale_channel_id) {
|
'offers' => function ($query) use ($saleChannelId) {
|
||||||
$query->bySaleChannel($sale_channel_id);
|
$query->bySaleChannel($saleChannelId);
|
||||||
},
|
},
|
||||||
'offers.tariff' => function ($query) use ($sale_channel_id) {
|
'offers.tariff' => function ($query) use ($saleChannelId) {
|
||||||
$query->bySaleChannel($sale_channel_id);
|
$query->bySaleChannel($saleChannelId);
|
||||||
},
|
},
|
||||||
'offers.tariff.price_lists' => function ($query) use ($sale_channel_id) {
|
'offers.tariff.price_lists' => function ($query) use ($saleChannelId) {
|
||||||
$query->where('sale_channel_id', $sale_channel_id);
|
$query->where('sale_channel_id', $saleChannelId);
|
||||||
},
|
},
|
||||||
'offers.tariff.price_lists.price_list_values',
|
'offers.tariff.price_lists.price_list_values',
|
||||||
'offers.variation.package',
|
'offers.variation.package',
|
||||||
@@ -255,9 +255,9 @@ class Articles
|
|||||||
|
|
||||||
public static function getArticleNaturesIdsWithOffers($options = false)
|
public static function getArticleNaturesIdsWithOffers($options = false)
|
||||||
{
|
{
|
||||||
$sale_channel_id = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
$saleChannelId = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||||
$model = self::getModelByOptions($options);
|
$model = self::getModelByOptions($options);
|
||||||
$data = $model->withAvailableOffers($sale_channel_id)->get()->pluck('article_nature_id')->unique();
|
$data = $model->withAvailableOffers($saleChannelId)->get()->pluck('article_nature_id')->unique();
|
||||||
|
|
||||||
return array_values($data->toArray());
|
return array_values($data->toArray());
|
||||||
}
|
}
|
||||||
@@ -276,9 +276,9 @@ class Articles
|
|||||||
|
|
||||||
public static function getProductTypesClassesWithOffers($options = false)
|
public static function getProductTypesClassesWithOffers($options = false)
|
||||||
{
|
{
|
||||||
$sale_channel_id = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
$saleChannelId = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||||
$model = self::getModelByOptions($options);
|
$model = self::getModelByOptions($options);
|
||||||
$data = $model->withAvailableOffers($sale_channel_id)->get()->pluck('product_type')->unique();
|
$data = $model->withAvailableOffers($saleChannelId)->get()->pluck('product_type')->unique();
|
||||||
|
|
||||||
return $data->toArray();
|
return $data->toArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
@include('boilerplate::load.tinymce')
|
@include('boilerplate::load.tinymce')
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
|
{!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreMerchandisePost', '#merchandise-form') !!}
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
initSelect2();
|
initSelect2();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{ Form::open(['route' => 'Admin.Shop.Producers.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Admin.Shop.Producers.store', 'id' => 'producer-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
<input type="hidden" name="id" id="id" value="{{ $producer['id'] ?? false }}">
|
<input type="hidden" name="id" id="id" value="{{ $producer['id'] ?? false }}">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -72,12 +72,14 @@
|
|||||||
@include('boilerplate::load.tinymce')
|
@include('boilerplate::load.tinymce')
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
|
{!! JsValidator::formRequest('App\Http\Requests\Admin\Shop\StoreProducerPost', '#producer-form') !!}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
initSelect2();
|
initSelect2();
|
||||||
initChevron();
|
initChevron();
|
||||||
initEditor();
|
initEditor();
|
||||||
initSaveForm();
|
initSaveForm('producer-form');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user