Good day everybody, I can not push to work the botton ‘Save Position’ on an opencart site. Zero reactions. Another bottons on the page are working. What I do wrong?
Thanks in advance for helping.
Script image
Code for botton. File location – systemconfigrevslideradminviewstemplatesoc_layout.php
<?php
$layouts = sdsconfig::getLayouts();
$allslides = sdsconfig::getrevslide();
$store_id = (int)sdsconfig::get_current_store();
$pos_modules = sdsconfig::getval('revslideropencart_module',$store_id,'revslider');
$modules_data = unserialize($pos_modules);
$getpositions = array();
require_once(dirname(__FILE__) . '/position/position.php');
?>
<div class="title_line">
<div class="view_title">
<?php echo ControllerModulerevslideropencart::
$lang_var['Setup_Slider_Position']?>
</div>
</div>
<div class="postbox">
<form action="<?php //echo $action; ?>" enctype="multipart/form-data" id="sds_rev_mod_form" method="post">
<table id="module" class="list">
<thead>
<tr>
<td class="left"><?php echo ControllerModulerevslideropencart::
$lang_var['SLIDER']?></td>
<td class="left"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Layout']?></td>
<td class="left"><?php echo ControllerModulerevslideropencart::
$lang_var['Position']?></td>
<td class="left"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Status']?></td>
<td class="right"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Short_Order']?></td>
<td></td>
</tr>
</thead>
<?php $module_row = 0; ?>
<?php
if(isset($modules_data) && !empty($modules_data))
foreach ($modules_data as $module_data) { ?>
<tbody id="module-row<?php echo $module_row; ?>">
<tr>
<td class="left">
<select name="revslideropencart_module[<?php echo $module_row; ?>][slider_id]">
<?php foreach ($allslides as $allslide) { ?>
<?php if($allslide['id'] == $module_data['slider_id']){ ?>
<option value="<?php echo $allslide['id']; ?>" selected="selected"><?php echo addslashes($allslide['title']); ?></option>
<?php }else{ ?>
<option value="<?php echo $allslide['id']; ?>"><?php echo addslashes($allslide['title']); ?></option>
<?php } } ?>
</select>
</td>
<td class="left">
<select name="revslideropencart_module[<?php echo $module_row; ?>][layout_id]">
<?php foreach ($layouts as $layout) { ?>
<?php if($layout['layout_id'] == $module_data['layout_id']){ ?>
<option value="<?php echo $layout['layout_id']; ?>" selected="selected"><?php echo addslashes($layout['name']); ?></option>
<?php }else{ ?>
<option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>
<?php } } ?>
</select>
</td>
<td class="left"><select name="revslideropencart_module[<?php echo $module_row; ?>][position]">
<?php
if(isset($getpositions) && !empty($getpositions)){
foreach ($getpositions as $getpos => $getposition) {
if($module_data['position'] == $getpos){ ?>
<option value="<?php echo $getpos; ?>" selected="selected"><?php echo $getposition; ?></option>
<?php }else{ ?>
<option value="<?php echo $getpos; ?>"><?php echo $getposition; ?></option>
<?php }
}
}
?>
</select>
</td>
<td class="left"><select name="revslideropencart_module[<?php echo $module_row; ?>][status]">
<?php if($module_data['status'] == 0){ ?>
<option value="0" selected="selected"><?php echo ControllerModulerevslideropencart::
$lang_var['Disabled']?></option>
<?php }else{ ?>
<option value="0"><?php echo ControllerModulerevslideropencart::
$lang_var['Disabled']?></option>
<?php } ?>
<?php if($module_data['status'] == 1){ ?>
<option value="1" selected="selected"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Enabled']?></option>
<?php }else{ ?>
<option value="1"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Enabled']?></option>
<?php } ?>
</select>
</td>
<td class="right"><input type="text" name="revslideropencart_module[<?php echo $module_row; ?>][sort_order]" value="<?php echo $module_data['sort_order'] ?>" size="3" />
</td>
<td class="left"><a onclick="$('#module-row<?php echo $module_row; ?>').remove();" class="button-primary revred"><?php echo ControllerModulerevslideropencart::
$lang_var['Remove']?></a></td>
</tr>
</tbody>
<?php $module_row++; ?>
<?php } ?>
<tfoot>
<tr>
<td colspan="4"></td>
<td class="right"><a id="sds_rev_save_mod" href="javascript:void(0)" class="button-primary revblue"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Save_Position']?></a><span style="display:none;" class="loader_round" id="sds_rev_save_mod_loader">updating... </span><span id="sds_rev_save_mod_success" class="success_message"></span></td>
<td class="left"><a onclick="addModule();" class="button-primary revgreen"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Add_New']?></a></td>
</tr>
</tfoot>
</table>
</form>
</div>
<script type="text/javascript"><!--
var module_row = <?php echo $module_row; ?>;
function addModule() {
html = '<tbody id="module-row' + module_row + '">';
html += ' <tr>';
html += ' <td class="left"><select name="revslideropencart_module[' + module_row + '][slider_id]">';
<?php foreach ($allslides as $allslide) { ?>
html += ' <option value="<?php echo $allslide['id']; ?>"><?php echo addslashes($allslide['title']); ?></option>';
<?php } ?>
html += ' </select></td>';
html += ' <td class="left"><select name="revslideropencart_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
<?php } ?>
html += ' </select></td>';
html += ' <td class="left"><select name="revslideropencart_module[' + module_row + '][position]">';
<?php
if(isset($getpositions) && !empty($getpositions)){
foreach ($getpositions as $getpos => $getposition){
?>
html += '<option value="<?php echo $getpos; ?>"><?php echo $getposition; ?></option>';
<?php
}
}
?>
html += ' </select></td>';
html += ' <td class="left"><select name="revslideropencart_module[' + module_row + '][status]">';
html += ' <option value="1" selected="selected"><?php echo ControllerModulerevslideropencart::
$lang_var['sds_Enabled']?></option>';
html += ' <option value="0"><?php echo ControllerModulerevslideropencart::
$lang_var['Disabled']?></option>';
html += ' </select></td>';
html += ' <td class="right"><input type="text" name="revslideropencart_module[' + module_row + '][sort_order]" value="" size="3" /></td>';
html += ' <td class="left"><a onclick="$('#module-row' + module_row + '').remove();" class="button-primary revred"><?php echo ControllerModulerevslideropencart::
$lang_var['Remove']?></a></td>';
html += ' </tr>';
html += '</tbody>';
$('#module tfoot').before(html);
module_row++;
}
//--></script>
For showing script I connected it in file – systemconfigrevslideradminviewsslider-overview.php
<?php
if(!empty($arrSliders)):
require self::getPathTemplate("oc_layout");
endif;
?>
JS code. File systemconfigrevslideradminassetsjsrev_admin.js
//start save rev slider module position value
var initposvalSliderButton = function(ajaxAction){
jQuery("#sds_rev_save_mod").click(function(){
var data = UniteSettingsRev.getsdsformvalue("sds_rev_mod_form");
// data = $('form#sds_rev_mod_form').serializeArray();
if(ajaxAction == "add_slider_pos_val"){
UniteAdminRev.setAjaxLoaderID("sds_rev_save_mod_loader");
UniteAdminRev.setAjaxHideButtonID("sds_rev_save_mod");
UniteAdminRev.setSuccessMessageID("sds_rev_save_mod_success");
}
UniteAdminRev.ajaxRequest(ajaxAction ,data);
});
};
//end save rev slider module position value
// start
jQuery("#sds_rev_save_mod").click(function(){
initposvalSliderButton("add_slider_pos_val");
});
// end
PHP code. File – systemconfigrevsliderrevslider-admin.class.php
class RevSliderAdmin extends UniteBaseAdminClassRev
case "add_slider_pos_val":
$newdata = array();
if(!empty($data)){
$k = array_keys($data);
$k = preg_replace_callback('/[[0-9]+/', create_function('$match','return "";'), $k[0]);
foreach($data as $key => $arr){
$newdata[$k][] = $arr;
}
$data = $newdata;
}
sdsconfig::editSetting('revslider',$data);
self::ajaxResponseSuccess(__("Slider Position Save SuccessFully", 'revslider'));
break;
Ajax. File: systemconfigrevsliderajax.php
<?php
include_once('../../../admin/config.php');
include_once('../../../admin/index.php');
include_once('includes/globals.class.php');
include_once('revslider-loader.class.php');
include_once('revslider-admin.class.php');
$productAdmin = new RevSliderAdmin(DIR_CONFIG.'revslider');
$action = isset($_GET['action'])?$_GET['action']:isset($_POST['action'])?$_POST['action']:'';
switch($action){
case 'revsliderprestashop_show_image':
............
I did some trials but no result…