I have a question on views sorting.

I have two content type(TypeA TypeB) which has the same field.

And i use views to list all the content with the sort i want.

Right now my problem is i want to sort my content with A1 A2 B1 B2 B3 B4 A3 A4 B5 B6 B7 B8...

with ratio 2:4 and in each type with another sorting rule like post date or update date ...

How can i do that?

Could somebody give me a suggestion?

Thx a lot

  • 1
    Interesting problem - If you can show us how to implement that ordering in an SQL query, which is what will need to happen for this to work with views, we can certainly help you to alter the views query...but we're not going to be able to help you with the SQL logic, you'll need to have that worked out first. If you're unsure, it seems like the sort of thing that would be appropriate for Stack Overflow (just not here, as the underlying issue doesn't relate to Drupal). – Clive Jun 26 '14 at 11:00
  • ok, i see. I really unsure how to write SQL query.I will make sure the Query First. – cobenash Jun 26 '14 at 11:08
  • Rather than try to do this a single query I think you'll need to execute two queries, one for each content type, and interleave the output. Any other way will be really hard. Pagination will be more complex but if you have a page length that's a multiple of 6 not impossible. – Alfred Armstrong Jul 31 '19 at 10:17

Try using the Views Natural Sort module, it is an add on to views and provides a better sorting option than the build in views sort.

Provides a views filter that sorts node titles by a more natural manner by ignoring articles like "The" and "A."

  • ok~thx. This is a good option too. – cobenash Jun 27 '14 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.