checkbox type attribute
This commit is contained in:
parent
1ec288a182
commit
27d6e8894c
|
|
@ -445,7 +445,8 @@ return [
|
|||
'text-swatch' => 'Text Swatch',
|
||||
'swatch' => 'Swatch',
|
||||
'image' => 'Image',
|
||||
'file' => 'File'
|
||||
'file' => 'File',
|
||||
'checkbox' => 'Checkbox'
|
||||
],
|
||||
'families' => [
|
||||
'title' => 'Families',
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
<option value="date">{{ __('admin::app.catalog.attributes.date') }}</option>
|
||||
<option value="image">{{ __('admin::app.catalog.attributes.image') }}</option>
|
||||
<option value="file">{{ __('admin::app.catalog.attributes.file') }}</option>
|
||||
<option value="checkbox">{{ __('admin::app.catalog.attributes.checkbox') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@
|
|||
<option value="file" {{ $selectedOption == 'file' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.attributes.file') }}
|
||||
</option>
|
||||
<option value="file" {{ $selectedOption == 'checkbox' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.attributes.checkbox') }}
|
||||
</option>
|
||||
</select>
|
||||
<input type="hidden" name="type" value="{{ $attribute->type }}"/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<div class="control-group" style="margin-top: 5px;">
|
||||
|
||||
@foreach ($attribute->options as $option)
|
||||
<span class="checkbox" style="margin-top: 5px;">
|
||||
<input type="checkbox" name="{{ $attribute->code }}[]" value="{{ $option->id }}" {{ in_array($option->id, explode(',', $product[$attribute->code])) ? 'checked' : ''}}>
|
||||
</input>
|
||||
|
||||
<label class="checkbox-view"></label>
|
||||
{{ $option->admin_name }}
|
||||
</span>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
|
|
@ -32,7 +32,7 @@ class View extends AbstractProduct
|
|||
$attributeOption = $attributeOptionReposotory->find($value);
|
||||
if ($attributeOption)
|
||||
$value = $attributeOption->label ?? $attributeOption->admin_name;
|
||||
} else if ($attribute->type == 'multiselect') {
|
||||
} else if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') {
|
||||
$lables = [];
|
||||
|
||||
$attributeOptions = $attributeOptionReposotory->findWhereIn('id', explode(",", $value));
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class ProductFlat
|
|||
'date' => 'date',
|
||||
'file' => 'text',
|
||||
'image' => 'text',
|
||||
'checkbox' => 'text'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class ProductAttributeValue extends Model implements ProductAttributeValueContra
|
|||
'date' => 'date_value',
|
||||
'file' => 'text_value',
|
||||
'image' => 'text_value',
|
||||
'checkbox' => 'text_value',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class ProductRepository extends Repository
|
|||
if (! isset($data[$attribute->code]) || (in_array($attribute->type, ['date', 'datetime']) && ! $data[$attribute->code]))
|
||||
continue;
|
||||
|
||||
if ($attribute->type == 'multiselect') {
|
||||
if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') {
|
||||
$data[$attribute->code] = implode(",", $data[$attribute->code]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue