Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: offers.php
<style> .page-title { padding: 2rem 0 !important;} .onoffswitch { position: relative; width: 56px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; } .notifyjs-corner{ top: 67px !important; left: 50% !important; } .onoffswitch-checkbox { display: none; } .onoffswitch-label { display: block; overflow: hidden; cursor: pointer; border: 2px solid #FFFFFF; border-radius: 20px; } .onoffswitch-inner { display: block; width: 200%; margin-left: -100%; transition: margin 0.3s ease-in 0s; } .onoffswitch-inner:before, .onoffswitch-inner:after { display: block; float: left; width: 50%; height: 22px; padding: 0; line-height: 22px; font-size: 12px; color: black; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; box-sizing: border-box; } .onoffswitch-inner:before { content: "ON"; padding-left: 0; background-color: #26a69a; color: #FFFFFF; } .onoffswitch-inner:after { content: "OFF"; padding-right: 6px; background-color: rgb(38 50 56); color: #FFFFFF; text-align: right; } .onoffswitch-switch { display: block; width: 12px; margin: 5px; background: #FFFFFF; position: absolute; top: 0; bottom: 0; right: 30px; border: 2px solid #FFFFFF; border-radius: 20px; transition: all 0.3s ease-in 0s; } table{ text-align: center; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { margin-left: 0; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { right: 0px; } </style> <!-- Page header --> <div class="page-header border-bottom-0 mt-3 service_top_links ml-2"></div> <div class="page-header border-bottom-0 services_header"> <div class="page-header-content header-elements-md-inline"> <div class="page-title d-flex"> <h4><a href="javascript:void(0)" class="BackButton-Link" onclick="goBack()"><i class="icon-arrow-left52 mr-2"></i></a> <?=$page_title?></h4> </div> <div class="actions"> <a href="<?php echo base_url($this->config->item('apanel_name')."/ecomm/offers/add").get_query_string();?>">+ <?php echo $this->lang->line('BE_LBL_963'); ?></a> </div> </div> </div> <!-- /page header --> <!-- Content area --> <div class="content pt-0"> <div class="card"> <div class="card-header header-elements-inline services_search"> <h5 class="card-title cardCollapse"><?php echo $this->lang->line('CUST_CH_BTN'); ?></h5> <div class="header-elements"> <div class="list-icons"> <a class="list-icons-item rotate-180" data-action="collapse"></a> </div> </div> </div> <div class="card-body CollapsedCardBody" style="display: block;"> <div class="row"> <div class="col-xl-12"> <form method="post" action="<?= base_url($this->config->item('apanel_name').'/ecomm/offers').get_query_string(); ?>"> <div class="form-group row mb-0"> <div class="col-md-6 col-12"> <div class="search_list"> <div class="search_block"> <label class="control-label" style="float: left;"><?php echo $this->lang->line('BE_LBL_966'); ?></label> <input class="form-control input-sm" placeholder="Search..." aria-controls="DataTables_Table_0" type="search" name="search_value" value="<?= $this->input->post('search_value'); ?>"> </div> </div> </div> <div class="mt-3 col-md-6 col-12 text-right"> <button type="submit" name="data_search" class="btn ThemeColorButton"><?php echo $this->lang->line('CUST_CH_BTN'); ?></button> </div> </div> </form> </div> </div> </div> </div> <div class="card"> <div class="row"> <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12"> <div class="card-body"> <div class="form-group row"> <div class="col-lg-12"> <div class="table-responsive"> <table class="table table-striped table-bordered table-advance table-hover" width="100%"> <thead> <tr> <th>#</th> <th><?php echo $this->lang->line('CUST_CH_105'); ?></th> <th><?php echo $this->lang->line('BE_LBL_969'); ?></th> <th><?php echo $this->lang->line('BE_CODE_5'); ?></th> <th><?php echo $this->lang->line('CUST_LBL_301'); ?></th> </tr> </thead> <tbody> <?php $i = 0; foreach ($offers_list as $key => $row) { ?> <tr class="item_holder"> <td align="center"><?= ($i+1) ?></td> <td align="center"> <a href="<?php echo base_url($this->config->item('apanel_name')."/ecomm/offers/edit/".$row->id).get_query_string();?>" title="<?= $row->offer_title; ?>"> <?php if(strlen($row->offer_title) > 20){ echo substr(stripslashes($row->offer_title), 0, 20).'...'; }else{ echo $row->offer_title; } ?> </a> </td> <td align="center"> <?php if($row->offer_percentage){?> <?php echo $row->offer_percentage?>% OFF <?php }else{?> <?php echo getusercurrency() .' '. $row->offer_fixed_amount?> Fix Amount <?php }?> </td> <td align="center"> <div class="onoffswitch"> <input type="checkbox" id="enable_disable_check_<?=$i?>" data-id="<?=$row->id?>" name="onoffswitch" class="onoffswitch-checkbox cbx hidden enable_disable" <?php if($row->status==1){ echo 'checked';} ?>> <label for="enable_disable_check_<?=$i?>" class="lbl onoffswitch-label"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div> </td> <td align="center"> <a style="margin-right: 5px" href="" data-toggle="tooltip" data-tooltip="View" class="offer_detail"> <i class="fa fa-eye" style="font-size: 20px"></i> </a> <a style="margin-right: 5px;" href="<?php echo base_url($this->config->item('apanel_name')."/ecomm/offers/edit/".$row->id).get_query_string(); ?>" data-toggle="tooltip" data-tooltip="Edit"> <i class="fa fa-edit" style="font-size: 20px;"></i> </a> <a href="" data-toggle="tooltip" class="btn_delete_a" data-id="<?=$row->id?>" data-tooltip="Delete"> <i class="fa fa-trash-o" style="font-size: 20px;"></i> </a> <div class="detailsHolder" style="display: none;"> <div class="modal-body"> <div class="row"> <div style="text-align: justify;" class="w-100"> <h4>Offer Description</h4> <hr/> <?=$row->offer_desc?> </div> </div> <hr/> <div class="row"> <div class="col-md-4"> <p style="font-weight: normal !important;"><strong>Discount: </strong><?=$row->offer_percentage?>%</p> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger btn_delete" data-dismiss="modal">Close</button> </div> </div> </td> </tr> <?php $i++; } ?> <?php if(empty($offers_list)) { ?> <tr> <td colspan="99" align="center"><?php echo $this->lang->line('BE_LBL_968'); ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <?php if(!empty($links)){ ?> <div class="form-group row"> <div class="col-12"> <div class="pagination_item_block"> <nav> <?php echo $links; ?> </nav> </div> </div> </div> <?php } ?> <div class="form-group row"> <div class="col-md-12"> <form method="post" action="<?= base_url($this->config->item('apanel_name').'/ecomm/offers').get_query_string(); ?>"> <div class="form-group"> <?php if(isset($product)) { echo '<input type="hidden" class="old_offer_id" value="'.$product[0]->offer_id.'">'; } else{ echo '<input type="hidden" class="old_offer_id" value="0">'; } ?> <div class="row"> <label class="col-md-12 control-label mt-3"> <strong><?php echo $this->lang->line('BE_LBL_970'); ?> *</strong> </label> </div> <div class="row"> <div class="col-md-6"> <div class="cat-dropdown"> <select name="category_id" class="select2"> <option value="0"><?php echo $this->lang->line('BE_LBL_971'); ?></option> <?php foreach ($categories_dropdown as $key => $value) { ?> <option class="level_0" <?php echo $value['id'] == $this->input->get('category_id') ? 'selected=""' : ''; ?> value="<?=$value['id']?>"><?= $value['category_name']; ?></option> <?php echo get_sub_cats_options($value); ?> <?php } ?> </select> </div> </div> <div class="col-md-6"> <select name="offer_id" id="offer_id" class="select2"> <option value="0" selected>--<?php echo $this->lang->line('BE_LBL_972'); ?>--</option> <?php foreach ($offer_list as $key => $value) { ?> <option value="<?=$value->id?>" <?php if(isset($product) && $product[0]->offer_id==$value->id){ echo 'selected';} ?>><?=$value->offer_title?></option> <?php } ?> </select> </div> <div class="col-md-12"> <div class="add_btn_primary " style="margin-top: 10px"> <a href="#" class="btn btn-primary active_offer reload_page"><?php echo $this->lang->line('BE_LBL_973'); ?></a> </div> </div> </div> </div> <div class="checkbox" style="margin-top: 10px;left: 37px;/*position: absolute;*/"> <input type="checkbox" id="checkall"> <label for="checkall"> <?php echo $this->lang->line('CUST_CH_137'); ?> </label> <br/> </div> <div class="form-group" style="display: none"> <label class="col-md-3 control-label">Selling Price *</label> <div class="col-md-6"> <input type="text" name="selling_price" id="selling_price" readonly="<?php if(isset($product)){ echo $product[0]->selling_price;}else{ echo '0';} ?>" value="" class="form-control" placeholder=""> </div> </div> <div class="form-group saving_info" style="display: none;"> <label class="col-md-9 col-md-offset-3 control-label" style="padding-top: 0px"> <strong style="color: green">1 offer is applied !</strong> </label> <label class="col-md-3 control-label">You Save * </label> <div class="col-md-3"> <div class="input-group"> <input type="text" name="you_save" id="you_save_price" readonly="readonly" value="" class="form-control" placeholder="Saving"> <span class="input-group-addon">USD</span> </div> </div> <div class="col-md-3"> <div class="input-group"> <input type="text" name="you_save_per" id="you_save_per" readonly="readonly" value="" class="form-control" placeholder="Saving in Percentage"> <span class="input-group-addon"><i class="fa fa-percent"></i></span> </div> </div> </div> </form> </div> </div> <div class="form-group row"> <div class="col-md-12"> <div class="table-responsive"> <table class="datatable table table-striped table-bordered table-hover" id="table_products"> <thead> <tr> <th></th> <th><?php echo $this->lang->line('CUST_CH_67'); ?></th> <th><?php echo $this->lang->line('BE_LBL_974'); ?></th> <th><?php echo $this->lang->line('BE_LBL_975'); ?></th> <th><?php echo $this->lang->line('CUST_LBL_253'); ?></th> <th><?php echo $this->lang->line('BE_LBL_976'); ?></th> </tr> </thead> <?php if($this->session->flashdata('response_msg')) { $message = $this->session->flashdata('response_msg'); ?> <div class="<?=$message['class']?> alert-dismissible" role="alert"> <?=$message['message']?> </div> <?php } ?> <?php if(!empty($products)){ ?> <?php $i=0; foreach ($products as $key => $row) { ?> <tr class="item_holder"> <td id="check_box"> <div> <div class="checkbox"> <input type="checkbox" name="post_ids[]" id="checkbox<?php echo $i;?>" value="<?php echo $row->id; ?>" class="post_ids"> <label for="checkbox<?php echo $i;?>"> </label> </div> </div> </td> <td id="category"> <h2 style="font-size: 16px"> <?php if(strlen($row->category_name) > 23){ echo substr(stripslashes($row->category_name), 0, 23).'...'; }else{ echo $row->category_name; } ?> </h2> </td> <?php $curr_date=date('d-m-Y'); ?> <td id="title"> <h2> <a href="<?php echo base_url($this->config->item('apanel_name')."/ecomm/products/edit/".$row->id."/".$row->category_id);?>" style="text-shadow: 1px 1px 1px #000;font-size: 16px" title="<?=$row->product_title?>"> <?php if(strlen($row->product_title) > 33){ echo substr(stripslashes($row->product_title), 0, 33).'...'; }else{ echo $row->product_title; } ?> </a> </h2> </td> <td id="description"> <p style="margin-bottom: 0px;font-size: 14px"> <?php echo $row->product_sku; ?> </p> </td> <td id="brand"> <p style="margin-bottom: 0px;font-size: 14px"> <?php echo get_brand_info($row->brand_id, 'brand_name')?get_brand_info($row->brand_id, 'brand_name'):'-';?> </p> </td> <td id="offer"> <p style="margin-bottom: 0px;font-size: 14px"> <?php if($row->offer_id != 0) { echo getOfferName($row->offer_id, 'offer_title'); }else { echo '-'; };?> </p> </td> </tr> <?php $i++; } ?> <?php }else{ ?> <tr> <td align="center" colspan="99"><?php echo $this->lang->line('BE_LBL_968'); ?></td> </tr> <?php } ?> </table> </div> </div> </div> <div class="form-group row"> <div class="col-12"> <div class="add_btn_primary " style="float: none; margin-bottom: 20px text-align: center;"> <a href="#" class="btn btn-primary deactive_offer reload_page"><?php echo $this->lang->line('BE_LBL_977'); ?></a> </div> </div> </div> </div> </div> </div> </div> </div> <div id="offer_detail" class="modal fade" role="dialog" style=""> <div class="modal-dialog"> <div class="modal-content"> </div> </div> </div> <script type="text/javascript"> $(".offer_detail").click(function(e){ e.preventDefault(); $("#offer_detail").modal("show"); $("#offer_detail .modal-content").html($(this).siblings(".detailsHolder").html()); }); $(".btn_delete_a").click(function(e){ e.preventDefault(); var _id=$(this).data("id"); e.preventDefault(); var href = '<?= base_url($this->config->item('apanel_name').'/ecomm/offers/delete'); ?>/'+_id; var btn = this; swal({ title: "Are you sure ?", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger btn_edit", cancelButtonClass: "btn-warning btn_edit", confirmButtonText: "Yes", cancelButtonText: "No", closeOnConfirm: false, closeOnCancel: false, showLoaderOnConfirm: true }, function(isConfirm) { if (isConfirm) { $.ajax({ type:'GET', url:href, success:function(res){ if($.trim(res)=='success'){ swal({ title: "Deleted", text: "Your coupon has been deleted", type: "success" },function() { $(btn).closest('.item_holder').fadeOut("200"); }); } else { alert("Error"); } } }); }else{ swal.close(); } }); }); $(".enable_disable").on("click",function(e){ var href; var btn = this; var _id=$(this).data("id"); var _for=$(this).prop("checked"); if(_for==false){ href = '<?= base_url($this->config->item('apanel_name').'/ecomm/offers/deactive'); ?>/'+_id; }else{ href = '<?= base_url($this->config->item('apanel_name').'/ecomm/offers/active'); ?>/'+_id; } $.ajax({ type:'GET', url:href, success:function(res){ $('.notifyjs-corner').empty(); $.notify( res, { position:"top center",className: 'success' } ); } }); }); function formatResult(node) { var level = 0; if(node.element !== undefined){ level = (node.element.className); if(level.trim() !== ''){ level = (parseInt(level.match(/\d+/)[0])); } } var $result = $('<span style="padding-left:' + (20 * level) + 'px;">' + node.text + '</span>'); return $result; }; $(document).ready(function(){ $("select[name='category_id']").change(function(){ var data = $(this).val(); var url = '<?php echo base_url($this->config->item('apanel_name').'/ecomm/offers').get_query_string(); ?>'; if(data > 0) { var search_value = $('[name="search_value"]').val(); url = '<?php echo base_url($this->config->item('apanel_name').'/ecomm/offers').get_query_string(); ?>&category_id=' + data + (search_value.trim() ? '&search_value='+search_value : ''); } window.location.href = url; }); $("select[name='category_id']").select2({ placeholder: 'Select a category', width: "300px", templateResult: formatResult, }); $('#offer_id').select2(); }) $('.active_offer').click(function(e){ e.preventDefault(); var offer_id = $('#offer_id').val(); var product_ids = []; $('.post_ids:checkbox:checked').each(function(i){ product_ids[i] = $(this).val(); }); if (product_ids != ''){ $.ajax({ url : '<?php echo base_url($this->config->item('apanel_name')."/ecomm/offers/activate")?>', type : 'post', data : { 'offer_id' : offer_id, 'product_ids' : product_ids }, success : function(res){ $('.notifyjs-corner').empty(); $.notify( res, { position:"top center",className: 'success' } ); window.location.reload(); } }); }else { $('.notifyjs-corner').empty(); $.notify( 'Please select atleast one product', { position:"top center",className: 'error' } ); } }); $('.deactive_offer').click(function(e){ e.preventDefault(); var offer_id = $('#offer_id').val(); var product_ids = []; $('.post_ids:checkbox:checked').each(function(i){ product_ids[i] = $(this).val(); }); if (product_ids != ''){ $.ajax({ url : '<?php echo base_url($this->config->item('apanel_name')."/ecomm/offers/deactivate")?>', type : 'post', data : { 'offer_id' : offer_id, 'product_ids' : product_ids }, success : function(res){ $('.notifyjs-corner').empty(); $.notify( res, { position:"top center",className: 'success' } ); window.location.reload(); } }); }else { $('.notifyjs-corner').empty(); $.notify( 'Please select atleast one product', { position:"top center",className: 'error' } ); } }); $('#checkall').click(function () { if($('#checkall').is(':checked')){ $('.post_ids:checkbox').each(function(i){ $(this).prop('checked',true); }); }else{ $('.post_ids:checkbox').each(function(i){ $(this).prop('checked',false); }); } }); $('.post_ids').click(function () { var product_ids = []; var total = $('.post_ids:checkbox').length; $('.post_ids:checkbox:checked').each(function(i){ product_ids[i] = $(this).val(); }); if(product_ids.length < total){ $('#checkall').prop('checked', false); } if(total == product_ids.length){ $('#checkall').prop('checked', true); } }) </script>