Advertisement
gsavix

filter for stock-manager plugin woocommerce 06-06-2020

Jun 6th, 2020
2,290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.20 KB | None | 0 0
  1.     <!-- woocommerce-stock-manager plugin                     -->
  2.     <!-- button for filter and button for clear filter        -->
  3.     <!-- must go to page stock-manager-log not stock-manager  -->
  4.     <!-- gsavix 06-06-2020 redir stock-manager-log -->  
  5.       <ul class="stock-manager-navigation">
  6.         <li><span class="navigation-filter-default activ"><?php _e('Filter','woocommerce-stock-manager'); ?></span></li>
  7.         <li><span class="navigation-filter-by-sku"><?php _e('Search by sku','woocommerce-stock-manager'); ?></span></li>
  8.         <li><span class="navigation-filter-by-title"><?php _e('Search by product name','woocommerce-stock-manager'); ?></span></li>
  9.         <li><span class="navigation-filter-display"><?php _e('Display setting','woocommerce-stock-manager'); ?></span></li>
  10.       </ul>
  11.      
  12.       <div class="clear"></div>
  13.      
  14.       <div class="stock-filter filter-block active-filter">
  15.         <form method="get" action="">
  16.          
  17.           <select name="order-by">
  18.             <option value=""><?php _e('Order by','woocommerce-stock-manager'); ?></option>
  19.             <option value="name-asc" <?php if( isset( $_GET['order-by'] ) && $_GET['order-by'] == 'name-asc' ){ echo 'selected="selected"'; } ?>><?php _e('Product name ASC','woocommerce-stock-manager'); ?></option>
  20.             <option value="name-desc" <?php if( isset( $_GET['order-by'] ) && $_GET['order-by'] == 'name-desc' ){ echo 'selected="selected"'; } ?>><?php _e('Product name DESC','woocommerce-stock-manager'); ?></option>
  21.             <option value="sku-asc" <?php if( isset( $_GET['order-by'] ) && $_GET['order-by'] == 'sku-asc' ){ echo 'selected="selected"'; } ?>><?php _e('SKU ASC','woocommerce-stock-manager'); ?></option>
  22.             <option value="sku-desc" <?php if( isset( $_GET['order-by'] ) && $_GET['order-by'] == 'sku-desc' ){ echo 'selected="selected"'; } ?>><?php _e('SKU DESC','woocommerce-stock-manager'); ?></option>
  23.           </select>
  24.  
  25.           <select name="product-type">
  26.             <option value="simple" <?php if(isset($_GET['product-type']) && $_GET['product-type'] == 'simple'){ echo 'selected="selected"'; } ?> ><?php _e('Simple products','woocommerce-stock-manager'); ?></option>
  27.             <option value="variable" <?php if(isset($_GET['product-type']) && $_GET['product-type'] == 'variable'){ echo 'selected="selected"'; } ?>><?php _e('Products with variation','woocommerce-stock-manager'); ?></option>
  28.           </select>
  29.          
  30.           <select name="product-category">
  31.             <option value="all"><?php _e('All categories','woocommerce-stock-manager'); ?></option>
  32.             <?php
  33.               if(isset($_GET['product-category']) && $_GET['product-category'] != 'all' ){
  34.                 echo $stock->products_categories($_GET['product-category']);
  35.               }else{
  36.                 echo $stock->products_categories();
  37.               }
  38.              
  39.             ?>
  40.           </select>
  41.        
  42.           <select name="manage-stock">
  43.             <option value=""><?php _e('Manage stock','woocommerce-stock-manager'); ?></option>
  44.             <option value="no" <?php if( isset( $_GET['manage-stock'] ) && $_GET['manage-stock'] == 'no' ){ echo 'selected="selected"'; } ?>><?php _e('No manage stock','woocommerce-stock-manager'); ?></option>
  45.             <option value="yes" <?php if( isset( $_GET['manage-stock'] ) && $_GET['manage-stock'] == 'yes' ){ echo 'selected="selected"'; } ?>><?php _e('Yes manage stock','woocommerce-stock-manager'); ?></option>
  46.           </select>
  47.      
  48.           <select name="stock-status">
  49.             <option value=""><?php _e('Stock status','woocommerce-stock-manager'); ?></option>
  50.             <option value="instock" <?php if( isset( $_GET['stock-status'] ) && $_GET['stock-status'] == 'instock' ){ echo 'selected="selected"'; } ?>><?php _e('In stock','woocommerce-stock-manager'); ?></option>
  51.             <option value="outofstock" <?php if( isset( $_GET['stock-status'] ) && $_GET['stock-status'] == 'outofstock' ){ echo 'selected="selected"'; } ?>><?php _e('Out of stock','woocommerce-stock-manager'); ?></option>
  52.           </select>
  53.      
  54.           <input type="hidden" name="page" value="stock-manager-log" /> <!-- gsavix 06-06-2020 redir stock-manager-log 2-2 -->
  55.           <input type="submit" name="show-stock-status" value="<?php _e('Show','woocommerce-stock-manager'); ?>" class="btn btn-info" />
  56.         </form>
  57.         <a href="<?php echo admin_url().'admin.php?page=stock-manager-log'; ?>" class="btn btn-danger"><?php _e('Clear filter','woocommerce-stock-manager'); ?></a> <!-- gsavix 06-06-2020 redir stock-manager-log 2-2 -->
  58.       </div>
  59.      
  60.       <div class="clear"></div>
  61.      
  62.       <div class="filter-by-sku filter-block">
  63.         <form method="get" action="">
  64.           <input type="text" name="sku" class="sku-seach-field" />
  65.           <input type="hidden" name="page" value="stock-manager" />
  66.           <input type="submit" name="show-sku-item" value="<?php _e('Search by sku','woocommerce-stock-manager'); ?>" class="btn btn-info" />
  67.         </form>
  68.       </div>
  69.      
  70.       <div class="clear"></div>
  71.  
  72.       <div class="filter-by-title filter-block">
  73.         <form method="get" action="">
  74.           <input type="text" name="product-title" class="title-seach-field" />
  75.           <input type="hidden" name="page" value="stock-manager" />
  76.           <input type="submit" name="show-sku-item" value="<?php _e('Search by product name','woocommerce-stock-manager'); ?>" class="btn btn-info" />
  77.         </form>
  78.       </div>
  79.      
  80.       <div class="clear"></div>
  81.  
  82.  
  83.       <div class="filter-display filter-block">
  84.         <form method="post" action="">
  85.         <?php
  86.           $display_option = get_option( 'wsm_display_option' );
  87.           if( empty( $display_option ) ){
  88.             $display_option = array(  
  89.                 'thumbnail'     => 'no',
  90.                 'price'         => 'display',
  91.                 'sales_price'   => 'no',
  92.                 'weight'        => 'display',
  93.                 'manage_stock'  => 'display',
  94.                 'stock_status'  => 'display',
  95.                 'backorders'    => 'display',
  96.                 'stock'         => 'display',
  97.                 'tax_status'    => 'no',
  98.                 'tax_class'     => 'no',
  99.                 'shipping_class'=> 'no'
  100.             );
  101.             update_option( 'wsm_display_option', $display_option );
  102.           }
  103.         ?>
  104.         <h2><?php _e('Hide or display cells','woocommerce-stock-manager'); ?></h2>
  105.           <table class="table-bordered">
  106.             <tr>
  107.               <td><?php _e('Thumbnail','woocommerce-stock-manager'); ?></td>
  108.               <td><input type="checkbox" name="thumbnail" <?php if( !empty( $display_option['thumbnail'] ) && $display_option['thumbnail'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  109.               <td><?php _e('Price','woocommerce-stock-manager'); ?></td>
  110.               <td><input type="checkbox" name="price" <?php if( !empty( $display_option['price'] ) && $display_option['price'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  111.               <td><?php _e('Sales price','woocommerce-stock-manager'); ?></td>
  112.               <td><input type="checkbox" name="sales_price" <?php if( !empty( $display_option['sales_price'] ) && $display_option['sales_price'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  113.               <td><?php _e('Weight','woocommerce-stock-manager'); ?></td>
  114.               <td><input type="checkbox" name="weight" <?php if( !empty( $display_option['weight'] ) && $display_option['weight'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  115.               <td><?php _e('Manage stock','woocommerce-stock-manager'); ?></td>
  116.               <td><input type="checkbox" name="manage_stock" <?php if( !empty( $display_option['manage_stock'] ) && $display_option['manage_stock'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  117.               <td><?php _e('Stock status','woocommerce-stock-manager'); ?></td>
  118.               <td><input type="checkbox" name="stock_status" <?php if( !empty( $display_option['stock_status'] ) && $display_option['stock_status'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  119.               <td><?php _e('Backorders','woocommerce-stock-manager'); ?></td>
  120.               <td><input type="checkbox" name="backorders" <?php if( !empty( $display_option['backorders'] ) && $display_option['backorders'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  121.               <td><?php _e('Stock','woocommerce-stock-manager'); ?></td>
  122.               <td><input type="checkbox" name="stock" <?php if( !empty( $display_option['stock'] ) && $display_option['stock'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  123.             </tr>  
  124.             <tr>
  125.               <td><?php _e('Tax status','woocommerce-stock-manager'); ?></td>
  126.               <td><input type="checkbox" name="tax_status" <?php if( !empty( $display_option['tax_status'] ) && $display_option['tax_status'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  127.               <td><?php _e('Tax class','woocommerce-stock-manager'); ?></td>
  128.               <td><input type="checkbox" name="tax_class" <?php if( !empty( $display_option['tax_class'] ) && $display_option['tax_class'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  129.               <td><?php _e('Shipping class','woocommerce-stock-manager'); ?></td>
  130.               <td><input type="checkbox" name="shipping_class" <?php if( !empty( $display_option['shipping_class'] ) && $display_option['shipping_class'] == 'display' ){ echo 'checked="checked"'; } ?> value="ok" /></td>
  131.               <td></td>
  132.               <td></td>
  133.               <td></td>
  134.               <td></td>
  135.               <td></td>
  136.               <td></td>
  137.               <td></td>
  138.               <td></td>
  139.               <td></td>
  140.               <td></td>
  141.             </tr>  
  142.           </table>
  143.          
  144.           <input type="hidden" name="page-filter-display" value="filter-display" />
  145.           <input type="submit" name="show-sku-item" value="<?php _e('Save setting','woocommerce-stock-manager'); ?>" class="btn btn-info" />
  146.         </form>
  147.       </div>
  148.      
  149.       <div class="clear"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement