Book Search Issue (Search results sorted by year)

Started by k.rasheva, 20 September 2020, 00:51:52

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

k.rasheva

Hello Federica and Dario!
I have recently started using Alexandria book library on my website.  It is an excellent library extension and I have enjoyed creating a library with it.
The only issue I am having is when I use the search menu. I made a "Search" menu item and it works fine in alphabetical mode. I need it open results ordered by the year of the Books. When I make these settings from the menu I see server error 500 or if it works the books are sorted alphabetically. Can you tell me where I have made wrong?

Thank you in advance!
Best regards!
Katia

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

Hi Katia,
search by year is based on field "Year" (year of publication), not by "Date insert". Have you filled in "year" field?

If you like Abook, please add a review on "joomla extension directory" https://extensions.joomla.org/extension/alexandria-book-library/ . i will appreciate it very much. Your review will helps other people!
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

k.rasheva

Quote from: federica on 27 September 2020, 10:50:00
Hi Katia,
search by year is based on field "Year" (year of publication), not by "Date insert". Have you filled in "year" field?

If you like Abook, please add a review on "joomla extension directory" https://extensions.joomla.org/extension/alexandria-book-library/ . i will appreciate it very much. Your review will helps other people!

I actually created a "Search" button. I would like the books in Search View (and everywhere) to be sorted by "year" without having to use filters. They have currently sorted/ordered alphabetically, not by year. How to make that... Thank you for your support. Best regards! Katia

federica

Go to Abook global Options -> categories then set "Books order"=year
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

k.rasheva

Quote from: federica on 30 September 2020, 21:57:02
Go to Abook global Options -> categories then set "Books order"=year

Thank you for your reply, Federica!
I made this setting before writing to you. I have no idea why this setting is not working on my site. The books are still ordered by name alphabetically. I have books which titles are in Cyrillic, and English titled books. In the Search page,  English books are presented first, then are Cyrillic books, and all of the books are presented alphabetical order... I still don't understand where am I wrong. (Sorry for my English).

k.rasheva

Quote from: federica on 30 September 2020, 21:57:02
Go to Abook global Options -> categories then set "Books order"=year

Unfortunately, this setting does not work on my site. I tried everything - the order of the books is always in alphabetical order from A to Z. I even tried to put the year (which is very important to me) as the starting word of the title - the books are arranged by year (ie by numbers in title), but in the reverse order of what I need (from oldest to newest - for example from 2013 to 2020).

I don't know how to make the library sort the books the way I set it in the settings. I even tried to reinstall the component - nothing changed. What can affect the component? Thank you!

k.rasheva

I found the decision in the forum:
...components/com_abook/models/search.php, line 250:
Code: [Select]
// $query->order($db->escape($this->getState('list.ordering', 'a.ordering')).' '.$db->escape($this->getState('list.direction', 'ASC')).', a.title');
// commented out and for instance new:
$query->order($db->escape('a.year DESC'));
$query->order($db->escape('a.pag_index'));
This works! Thanks!