Advertisement
Guest User

template product_list.php

a guest
Sep 8th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.31 KB | None | 0 0
  1. <?php echo $header; ?><?php echo $column_left; ?>
  2. <div id="content">
  3.   <div class="page-header">
  4.     <div class="container-fluid">
  5.       <div class="pull-right"><a href="<?php echo $add; ?>" data-toggle="tooltip" title="<?php echo $button_add; ?>" class="btn btn-primary"><i class="fa fa-plus"></i></a>
  6.         <button type="submit" form="form-product" formaction="<?php echo $copy; ?>" data-toggle="tooltip" title="<?php echo $button_copy; ?>" class="btn btn-default"><i class="fa fa-copy"></i></button>
  7.         <button type="button" data-toggle="tooltip" title="<?php echo $button_delete; ?>" class="btn btn-danger" onclick="confirm('<?php echo $text_confirm; ?>') ? $('#form-product').submit() : false;"><i class="fa fa-trash-o"></i></button>
  8.       </div>
  9.       <h1><?php echo $heading_title; ?></h1>
  10.       <ul class="breadcrumb">
  11.         <?php foreach ($breadcrumbs as $breadcrumb) { ?>
  12.         <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
  13.         <?php } ?>
  14.       </ul>
  15.     </div>
  16.   </div>
  17.   <div class="container-fluid">
  18.     <?php if ($error_warning) { ?>
  19.     <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
  20.       <button type="button" class="close" data-dismiss="alert">&times;</button>
  21.     </div>
  22.     <?php } ?>
  23.     <?php if ($success) { ?>
  24.     <div class="alert alert-success"><i class="fa fa-check-circle"></i> <?php echo $success; ?>
  25.       <button type="button" class="close" data-dismiss="alert">&times;</button>
  26.     </div>
  27.     <?php } ?>
  28.     <div class="panel panel-default">
  29.       <div class="panel-heading">
  30.         <h3 class="panel-title"><i class="fa fa-list"></i> <?php echo $text_list; ?></h3>
  31.       </div>
  32.       <div class="panel-body">
  33.         <div class="well">
  34.           <div class="row">
  35.             <div class="col-sm-4">
  36.               <div class="form-group">
  37.                 <label class="control-label" for="input-name"><?php echo $entry_name; ?></label>
  38.                 <input type="text" name="filter_name" value="<?php echo $filter_name; ?>" placeholder="<?php echo $entry_name; ?>" id="input-name" class="form-control" />
  39.               </div>
  40.               <div class="form-group">
  41.                 <label class="control-label" for="input-model"><?php echo $entry_model; ?></label>
  42.                 <input type="text" name="filter_model" value="<?php echo $filter_model; ?>" placeholder="<?php echo $entry_model; ?>" id="input-model" class="form-control" />
  43.               </div>
  44.             </div>
  45.             <div class="col-sm-4">
  46.               <div class="form-group">
  47.                 <label class="control-label" for="input-price"><?php echo $entry_price; ?></label>
  48.                 <input type="text" name="filter_price" value="<?php echo $filter_price; ?>" placeholder="<?php echo $entry_price; ?>" id="input-price" class="form-control" />
  49.               </div>
  50.               <div class="form-group">
  51.                 <label class="control-label" for="input-quantity"><?php echo $entry_quantity; ?></label>
  52.                 <input type="text" name="filter_quantity" value="<?php echo $filter_quantity; ?>" placeholder="<?php echo $entry_quantity; ?>" id="input-quantity" class="form-control" />
  53.               </div>
  54.             </div>
  55.             <div class="col-sm-4">
  56.               <div class="form-group">
  57.                 <label class="control-label" for="input-status"><?php echo $entry_status; ?></label>
  58.                 <select name="filter_status" id="input-status" class="form-control">
  59.                   <option value="*"></option>
  60.                   <?php if ($filter_status) { ?>
  61.                   <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
  62.                   <?php } else { ?>
  63.                   <option value="1"><?php echo $text_enabled; ?></option>
  64.                   <?php } ?>
  65.                   <?php if (!$filter_status && !is_null($filter_status)) { ?>
  66.                   <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
  67.                   <?php } else { ?>
  68.                   <option value="0"><?php echo $text_disabled; ?></option>
  69.                   <?php } ?>
  70.                 </select>
  71.               </div>
  72.               <div class="form-group">
  73.                 <label class="control-label" for="input-image"><?php echo $entry_image; ?></label>
  74.                 <select name="filter_image" id="input-image" class="form-control">
  75.                   <option value="*"></option>
  76.                   <?php if ($filter_image) { ?>
  77.                   <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
  78.                   <?php } else { ?>
  79.                   <option value="1"><?php echo $text_enabled; ?></option>
  80.                   <?php } ?>
  81.                   <?php if (!$filter_image && !is_null($filter_image)) { ?>
  82.                   <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
  83.                   <?php } else { ?>
  84.                   <option value="0"><?php echo $text_disabled; ?></option>
  85.                   <?php } ?>
  86.                 </select>
  87.               </div>
  88.               <button type="button" id="button-filter" class="btn btn-primary pull-right"><i class="fa fa-filter"></i> <?php echo $button_filter; ?></button>
  89.             </div>
  90.           </div>
  91.         </div>
  92.         <form action="<?php echo $delete; ?>" method="post" enctype="multipart/form-data" id="form-product">
  93.           <div class="table-responsive">
  94.             <table class="table table-bordered table-hover">
  95.               <thead>
  96.                 <tr>
  97.                   <td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
  98.                   <td class="text-center"><?php echo $column_image; ?></td>
  99.                   <td class="text-left"><?php if ($sort == 'pd.name') { ?>
  100.                     <a href="<?php echo $sort_name; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_name; ?></a>
  101.                     <?php } else { ?>
  102.                     <a href="<?php echo $sort_name; ?>"><?php echo $column_name; ?></a>
  103.                     <?php } ?></td>
  104.                   <td class="text-left"><?php if ($sort == 'p.model') { ?>
  105.                     <a href="<?php echo $sort_model; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_model; ?></a>
  106.                     <?php } else { ?>
  107.                     <a href="<?php echo $sort_model; ?>"><?php echo $column_model; ?></a>
  108.                     <?php } ?></td>
  109.                   <td class="text-right"><?php if ($sort == 'p.price') { ?>
  110.                     <a href="<?php echo $sort_price; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_price; ?></a>
  111.                     <?php } else { ?>
  112.                     <a href="<?php echo $sort_price; ?>"><?php echo $column_price; ?></a>
  113.                     <?php } ?></td>
  114.                   <td class="text-right"><?php if ($sort == 'p.quantity') { ?>
  115.                     <a href="<?php echo $sort_quantity; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_quantity; ?></a>
  116.                     <?php } else { ?>
  117.                     <a href="<?php echo $sort_quantity; ?>"><?php echo $column_quantity; ?></a>
  118.                     <?php } ?></td>
  119.                   <td class="text-left"><?php if ($sort == 'p.status') { ?>
  120.                     <a href="<?php echo $sort_status; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_status; ?></a>
  121.                     <?php } else { ?>
  122.                     <a href="<?php echo $sort_status; ?>"><?php echo $column_status; ?></a>
  123.                     <?php } ?></td>
  124.                     <td class="text-left"><?php if ($sort == 'p.date_modified') { ?>
  125.                     <a href="<?php echo $sort_date_modified; ?>" class="<?php echo strtolower($order); ?>"><?php echo '111'; ?></a>
  126.                     <?php } else { ?>
  127.                     <a href="<?php echo $sort_date_modified; ?>">Посл.изменение</a>
  128.                     <?php } ?></td>
  129.                   <td class="text-right"><?php echo $column_action; ?></td>
  130.                 </tr>
  131.               </thead>
  132.               <tbody>
  133.                 <?php if ($products) { ?>
  134.                 <?php foreach ($products as $product) { ?>
  135.                 <tr>
  136.                   <td class="text-center"><?php if (in_array($product['product_id'], $selected)) { ?>
  137.                     <input type="checkbox" name="selected[]" value="<?php echo $product['product_id']; ?>" checked="checked" />
  138.                     <?php } else { ?>
  139.                     <input type="checkbox" name="selected[]" value="<?php echo $product['product_id']; ?>" />
  140.                     <?php } ?></td>
  141.                   <td class="text-center"><?php if ($product['image']) { ?>
  142.                     <img src="<?php echo $product['image']; ?>" alt="<?php echo $product['name']; ?>" class="img-thumbnail" />
  143.                     <?php } else { ?>
  144.                     <span class="img-thumbnail list"><i class="fa fa-camera fa-2x"></i></span>
  145.                     <?php } ?></td>
  146.                   <td class="text-left"><?php echo $product['name']; ?></td>
  147.                   <td class="text-left"><?php echo $product['model']; ?></td>
  148.                   <td class="text-right"><?php if ($product['special']) { ?>
  149.                     <span style="text-decoration: line-through;"><?php echo $product['price']; ?></span><br/>
  150.                     <div class="text-danger"><?php echo $product['special']; ?></div>
  151.                     <?php } else { ?>
  152.                     <?php echo $product['price']; ?>
  153.                     <?php } ?></td>
  154.                   <td class="text-right"><?php if ($product['quantity'] <= 0) { ?>
  155.                     <span class="label label-warning"><?php echo $product['quantity']; ?></span>
  156.                     <?php } elseif ($product['quantity'] <= 5) { ?>
  157.                     <span class="label label-danger"><?php echo $product['quantity']; ?></span>
  158.                     <?php } else { ?>
  159.                     <span class="label label-success"><?php echo $product['quantity']; ?></span>
  160.                     <?php } ?></td>
  161.                   <td class="text-left"><?php echo $product['status']; ?></td>
  162.                    <td class="text-left"><?php echo $product['date_modified']; ?></td>
  163.                   <td class="text-right"><a href="<?php echo $product['edit']; ?>" data-toggle="tooltip" title="<?php echo $button_edit; ?>" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
  164.                 </tr>
  165.                 <?php } ?>
  166.                 <?php } else { ?>
  167.                 <tr>
  168.                   <td class="text-center" colspan="8"><?php echo $text_no_results; ?></td>
  169.                 </tr>
  170.                 <?php } ?>
  171.               </tbody>
  172.             </table>
  173.           </div>
  174.         </form>
  175.         <div class="row">
  176.           <div class="col-sm-6 text-left"><?php echo $pagination; ?></div>
  177.           <div class="col-sm-6 text-right"><?php echo $results; ?></div>
  178.         </div>
  179.       </div>
  180.     </div>
  181.   </div>
  182.   <script type="text/javascript"><!--
  183. $('#button-filter').on('click', function() {
  184.     var url = 'index.php?route=catalog/product&token=<?php echo $token; ?>';
  185.  
  186.     var filter_name = $('input[name=\'filter_name\']').val();
  187.  
  188.     if (filter_name) {
  189.         url += '&filter_name=' + encodeURIComponent(filter_name);
  190.     }
  191.  
  192.     var filter_model = $('input[name=\'filter_model\']').val();
  193.  
  194.     if (filter_model) {
  195.         url += '&filter_model=' + encodeURIComponent(filter_model);
  196.     }
  197.  
  198.     var filter_price = $('input[name=\'filter_price\']').val();
  199.  
  200.     if (filter_price) {
  201.         url += '&filter_price=' + encodeURIComponent(filter_price);
  202.     }
  203.  
  204.     var filter_quantity = $('input[name=\'filter_quantity\']').val();
  205.  
  206.     if (filter_quantity) {
  207.         url += '&filter_quantity=' + encodeURIComponent(filter_quantity);
  208.     }
  209.  
  210.     var filter_status = $('select[name=\'filter_status\']').val();
  211.  
  212.     if (filter_status != '*') {
  213.         url += '&filter_status=' + encodeURIComponent(filter_status);
  214.     }
  215.  
  216.   var filter_image = $('select[name=\'filter_image\']').val();
  217.  
  218.   if (filter_image != '*') {
  219.     url += '&filter_image=' + encodeURIComponent(filter_image);
  220.   }
  221.  
  222.     location = url;
  223. });
  224. //--></script>
  225.   <script type="text/javascript"><!--
  226. $('input[name=\'filter_name\']').autocomplete({
  227.     'source': function(request, response) {
  228.         $.ajax({
  229.             url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_name=' +  encodeURIComponent(request),
  230.             dataType: 'json',
  231.             success: function(json) {
  232.                 response($.map(json, function(item) {
  233.                     return {
  234.                         label: item['name'],
  235.                         value: item['product_id']
  236.                     }
  237.                 }));
  238.             }
  239.         });
  240.     },
  241.     'select': function(item) {
  242.         $('input[name=\'filter_name\']').val(item['label']);
  243.     }
  244. });
  245.  
  246. $('input[name=\'filter_model\']').autocomplete({
  247.     'source': function(request, response) {
  248.         $.ajax({
  249.             url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_model=' +  encodeURIComponent(request),
  250.             dataType: 'json',
  251.             success: function(json) {
  252.                 response($.map(json, function(item) {
  253.                     return {
  254.                         label: item['model'],
  255.                         value: item['product_id']
  256.                     }
  257.                 }));
  258.             }
  259.         });
  260.     },
  261.     'select': function(item) {
  262.         $('input[name=\'filter_model\']').val(item['label']);
  263.     }
  264. });
  265. //--></script></div>
  266. <?php echo $footer; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement