Skip to main content

I have applied a filter in the ticket list, so I had to make the list myself, this is now successful, but I still have 1 problem

.

 

The pagination that I made gives the wrong links. Is there anyone who has had problems with this before? Can I help with this?

 

I want this link:

https://support.beefinity.com/support/tickets/filter?page=2&requested_by=0&wf_filter=all


But i get this link:

https://support.beefinity.com/support/tickets/filter/page/2?requested_by=0&url_locale=&wf_filter=all


I did everything as it was in the documentation:

https://help.shopify.com/en/themes/liquid/objects/paginate


But it just won't work

Here is the code i use:

  

{% paginate tickets by 10 %} {% for ticket in tickets %} {% if ticket.group.name == "Beefinity Support"%}



<div class="c-row c-ticket-row" id="ticket-view">

<span class="status-source sources-detailed-{{ticket.source_name | downcase}}" title=" {{ticket.source_name | downcase}} "></span>

<span class="label-status-pending label label-small">{{ticket.status}}</span>



<div class="ticket-brief">

<div class="ellipsis">

<a class="c-link" href="{{ticket.portal_url}}" title="{{ticket.subject}}">{{ticket.subject}}</a>

</div>





<div class="help-text">

Made by: <span class="emphasize">{{ticket.requester.name}} &nbsp; Made on:{{ ticket.created_on | date: "%d-%m-%Y %H:%M" }}</span><br>

Agent: <span class="emphasize">{{ticket.agent.name}}</span>

</div>

</div>

</div>

{% endif %} {% endfor %} {% if paginate.pages != 0 %}



<div class="pagination pagination-centered">

<ul>

{% if paginate.previous %}

<li class="previous">

<a rel="prev start" href="{{ paginate.previous.url }}">

{{ paginate.previous.title }} Previous

</a>

</li>

{% else %}

<li class="disabled">

<span>&laquo; Previous </span>

</li>

{% endif %}



{% for part in paginate.parts %}

{% if part.is_link %}

<li>

<a rel="prev start" href="{{ part.url }}">

{{ part.title }}

</a>

</li>

{% else %}

{% if part.title == paginate.current_page %}

<li class="active">

{{ part.title }}

</li>

{% else %}

<li>

<a rel"start"> {{ part.title }}</a>

</li>

{% endif %}

{% endif %}

{% endfor %}



{% if paginate.next.is_link %}

<li class="next_page">

<a rel="next" href="{{ paginate.next.url }}">

Next {{ paginate.next.title }}

</a>

</li>

{% else %}

<li class="next_page disabled">

<span> Next &raquo; </span>

</li>

{% endif %}

</ul>

</div>

{% endif %}

{% endpaginate %}

  



Fixed it with Jquery:

if  ($('a[href^="/support/tickets/page/"]').length){

$('a[href^="/support/tickets/page/"]').each(function() {

var oldUrl = $(this).attr("href"); // Get current url

var newUrl = oldUrl.replace("?", "&");

newUrl = newUrl.replace("/support/tickets/page/", "/support/tickets?page="); // Create new url

$(this).attr("href", newUrl); // Set href value

});

}else{

$('a[href^="/support/tickets/filter/page/"]').each(function() {

var oldUrl = $(this).attr("href"); // Get current url

var newUrl = oldUrl.replace("?", "&");

newUrl = newUrl.replace("/support/tickets/filter/page/", "/support/tickets/filter?page="); // Create new url

$(this).attr("href", newUrl); // Set href value

});

}