Why does it display an additional field with data and warnings after saving?
Posted: Thu Jul 25, 2024 2:37 pm
Hello. Why I have an additional field with data and warning and notice on opencart site. Please give me suggest what to do...
After saving data It show two block windows insted one + warnings:



Illegal string offset 'slider_id' , 'layout_id' , 'position' , 'status' , 'sort_order' in:
oc_layout.php:
Notice: Trying to access array offset on value of type null in:
If saving empty form - Warning: array_keys() expects parameter 1 to be array, string given in :
If put:
All warnings disappeare but do not showing data block windows.
If put [0] in:
Can add only one data window block and it is always disabled. And no possible change the settings.
Code:
After saving data It show two block windows insted one + warnings:



Code: Select all
<b>Warning</b>: Illegal string offset 'sort_order' in <b>system/config/revslider/admin/views/templates/oc_layout.php</b> on line <b>108</b>0
oc_layout.php:
Code: Select all
<?php if($allslide['id'] == $module_data['slider_id']){ ?>
<?php if($layout['layout_id'] == $module_data['layout_id']){ ?>
if($module_data['position'] == $getpos){ ?>
<?php if($module_data['status'] == 0){ ?>
<?php if($module_data['status'] == 1){ ?>
<td class="right"><input type="text" name="revslideropencart_module[<?php echo $module_row; ?>][sort_order]" value="<?php echo $module_data['sort_order'] ?>" size="3" />
Notice: Trying to access array offset on value of type null in:
Code: Select all
$k = preg_replace_callback('/\[[0-9]+/', function($match){return '';}, $k[0]);
If saving empty form - Warning: array_keys() expects parameter 1 to be array, string given in :
Code: Select all
$k = array_keys($data);
Code: Select all
$data = array();
If put [0] in:
Code: Select all
$newdata[$k][0] = $arr;
Code:
Code: Select all
case "add_slider_pos_val":
//$data = array();
$newdata = array();
if(!empty($data)){
$k = array_keys($data);
$k = preg_replace_callback('/\[[0-9]+/', function($match){return '';}, $k[0]);
if(is_array($data)) foreach($data as $key => $arr){
$newdata[$k][] = $arr;
}
$data = $newdata;
}
sdsconfig::editSetting('revslider',$data);
self::ajaxResponseSuccess(__("Slider Position Save SuccessFully", 'revslider'));
break;