Jump to content

pages sort from frontend


a.masca
 Share

Recommended Posts

Hi everyone,
I hope all is well in these strange quarantine days.

I'm looking for a way to give those who visit a page with a catalogue (a simple list of pages) the possibility to change the order of the catalogue items
by clicking on an up / down arrow.

so from this:

cat1
- page 1
- page 2

should become

cat1
- page 2
- page 1

but I can't understand how to use $page-> sort correctly.
Obviously I set the sort of cat1 children as a custom sort.
Can you help me out?

Thanks so much

Link to comment
Share on other sites

Steps to solve this:

  • create .js file which sends your sort criteria via form and receives the updated page list. Reload page or update content (ajax)
  • get the input (sort criteria) via PW API:
    $input->post

     

  • sanitize your input

  • select pages from DB
     

    $pages->find('template=xy, parent=xy,sort=criteria1,sort=criteria2, ... and so on);

     

  • render updated list.
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...