Knowledge Base - Tutorial Ordering plugin for Sobi2
Welcome on the tutorial of the Ordering plugin.
Follow table of content.
You just download the plugin. For that you received by email a download link that contains the order number (like 1234567890). Keep this email, with them you can download the updates.
Open your site backend, and select the menu Components > Sobi2. Once in the component Sobi2, go to the side menu plugin > Plugin Manager.
Click the browse button and select the zip file for the plugin. Click install and the plugin should be installed. In case of installation error:
- Check writing privileges (CHMOD) in the folder '/components/com_sobi2/plugins' and in 'administrator/components/com_sobi2/plugins'
- Try to install an official plugin like Gallery from Sigsiu.net
- Perform a system check in Sobi and correct any errors
Once installation is complete, you will be asked for for an order, enter the number (for exemple: 1234567890) which we mentioned above. Click save.
You will now see a message in green indicating that the registration is correct and that the version is updated. Note: Your version may be newer than the server, because we do not publish necessarily minor update.
We will discuss the main parameters as well as the effect of these in frontend.
Select Form Position
Select the position in the search page, where the order search form should be displayed. Enter before or after which field placing the sorting fields. This choice has no effect in the search form.
Date format for sql queries
The field calendar work for ordering by a calendar field. Beware, it is necessary to let the plugin date format is used by Sobi.
Sobi use an internal date format, by default is 'y-mm-dd', and that give in sobi2 (calendar and entries): 1976-08-13. Unfortunally, mySql dont use the same formatting. The plugin cannot test all combinaisons with all custom separators. For this reason, you need to enter here manually the date format in the mySql format. Samples:
- "%Y-%m-%d" for 1976-08-13 for the sobi format y-mm-dd (default)
- "%d.%m.%Y" for 13.08.1976 for a custom format dd.mm.y (european)
To check the format used by Sobi, go into the Configuration >> Registry Editor >> Section "calendar" >> value "date_format", then by using the plugin tab, choose the right format date. In Capture, the value of my Sobi is "dd.mm.y" and the value of the plugin "%d.%m.%Y".
- All combinaisons are not supported by sobi2 !
- The sql date format need to correspond exactely with your Sobi2 config.
- If you change the sobi2 date format, the existing entries dont change (you need to resave all existings entries).
Text for compact list
Set the ordering text for the compact list mode. For the compact mode, a space is automatically added between the label and the field.
Leave blank to use the separate list mode. The text --- A -> Z --- is fixed in the code and not modifiable.
Compact list mode sample:
Separate list mode sample
The Sobi cache store the display of category view (list view) into the database to prevent Sql queries, the cache in saved on the server. The plugin allows each user to change the ordering. Then in this case it's not possible to use the Sobi second and third level cache. You need to unactive and clear them.
If you only use the ordering plugin for the search form, the results are drawn dynamically, then you can leave the cache on. In the same way, if you use the ordering plugin with a fixed value (setting from the backend), without user choice, for example always sorting by price, in this case you can leave the cache on. This because the Sobi cache is erased each time a new entry is added, and the cache will be recreate when the list is redrawn.
Type of fields
This plugin works with numerical, alphabetical or date values (see above for the calendar mode). If you use value in mix of text and number, that represent a risk of error in lists. This list of entries with this values should be sort like numbers:
- one, three, two, ten -> one, ten, three, two
- 1-one, 3-three, 2-two, 10-ten -> 1-one, 10-ten, 2-two, 3-three
You can try this in a spreadsheet program, the result is same:
Then a good idea for the listbox values, is to use them like:
In the same way, sorting by 0/1 values is not a good idea, the 0 values will always set a the end of the list (0 = no value).
The plugin is compatible with the AlphaUserPoint component, then you can sort the entries by the point of each user.
If you use this plugin, the choice of the order made within the parameters of SOBI is no longer used.
The plugin allows to change the sort order of entries in the list of entries in each category as well as the Result of research. There are two methods of sorting through this plugin: sorting chosen by the administrator, and sorting that the user can choose (according to the fields allowed by the administrator). In addition to the entries that have the same value, a second sort key can refine the sorting.
Administrator sorting choice
It is the administrator who chose the field that sort entries. In our example, the field chosen is heigth. This means that entries will be sorted by this field. If the administrator has not chosen any value, they will be sorted according the Sobi setting.
As in the example below, the entries are sorted well from the heigth field.
In the case of same sorting values (in our case the entries 'Le titre 7' and 'Le titre 3', whose heights are 160cm), the plugin use the the ID of the entries to put theses 2 entries in the order. Similarly entries without values (no height selected) are placed at the end in the order of their ID.
It is then possible to add a second sort key, in order to replace that ID sorting by another sorting key. This sorting key cannot be a field, but is a value, like hits, publication date, ... This option can also be hidden to the user.
User sorting choice
The administrator check in the backend a list of fields from which the user can choose the values of sort.
The administrator can select a value in the combo, and also in the checkbox for the user list. In this case, entries are sorted:
- By default, ie as the user does not choose any sort key (leaving the option 'Default') is the value chosen by the administrator who is used
- Once the user selects a value in the list, this is used for sorting entries.
If the administrator has not chosen any value, and the user leaves the combo to 'Default', the Sobi setting is used.