From 4f19ba323fefb8cbb3103171f5caf600a0b983a5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 7 Jun 2019 20:15:50 +0200 Subject: [PATCH] #2825 --- app/Models/Product.php | 44 +++++++++++-------- app/Models/Producttype.php | 7 +-- .../base/inc/sidebar_content.blade.php | 6 +-- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/app/Models/Product.php b/app/Models/Product.php index e5384a9..7b2072b 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -3,7 +3,6 @@ namespace App\Models; use Cubist\Backpack\app\Magic\Models\CubistMagicModel; -use Cubist\Util\ObjectUtil; use Illuminate\Support\Str; class Product extends CubistMagicModel @@ -11,7 +10,7 @@ class Product extends CubistMagicModel protected $table = 'catalog_products'; protected $_options = ['name' => 'product', - 'singular'=>'produit', + 'singular' => 'produit', 'plural' => 'produits']; public function setFields() @@ -22,7 +21,7 @@ class Product extends CubistMagicModel 'label' => 'Nom du produit', 'type' => 'Text', 'column' => true, - 'tab' => 'General']); + 'tab' => 'Informations génerales']); $this->addField(['name' => 'reference', 'label' => 'SKU (référence)', @@ -30,14 +29,14 @@ class Product extends CubistMagicModel 'column' => true, 'unique' => true, 'translatable' => false, - 'tab' => 'General']); + 'tab' => 'Informations génerales']); $this->addField(['name' => 'product_type', 'label' => 'Type de produit', 'type' => 'SelectFromModel', 'model' => 'App\Models\ProductType', 'column' => true, - 'tab' => 'Specifications']); + 'tab' => 'Spécifications']); $specifications = Specification::all(); $types = ProductType::all(); @@ -50,11 +49,18 @@ class Product extends CubistMagicModel break; } } + foreach ($type->filters as $rel_specification) { + if ($spec->id == $rel_specification->id) { + $in[] = $type->id; + break; + } + } + $in = array_unique($in); } if (!count($in)) { continue; } - $params = ['tab' => 'Specifications', + $params = ['tab' => 'Spécifications', 'name' => 's_' . Str::snake($spec->name), 'label' => $spec->name, 'fake' => true, @@ -91,64 +97,64 @@ class Product extends CubistMagicModel $this->addField(['name' => 'slug', - 'type' => 'Slug (URL)', - 'label' => 'Slug', + 'type' => 'Slug', + 'label' => 'Slug (URL)', 'column' => true, - 'tab' => 'General']); + 'tab' => 'Informations génerales']); $this->addField(['name' => 'online', 'type' => 'Checkbox', 'label' => 'En ligne', 'column' => true, - 'tab' => 'General']); + 'tab' => 'Informations génerales']); $this->addField(['name' => 'public', 'type' => 'Checkbox', 'label' => 'Publique', 'column' => true, - 'tab' => 'General']); + 'tab' => 'Informations génerales']); $this->addField(['name' => 'supplier', 'label' => 'Fournisseur', 'type' => 'Text', 'translatable' => false, - 'tab' => 'Supplier']); + 'tab' => 'Informations fournisseur']); $this->addField(['name' => 'supplier_reference', 'label' => 'Référence fournisseur', 'type' => 'Text', 'translatable' => false, - 'tab' => 'Supplier']); + 'tab' => 'Informations fournisseur']); $this->addField(['name' => 'highlights', 'label' => 'Product highlights', 'type' => 'Markdown', - 'tab' => 'Texts']); + 'tab' => 'Textes']); $this->addField(['name' => 'descriptions', 'label' => 'Description', 'type' => 'Markdown', - 'tab' => 'Texts']); + 'tab' => 'Textes']); $this->addField(['name' => 'images', 'label' => 'Images du produit', 'type' => 'Images', - 'tab' => 'Media']); + 'tab' => 'Média']); $this->addField(['name' => 'dimensions', 'label' => 'Dimensions', 'type' => 'Markdown', - 'tab' => 'Texts']); + 'tab' => 'Textes']); $this->addField(['name' => 'options', 'label' => 'Options', 'type' => 'Markdown', - 'tab' => 'Texts']); + 'tab' => 'Textes']); $this->addField(['name' => 'accessories', 'label' => 'Accessoires', 'type' => 'Markdown', - 'tab' => 'Texts']); + 'tab' => 'Textes']); } } diff --git a/app/Models/Producttype.php b/app/Models/Producttype.php index 75adaf7..cc2f408 100644 --- a/app/Models/Producttype.php +++ b/app/Models/Producttype.php @@ -21,8 +21,9 @@ class ProductType extends CubistMagicModel 'type' => 'Text', 'column' => true]); - $this->addField(['name' => 'type', - 'label' => 'Product family', + $this->addField([ + 'name' => 'type', + 'label' => 'Famille de produits', 'type' => 'SelectFromArray', 'options' => ['captor' => 'Captor', 'system' => 'System'], 'column' => true, @@ -32,7 +33,7 @@ class ProductType extends CubistMagicModel $this->addField(['name' => 'featured_on_home', 'label' => 'Mis en avant sur la page d\'accueil', 'type' => 'Checkbox', - 'column' => true, + 'column' => false, 'default' => 1]); $this->addField(['name' => 'filters', diff --git a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php index b2902e8..d0a6724 100644 --- a/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php +++ b/resources/views/vendor/backpack/base/inc/sidebar_content.blade.php @@ -38,9 +38,9 @@
  • Spécifications
  • -
  • - Catégories -
  • +{{--
  • --}} +{{-- Catégories--}} +{{--
  • --}} @endcan @can('dev') -- 2.39.5