WC_Predictive_Search_Shortcodes

WC Predictive Search Hook Filter.

Defined (1)

The class is defined in the following location(s).

/classes/class-wc-predictive-search-shortcodes.php  
  1. class WC_Predictive_Search_Shortcodes  
  2.  
  3. public static function parse_shortcode_search_result($attributes) { 
  4. // Don't show content for shortcode on Dashboard, still support for admin ajax 
  5. if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) return; 
  6.  
  7. $search_results = ''; 
  8. global $woocommerce_search_page_id; 
  9. global $wp_query; 
  10.  
  11. $search_keyword = ''; 
  12. if (isset($wp_query->query_vars['keyword'])) $search_keyword = stripslashes( strip_tags( urldecode( $wp_query->query_vars['keyword'] ) ) ); 
  13. else if (isset($_REQUEST['rs']) && trim($_REQUEST['rs']) != '') $search_keyword = stripslashes( strip_tags( $_REQUEST['rs'] ) ); 
  14.  
  15. $search_results .= WC_Predictive_Search_Shortcodes::display_search(); 
  16. return $search_results;  
  17.  
  18. public static function display_search() { 
  19. global $wp_query; 
  20. global $wpdb; 
  21. global $woocommerce_search_page_id; 
  22.  
  23. $items_search_default = WC_Predictive_Search_Widgets::get_items_search(); 
  24. $search_keyword = ''; 
  25. $search_in = 'product'; 
  26. $search_other = ''; 
  27. $cat_in = 'all'; 
  28.  
  29. if (isset($wp_query->query_vars['keyword'])) $search_keyword = stripslashes( strip_tags( urldecode( $wp_query->query_vars['keyword'] ) ) ); 
  30. else if (isset($_REQUEST['rs']) && trim($_REQUEST['rs']) != '') $search_keyword = stripslashes( strip_tags( $_REQUEST['rs'] ) ); 
  31.  
  32. if (isset($wp_query->query_vars['cat-in'])) $cat_in = stripslashes( strip_tags( urldecode( $wp_query->query_vars['cat-in'] ) ) ); 
  33. else if (isset($_REQUEST['cat_in']) && trim($_REQUEST['cat_in']) != '') $cat_in = stripslashes( strip_tags( $_REQUEST['cat_in'] ) ); 
  34.  
  35. if (isset($wp_query->query_vars['search-in'])) $search_in = stripslashes( strip_tags( urldecode( $wp_query->query_vars['search-in'] ) ) ); 
  36. else if (isset($_REQUEST['search_in']) && trim($_REQUEST['search_in']) != '') $search_in = stripslashes( strip_tags( $_REQUEST['search_in'] ) ); 
  37.  
  38. if (isset($wp_query->query_vars['search-other'])) $search_other = stripslashes( strip_tags( urldecode( $wp_query->query_vars['search-other'] ) ) ); 
  39. else if (isset($_REQUEST['search_other']) && trim($_REQUEST['search_other']) != '') $search_other = stripslashes( strip_tags( $_REQUEST['search_other'] ) ); 
  40.  
  41. $permalink_structure = get_option( 'permalink_structure' ); 
  42.  
  43. if ( $search_keyword != '' && $search_in != '' ) { 
  44.  
  45. global $ps_search_list, $ps_current_search_in; 
  46.  
  47. ob_start(); 
  48. ?> 
  49. <div id="ps_results_container" class="woocommerce"> 
  50. <style type="text/css"> 
  51. .rs_result_heading{margin:15px 0;} 
  52. .ajax-wait{display: none; position: absolute; width: 100%; height: 100%; top: 0px; left: 0px; background:url("<?php echo WOOPS_IMAGES_URL; ?>/ajax-loader.gif") no-repeat center center #EDEFF4; opacity: 1;text-align:center;} 
  53. .ajax-wait img{margin-top:14px;} 
  54. .p_data, .r_data, .q_data{display:none;} 
  55. .rs_date{color:#777;font-size:small;} 
  56. .rs_result_row{width:100%;float:left;margin:0px 0 10px;padding :0px 0 10px; 6px;border-bottom:1px solid #c2c2c2;} 
  57. .rs_result_row:hover{opacity:1;} 
  58. .rs_rs_avatar{width:64px;margin-right:10px;overflow: hidden;float:left; text-align:center;} 
  59. .rs_rs_avatar img{width:100%;height:auto; padding:0 !important; margin:0 !important; border: none !important;} 
  60. .rs_rs_name{margin-left:0px;} 
  61. .rs_content{margin-left:74px;} 
  62. .ps_more_result{display:none;width:240px;text-align:center;position:fixed;bottom:50%;left:50%;margin-left:-125px;background-color: black;opacity: .75;color: white;padding: 10px;border-radius:10px;-webkit-border-radius: 10px;-moz-border-radius: 10px} 
  63. .rs_rs_price .oldprice{text-decoration:line-through; font-size:80%;} 
  64. .rs_result_others { margin-bottom:20px; } 
  65. .rs_result_others_heading {font-weight:bold;}  
  66. .ps_navigation_activated { font-weight:bold;} 
  67. </style> 
  68.  
  69. <?php 
  70. $tmp_args = array( 
  71. 'items_search_default' => $items_search_default,  
  72. 'ps_search_list' => $ps_search_list,  
  73. 'ps_current_search_in' => $ps_current_search_in,  
  74. 'permalink_structure' => $permalink_structure,  
  75. 'woocommerce_search_page_id' => $woocommerce_search_page_id,  
  76. 'search_keyword' => $search_keyword,  
  77. 'cat_in' => $cat_in,  
  78. 'search_in' => $search_in,  
  79. 'search_other' => $search_other,  
  80. ); 
  81. wc_ps_get_results_header_tpl( $tmp_args ); 
  82. ?> 
  83.  
  84. <div id="ps_list_items_container"> 
  85. </div> 
  86. <div style="clear:both"></div> 
  87. <div class="ps_more_result" id="ps_more_result_popup"> 
  88. <img src="<?php echo WOOPS_IMAGES_URL; ?>/more-results-loader.gif" /> 
  89. <div><em><?php wc_ps_ict_t_e( 'Loading Text', __('Loading More Results...', 'woocommerce-predictive-search' ) ); ?></em></div> 
  90. </div> 
  91. <div class="ps_more_result" id="ps_no_more_result_popup"><em><?php wc_ps_ict_t_e( 'No More Result Text', __('No More Results to Show', 'woocommerce-predictive-search' ) ); ?></em></div> 
  92. <div class="ps_more_result" id="ps_fetching_result_popup"> 
  93. <img src="<?php echo WOOPS_IMAGES_URL; ?>/more-results-loader.gif" /> 
  94. <div><em><?php wc_ps_ict_t_e( 'Fetching Text', __('Fetching search results...', 'woocommerce-predictive-search' ) ); ?></em></div> 
  95. </div> 
  96. <div class="ps_more_result" id="ps_no_result_popup"><em><?php wc_ps_ict_t_e( 'No Fetching Result Text', __('No Results to Show', 'woocommerce-predictive-search' ) ); ?></em></div> 
  97. <div id="ps_footer_container"> 
  98. </div> 
  99. </div> 
  100. <script type="text/javascript"> 
  101. (function($) { 
  102. $(function() { 
  103. wc_ps_app.start(); 
  104. }); 
  105. })(jQuery); 
  106. </script> 
  107. <?php 
  108.  
  109. $output = ob_get_clean(); 
  110.  
  111. return $output; 
  112. }