Answers.Body: <p>Try using this (completely untested):</p>
  
  <pre><code>{% if paginate.prevUrl %}
      &lt;a href="{{ paginate.prevUrl }}?{{ craft.request.getQueryStringWithoutPath() }}"&gt;Previous Page&lt;/a&gt;
  {% endif %}
  
  {% if paginate.nextUrl %}
      &lt;a href="{{ paginate.nextUrl }}?{{ craft.request.getQueryStringWithoutPath() }}"&gt;Next Page&lt;/a&gt;
  {% endif %}
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>The above will only work once Craft 2.3 comes out.</p>
  
  <p>In the meantime, it's a bit sketchy, but you can open up <code>craft/app/variables/HttpRequestVariable.php</code> and add this method:</p>
  
  <pre><code>public function getQueryStringWithoutPath()
  {
      return craft()-&gt;request-&gt;getQueryStringWithoutPath();
  }
  </code></pre>
  
  <p>And it should work.  But please be aware that file could be overwritten by a 2.2 build release at any point during an auto-update and your template would break.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T21:28:54.820Z
Answers.Text: Thanks but that didn't work. Throws this error: 'Method "getQueryStringWithoutPath" for object "Craft\HttpRequestVariable" does not exist'
Answers.UserDisplayName: Kyle
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T21:30:44.280Z
Answers.Text: Gah... just realized that got added to the unreleased Craft 2.3.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T21:35:58.833Z
Answers.Text: Updated answer.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T22:38:59.067Z
Answers.Text: Hacking the core? That's some back-alley advice right there Brad. ;)
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T22:40:18.827Z
Answers.Text: HACK THE PLANET
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T22:41:16.147Z
Answers.Text: TBH, the OP can (and should) put that method into a custom plugin. Should work just as well, right?
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T22:42:12.237Z
Answers.Text: Good point... will be much safer for updating.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-15T21:26:29.380Z
Answers.LastActivityDate: 2014-09-15T21:35:42.083Z
Answers.LastEditDate: 2014-09-15T21:35:42.083Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm looking to paginate and array with multiple filters.</p>
  
  <p>The current url would be: <code>www.example.com/search?filter=shorts&amp;type=leather&amp;brand=sams</code></p>
  
  <p>Clicking on the next next link returns: <code>www.example.com/search/p2</code> effectively removing the search params.</p>
  
  <p>Is there a way to paginate the full url without removing the search params?</p>
  
  <pre><code>{% paginate test.limit(4) as entries %}
      {% for entry in entriesOnPage %}
          &lt;article&gt;
              &lt;h1&gt;{{ entry.title }}&lt;/h1&gt;
              {{ entry.body }}
          &lt;/article&gt;
      {% endfor %}
  
      {% if paginate.prevUrl %}
          &lt;a href="{{ paginate.prevUrl }}"&gt;Previous Page&lt;/a&gt;
      {% endif %}
  
      {% if paginate.nextUrl %}
          &lt;a href="{{ paginate.nextUrl }}"&gt;Next Page&lt;/a&gt;
      {% endif %}
  {% endpaginate %}
  </code></pre>
  
Tags: <search><pagination><params>
Title: Paginate an array with multiple filters
ThreadText: # Paginate an array with multiple filters
  
  (Asked by: username_0 on 2014-09-15)
  
  I'm looking to paginate and array with multiple filters.
  
  The current url would be: `www.example.com/search?filter=shorts&type=leather&brand=sams`
  
  Clicking on the next next link returns: `www.example.com/search/p2` effectively removing the search params.
  
  Is there a way to paginate the full url without removing the search params?
  
  ```
  {% paginate test.limit(4) as entries %}
      {% for entry in entriesOnPage %}
          <article>
              <h1>{{ entry.title }}</h1>
              {{ entry.body }}
          </article>
      {% endfor %}
  
      {% if paginate.prevUrl %}
          <a href="{{ paginate.prevUrl }}">Previous Page</a>
      {% endif %}
  
      {% if paginate.nextUrl %}
          <a href="{{ paginate.nextUrl }}">Next Page</a>
      {% endif %}
  {% endpaginate %}
  
  ```
  
  **Tags:** search, pagination, params
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-09-15. Score: 6 | Accepted answer
  
  Try using this (completely untested):
  
  ```
  {% if paginate.prevUrl %}
      <a href="{{ paginate.prevUrl }}?{{ craft.request.getQueryStringWithoutPath() }}">Previous Page</a>
  {% endif %}
  
  {% if paginate.nextUrl %}
      <a href="{{ paginate.nextUrl }}?{{ craft.request.getQueryStringWithoutPath() }}">Next Page</a>
  {% endif %}
  
  ```
  
  **Update:**
  
  The above will only work once Craft 2.3 comes out.
  
  In the meantime, it's a bit sketchy, but you can open up `craft/app/variables/HttpRequestVariable.php` and add this method:
  
  ```
  public function getQueryStringWithoutPath()
  {
      return craft()->request->getQueryStringWithoutPath();
  }
  
  ```
  
  And it should work. But please be aware that file could be overwritten by a 2.2 build release at any point during an auto-update and your template would break.
  
  > **Comments:**
  > **username_0**: Thanks but that didn't work. Throws this error: 'Method "getQueryStringWithoutPath" for object "Craft\HttpRequestVariable" does not exist'  
  > **username_1**: Gah... just realized that got added to the unreleased Craft 2.3.  
  > **username_1**: Updated answer.  
  > **username_2**: Hacking the core? That's some back-alley advice right there username_1. ;)  
  > **username_1**: HACK THE PLANET  
  > **username_2**: TBH, the OP can (and should) put that method into a custom plugin. Should work just as well, right?  
  > **username_1**: Good point... will be much safer for updating.  
  
  ---
  
  