mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-10 15:26:10 -06:00
Merge pull request #1242 from openclassify/4966
#4966 Options value editing - Text input
This commit is contained in:
commit
4e8199bdd2
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class VisiosoftModuleAdvsAddCustomOptionValue extends Migration
|
||||||
|
{
|
||||||
|
protected $stream = [
|
||||||
|
'slug' => 'option_configuration',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $fields = [
|
||||||
|
'custom_option' => [
|
||||||
|
'type' => 'anomaly.field_type.text',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $assignments = [
|
||||||
|
'custom_option'
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -396,4 +396,5 @@ return [
|
|||||||
'page' => 'Page',
|
'page' => 'Page',
|
||||||
'undefined_page' => 'Undefined Page',
|
'undefined_page' => 'Undefined Page',
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
|
'custom_field' => 'Custom Field',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -11,10 +11,10 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="">
|
<div class="flex-row">
|
||||||
{% set configurationForm = form('configuration_form').entry(adv.id).get() %}
|
{% set configurationForm = form('configuration_form').entry(adv.id).get() %}
|
||||||
|
|
||||||
{{ form_open({id: 'configurationForm',class: 'd-flex justify-content-between'})|raw }}
|
{{ form_open({id: 'configurationForm',class: 'd-flex justify-content-between flex-column flex-lg-row'})|raw }}
|
||||||
<input type="text" name="parent_adv_id" value="{{ adv.id }}" hidden>
|
<input type="text" name="parent_adv_id" value="{{ adv.id }}" hidden>
|
||||||
{{ configurationForm.fields|raw }}
|
{{ configurationForm.fields|raw }}
|
||||||
<button type="submit" class="btn btn-primary btn-configuration my-auto form-control w-auto">
|
<button type="submit" class="btn btn-primary btn-configuration my-auto form-control w-auto">
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class OptionConfigurationFormFields
|
|||||||
|
|
||||||
foreach ($options as $option)
|
foreach ($options as $option)
|
||||||
{
|
{
|
||||||
if($optionValue = $productoptionsValueRepository->getWithOptionsId([$option->id]))
|
if($productoptionsValueRepository->getWithOptionsId([$option->id]))
|
||||||
{
|
{
|
||||||
$options_fields['option-'.$option->getId()] = [
|
$options_fields['option-'.$option->getId()] = [
|
||||||
'type' => 'anomaly.field_type.select',
|
'type' => 'anomaly.field_type.select',
|
||||||
@ -35,14 +35,18 @@ class OptionConfigurationFormFields
|
|||||||
'attributes' => [
|
'attributes' => [
|
||||||
'data-id' => $option->getId(),
|
'data-id' => $option->getId(),
|
||||||
],
|
],
|
||||||
'config' => [
|
|
||||||
'options' => $optionValue->pluck('title','id')->all(),
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$options_fields['custom_option'] = [
|
||||||
|
'type' => 'anomaly.field_type.text',
|
||||||
|
'class' => 'form-control product-custom-fields',
|
||||||
|
'required' => false,
|
||||||
|
'label' => trans('visiosoft.module.advs::field.custom_field'),
|
||||||
|
];
|
||||||
|
|
||||||
$fields = array_merge($options_fields, ['price', 'currency', 'stock']);
|
$fields = array_merge($options_fields, ['price', 'currency', 'stock']);
|
||||||
|
|
||||||
$builder->setFields($fields);
|
$builder->setFields($fields);
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class OptionConfigurationFormHandler
|
|||||||
$option_json = array();
|
$option_json = array();
|
||||||
|
|
||||||
foreach ($parameters as $key => $parameter_value) {
|
foreach ($parameters as $key => $parameter_value) {
|
||||||
if (substr($key, 0, 7) === "option-") {
|
if (strpos($key, "option-") === 0) {
|
||||||
$option_id = substr($key, 7);
|
$option_id = substr($key, 7);
|
||||||
$option_json[$option_id] = $parameter_value;
|
$option_json[$option_id] = $parameter_value;
|
||||||
unset($parameters[$key]);
|
unset($parameters[$key]);
|
||||||
|
|||||||
@ -29,6 +29,8 @@ class OptionConfigurationModel extends AdvsOptionConfigurationEntryModel impleme
|
|||||||
|
|
||||||
$name = trim($option_group_value, ' ');
|
$name = trim($option_group_value, ' ');
|
||||||
|
|
||||||
|
$name .= ' ' . $this->custom_option;
|
||||||
|
|
||||||
return ($add_name) ? $adv->name . ' | ' . $name : $name;
|
return ($add_name) ? $adv->name . ' | ' . $name : $name;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -62,6 +62,8 @@ class OptionConfigurationRepository extends EntryRepository implements OptionCon
|
|||||||
$value_entry = $this->productOptionsValueRepository->find($value);
|
$value_entry = $this->productOptionsValueRepository->find($value);
|
||||||
$option_group_value .= " " . $value_entry->getName();
|
$option_group_value .= " " . $value_entry->getName();
|
||||||
}
|
}
|
||||||
|
$option_group_value .= " " . $product_configuration->custom_option;
|
||||||
|
|
||||||
$configurations[$product_configuration->getId()] = [
|
$configurations[$product_configuration->getId()] = [
|
||||||
'name' => $option_group_value,
|
'name' => $option_group_value,
|
||||||
'price' => $product_configuration->price,
|
'price' => $product_configuration->price,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user