Updating the search params for next and prev links.
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 26 Apr 2017 19:55:33 +0000 (15:55 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 26 Apr 2017 19:55:33 +0000 (15:55 -0400)
Need to pass the manufacturers and the categorySearchMultiple arrays.

functions.php

index e4a8056..e154811 100644 (file)
@@ -81,6 +81,22 @@ add_filter('glm-member-db-front-search-query', function( $queryParts ) {
     $orderBy .= ", $originalOrderBy DESC ";
     return $orderBy;
 });
+add_filter('glm-member-db-fields-front-list-query-params', function( $query ){
+    $queryParams = array();
+    // Check for manufactures
+    if ( isset( $_REQUEST['manufacturers'] ) && is_array( $_REQUEST['manufacturers'] ) ) {
+        foreach ( $_REQUEST['manufacturers'] as $man ) {
+            $queryParams[] = "manufacturers[]={$man}";
+        }
+    }
+    // This needs to be done for now until it is in the main plugin.
+    if ( isset( $_REQUEST['categorySearchMultiple'] ) && is_array( $_REQUEST['categorySearchMultiple'] ) ) {
+        foreach ( $_REQUEST['categorySearchMultiple'] as $cat ) {
+            $queryParams[] = "categorySearchMultiple[]={$cat}";
+        }
+    }
+    return ( !empty( $queryParams ) ? $query . '&'.implode( '&', $queryParams): $query);
+},10, 1);
 add_filter('glm_blocks', function() {
     if(function_exists('fetch_all_glm_blocks')) {
         $blocks = fetch_all_glm_blocks();