I have warning and notice on opencart site. Please give me suggest what to do…
Warning: array_keys() expects parameter 1 to be array, string given in :
<code>$k = array_keys($data);
</code>
<code>$k = array_keys($data);
</code>
$k = array_keys($data);
Notice: Trying to access array offset on value of type null in:
<code>$k = preg_replace_callback('/[[0-9]+/', function($match){return '';}, $k[0]);
</code>
<code>$k = preg_replace_callback('/[[0-9]+/', function($match){return '';}, $k[0]);
</code>
$k = preg_replace_callback('/[[0-9]+/', function($match){return '';}, $k[0]);
After saving data It show two block windows insted one + warnings:
image 01 image 02 image 03
Illegal string offset ‘slider_id’ , ‘layout_id’ , ‘position’ , ‘status’ , ‘sort_order’ in:
<code><?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" />
</code>
<code><?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" />
</code>
<?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" />
Code:
<code>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;
</code>
<code>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;
</code>
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;
If put:
<code>$data = array();
</code>
<code>$data = array();
</code>
$data = array();
All warnings disappeare but do not showing data block windows.
If put [0] in:
<code>$newdata[$k][0] = $arr;
</code>
<code>$newdata[$k][0] = $arr;
</code>
$newdata[$k][0] = $arr;
Can add only one data window block and it is always disabled. And no possible change the settings.