diff --git a/app/Http/Controllers/Admin/Shop/MerchandiseController.php b/app/Http/Controllers/Admin/Shop/MerchandiseController.php
index da838d06..0cda97b7 100644
--- a/app/Http/Controllers/Admin/Shop/MerchandiseController.php
+++ b/app/Http/Controllers/Admin/Shop/MerchandiseController.php
@@ -65,6 +65,11 @@ class MerchandiseController extends Controller
return Merchandises::deleteImage($id, $index);
}
+ public function getOptions()
+ {
+ return response()->json(['0' => ''] + Merchandises::getOptions());
+ }
+
public function exportExcel()
{
return Merchandises::exportExcel();
diff --git a/app/Repositories/Core/Categories.php b/app/Repositories/Core/Categories.php
index 409a6986..7c7dd25d 100644
--- a/app/Repositories/Core/Categories.php
+++ b/app/Repositories/Core/Categories.php
@@ -35,7 +35,6 @@ class Categories
public static function getCategoryTreeVisibles($sale_channel_id = false)
{
- // return self::getModel()->defaultOrder()->visible()->hasAvailableOffers($sale_channel_id)->get()->toTree();
return self::getModel()->defaultOrder()->hasAvailableOffersByCategoryParent($sale_channel_id)->visible()->get()->toTree();
}
diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php
index d45a3790..2bf9de8f 100644
--- a/app/Repositories/Shop/Articles.php
+++ b/app/Repositories/Shop/Articles.php
@@ -325,7 +325,7 @@ class Articles
case 'App\Models\Botanic\Variety':
$data['products'] = Varieties::getOptionsWithSpecie();
break;
- case 'App\Models\Botanic\Variety':
+ case 'App\Models\Botanic\Specie':
$data['products'] = Species::getOptions();
break;
case 'App\Models\Shop\Merchandise':
@@ -343,7 +343,6 @@ class Articles
'App\Models\Botanic\Specie' => 'Espèces',
'App\Models\Botanic\Variety' => 'Variétés',
'App\Models\Shop\Merchandise' => 'Marchandise',
- 'App\Models\Shop\Merchandise' => 'Autres',
];
return $data;
}
diff --git a/app/Repositories/Shop/Merchandises.php b/app/Repositories/Shop/Merchandises.php
index 70292022..8fed92af 100644
--- a/app/Repositories/Shop/Merchandises.php
+++ b/app/Repositories/Shop/Merchandises.php
@@ -53,6 +53,18 @@ class Merchandises
return $item->id;
}
+ public static function storeFull($data)
+ {
+ $images = $data['images'] ?? false;
+ $tags = $data['tags'] ?? false;
+ unset($data['images']);
+ unset($data['tags']);
+ $merchandise = self::store($data);
+ self::storeImages($merchandise, $images);
+ self::storeTags($merchandise, $tags);
+ return $merchandise;
+ }
+
public static function create($data)
{
return Merchandise::create($data);
diff --git a/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php b/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php
index ba059bdc..1a35f812 100644
--- a/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php
+++ b/resources/views/Admin/Shop/Articles/partials/characteristics.blade.php
@@ -3,11 +3,26 @@
{{ Form::label('model', 'Familles de produit') }}
- @include('components.form.select', ['name' => 'product_type', 'id_name' => 'product_type', 'list' => $models_options, 'value' => $article['product_type'] ?? null, 'class' => 'select2', 'with_empty' => '', 'required' => true])
+ @include('components.form.select', [
+ 'name' => 'product_type',
+ 'id_name' => 'product_type',
+ 'list' => $models_options,
+ 'value' => $article['product_type'] ?? null,
+ 'class' => 'select2',
+ 'with_empty' => '',
+ 'required' => true
+ ])
{{ Form::label('model_id', 'Produit') }}
- @include('components.form.select', ['name' => 'product_id', 'id_name' => 'product_id', 'list' => $products ?? [], 'value' => $article['product_id'] ?? null, 'class' => 'select2', 'with_empty' => ''])
+ @include('components.form.select', [
+ 'name' => 'product_id',
+ 'id_name' => 'product_id',
+ 'list' => $products ?? [],
+ 'value' => $article['product_id'] ?? null,
+ 'class' => 'select2',
+ 'with_empty' => ''
+ ])
{{ Form::label('ref', 'Référence') }}
@@ -22,14 +37,27 @@
{{ Form::label('article_nature_id', __('shop.article_natures.name')) }}
- @include('components.form.select', ['name' => 'article_nature_id', 'list' => $natures_options, 'value' => $article['article_nature_id'] ?? null, 'class' => 'select2', 'with_empty' => '', 'required' => true])
+ @include('components.form.select', [
+ 'name' => 'article_nature_id',
+ 'list' => $natures_options,
+ 'value' => $article['article_nature_id'] ?? null,
+ 'class' => 'select2',
+ 'with_empty' => '',
+ 'required' => true
+ ])
{{ Form::label('categories', __('shop.shelves.title')) }}
- @include('components.form.select', ['name' => 'categories[]', 'list' => $categories_options, 'values' => $article['categories'] ?? null, 'class' => 'select2', 'multiple' => true])
+ @include('components.form.select', [
+ 'name' => 'categories[]',
+ 'list' => $categories_options,
+ 'values' => $article['categories'] ?? null,
+ 'class' => 'select2',
+ 'multiple' => true
+ ])
{{ Form::label('visible', 'Visible') }}
@@ -58,7 +86,13 @@
{{ Form::label('tags', 'Tags') }}
- @include('components.form.selects.select-tree', ['name' => 'tags[]', 'list' => $tags_list, 'values' => $article['tags'] ?? null, 'class' => 'select2', 'multiple' => true])
+ @include('components.form.selects.select-tree', [
+ 'name' => 'tags[]',
+ 'list' => $tags_list,
+ 'values' => $article['tags'] ?? null,
+ 'class' => 'select2',
+ 'multiple' => true
+ ])
@@ -71,7 +105,12 @@
{{ Form::label('description', 'Description') }}
- @include('components.form.textarea', ['name' => 'description', 'value' => $article['description'] ?? null, 'class' => 'editor', 'required' => true])
+ @include('components.form.textarea', [
+ 'name' => 'description',
+ 'value' => $article['description'] ?? null,
+ 'class' => 'editor',
+ 'required' => true
+ ])
@@ -80,8 +119,17 @@
@include('Admin.Shop.Articles.partials.product.images')
- @include('components.uploader.widget', ['load_url' => route('Admin.Shop.Articles.getImages', ['id' => $article['id'] ?? false]), 'delete_url' => route('Admin.Shop.Articles.deleteImage'), 'title' => 'Photos', 'name' => 'images' ])
- @include('Admin.Core.Comments.partials.comments', ['model' => 'Shop.Article', 'model_id' => $article['id'] ?? false, 'comments' => $article['comments'] ?? false])
+ @include('components.uploader.widget', [
+ 'load_url' => route('Admin.Shop.Articles.getImages', ['id' => $article['id'] ?? false]),
+ 'delete_url' => route('Admin.Shop.Articles.deleteImage'),
+ 'title' => 'Photos',
+ 'name' => 'images'
+ ])
+ @include('Admin.Core.Comments.partials.comments', [
+ 'model' => 'Shop.Article',
+ 'model_id' => $article['id'] ?? false,
+ 'comments' => $article['comments'] ?? false
+ ])
@@ -109,9 +157,11 @@
var url = '{{ route('Admin.Botanic.Species.getSelect') }}';
break;
case 'App\\Models\\Botanic\\Variety':
- default:
var url = '{{ route('Admin.Botanic.Varieties.getSelect') }}';
break;
+ case 'App\\Models\\Shop\\Merchandise':
+ var url = '{{ route('Admin.Shop.Merchandises.getSelect') }}';
+ break;
}
loadProducts(url);
});
diff --git a/resources/views/Admin/Shop/Categories/form.blade.php b/resources/views/Admin/Shop/Categories/form.blade.php
index 63a45b84..d339e875 100644
--- a/resources/views/Admin/Shop/Categories/form.blade.php
+++ b/resources/views/Admin/Shop/Categories/form.blade.php
@@ -6,7 +6,7 @@
@include('components.form.input', ['name' => 'name', 'value' => $category['name'] ?? null, 'required' => true])
- {{ Form::label('parent', 'Rubrique parente') }}
+ {{ Form::label('parent', 'Rayon parent') }}
@include('components.form.select', [
'name' => 'parent_id',
'list' => $categories ?? [],
diff --git a/routes/Admin/Shop/Merchandises.php b/routes/Admin/Shop/Merchandises.php
index 63586ad7..9d34a4e7 100644
--- a/routes/Admin/Shop/Merchandises.php
+++ b/routes/Admin/Shop/Merchandises.php
@@ -8,7 +8,7 @@ Route::prefix('Merchandises')->name('Merchandises.')->group(function () {
Route::post('update', 'MerchandiseController@update')->name('update');
Route::post('store', 'MerchandiseController@store')->name('store');
Route::get('edit/{id}', 'MerchandiseController@edit')->name('edit');
- Route::post('getSelect', 'MerchandiseController@getOptionsWithSpecie')->name('getSelect');
+ Route::post('getSelect', 'MerchandiseController@getOptions')->name('getSelect');
Route::post('deleteImage', 'MerchandiseController@deleteImage')->name('deleteImage');
Route::any('getImages/{id?}/{can_edit?}', 'MerchandiseController@getImages')->name('getImages');