diff --git a/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php b/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php
index 34a8a7beb..3f889fe02 100755
--- a/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php
+++ b/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php
@@ -131,7 +131,7 @@ class ConfigurationController extends Controller
* @param \Webkul\Admin\Http\Requests\ConfigurationForm $request
* @return \Illuminate\Http\Response
*/
- public function store(ConfigurationForm $request)
+ public function store()
{
Event::fire('core.configuration.save.after');
diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/field-types/multiselect.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/field-types/multiselect.blade.php
index 0c1be00d4..ecdd65779 100755
--- a/packages/Webkul/Admin/src/Resources/views/catalog/products/field-types/multiselect.blade.php
+++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/field-types/multiselect.blade.php
@@ -6,4 +6,4 @@
@endforeach
-
\ No newline at end of file
+
diff --git a/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php b/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php
index 221ec19b3..6e4228cae 100755
--- a/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php
+++ b/packages/Webkul/Admin/src/Resources/views/configuration/field-type.blade.php
@@ -16,6 +16,13 @@
$name = $item['key'] . '.' . $field['name'];
+ if (isset($field['repository'])) {
+ $temp = explode("@", $field['repository']);
+ $class = app(current($temp));
+ $method = end($temp);
+ $value = $class->$method();
+ $selectedOption = core()->getConfigData($name) ?? '';
+ }
?>
@@ -54,20 +61,39 @@
+
+ @elseif ($field['type'] == 'multiselect')
+
\ No newline at end of file
diff --git a/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php b/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php
index d4e214abd..767c666da 100755
--- a/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php
+++ b/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php
@@ -30,8 +30,7 @@ class CoreConfigRepository extends Repository
{
unset($data['_token']);
- if ($data['locale'] || $data['channel'])
- {
+ if ($data['locale'] || $data['channel']) {
$locale = $data['locale'];
$channel = $data['channel'];
unset($data['locale']);
@@ -39,6 +38,7 @@ class CoreConfigRepository extends Repository
}
foreach ($data as $method => $fieldData) {
+
$recurssiveData = $this->recuressiveArray($fieldData , $method);
foreach ($recurssiveData as $fieldName => $value) {
@@ -55,57 +55,51 @@ class CoreConfigRepository extends Repository
$locale_based = true;
}
- if (isset($field['channel_based']) && $field['channel_based'])
- {
- if (isset($field['locale_based']) && $field['locale_based'])
- {
+ if (getType($value) == 'array') {
+ $value = implode("," , $value);
+ }
+
+ if (isset($field['channel_based']) && $field['channel_based']) {
+ if (isset($field['locale_based']) && $field['locale_based']) {
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('locale_code', $locale)
->where('channel_code', $channel)
->get();
}
- else
- {
+ else {
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('channel_code', $channel)
->get();
}
- } else
- {
- if (isset($field['locale_based']) && $field['locale_based'])
- {
+ } else {
+ if (isset($field['locale_based']) && $field['locale_based']) {
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('locale_code', $locale)
->get();
- }
- else
- {
+ } else {
$coreConfigValue = $this->model
->where('code', $fieldName)
->get();
}
}
- if (!count($coreConfigValue) > 0)
- {
+ if (!count($coreConfigValue) > 0) {
$this->model->create([
'code' => $fieldName,
'value' => $value,
'locale_code' => $locale_based ? $locale : null,
'channel_code' => $channel_based ? $channel : null
]);
- } else
- {
+ } else {
$updataData['code'] = $fieldName;
$updataData['value'] = $value;
$updataData['locale_code'] = $locale_based ? $locale : null;
$updataData['channel_code'] = $channel_based ? $channel : null;
- foreach ($coreConfigValue as $coreConfig)
- {
+ foreach ($coreConfigValue as $coreConfig) {
$coreConfig->update($updataData);
}
}
@@ -120,15 +114,49 @@ class CoreConfigRepository extends Repository
*/
public function recuressiveArray(array $formData, $method) {
static $data =[];
+ static $recuressiveArrayData =[];
+
foreach ($formData as $form => $formValue) {
$value = $method . '.' . $form;
if (is_array($formValue)) {
- $this->recuressiveArray($formValue, $value);
- } else {
- $data[$value] = $formValue;
+ $dim = $this->countDim($formValue);
+ if ($dim > 1) {
+ $this->recuressiveArray($formValue, $value);
+ } else if($dim == 1) {
+ $data[$value] = $formValue;
+ }
}
}
- return $data;
+ foreach($data as $key => $value) {
+ $field = core()->getConfigField($key);
+
+ if ($field) {
+ $recuressiveArrayData[$key] = $value;
+ } else {
+ foreach($value as $key1 => $val) {
+ $recuressiveArrayData[$key . '.' . $key1] = $val;
+ }
+ }
+ }
+
+ return $recuressiveArrayData;
}
-}
\ No newline at end of file
+
+ /**
+ * return dimension of array
+ * @param array $array
+ * @return integer
+ */
+ public function countDim($array)
+ {
+ if (is_array(reset($array))) {
+ $return = $this->countDim(reset($array)) + 1;
+ }
+ else {
+ $return = 1;
+ }
+
+ return $return;
+ }
+}
diff --git a/packages/Webkul/Core/src/Repositories/CountryRepository.php b/packages/Webkul/Core/src/Repositories/CountryRepository.php
index 12c550c65..5e505f4a0 100755
--- a/packages/Webkul/Core/src/Repositories/CountryRepository.php
+++ b/packages/Webkul/Core/src/Repositories/CountryRepository.php
@@ -21,4 +21,13 @@ class CountryRepository extends Repository
{
return 'Webkul\Core\Models\Country';
}
+
+ /**
+ * Function to get country
+ *
+ * @return array
+ */
+ public function getAllCountry() {
+ return $this->model->get()->toArray();
+ }
}
\ No newline at end of file
diff --git a/packages/Webkul/Shipping/src/Config/system.php b/packages/Webkul/Shipping/src/Config/system.php
index 531ed6fef..c748c550d 100755
--- a/packages/Webkul/Shipping/src/Config/system.php
+++ b/packages/Webkul/Shipping/src/Config/system.php
@@ -109,7 +109,8 @@ return [
[
'name' => 'country',
'title' => 'Country',
- 'type' => 'text',
+ 'type' => 'select',
+ 'repository' => 'Webkul\Core\Repositories\CountryRepository@getAllCountry',
'validation' => 'required',
'channel_based' => true,
'locale_based' => false