Knowledge Base - Tutorial Interval search plugin for Sobi2

Welcome to this tutorial for the Sobi Interval Search plugin. The screen captures are made with the current version of the plugin (April 2010) and with Sobi 2.9.3, it is possible that some screens are slightly different on your version.

Also screen captures are made on a system in French, but important information is translated in the text.

Remember that you can fly over the texts in the backend, a tooltip appears with a contextual help.

It is possible to work on a clone of Sobi2, for this, simply clone the plugin with the official tool provided by Sigsiu.net.

 


 

 


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.

plugin_interval1

Click the browse button and select the file plugin_import.zip. Click install and the plugin should be installed. In case of installation error:

  • Check writing privileges (CHMOD) in the folder 'com_sobi2/plugins' in 'components' and 'administrator / components'
  • 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 which we mentioned above. Click save.

plugin_interval2

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.


This plugin works with numerical, or date values. It is not possible to work  alphanumeric value.

Here are some examples of custom fields compatible with this plugin.

plugin_interval3

Basic case with values entered by the user. Warning, if the user can enter a textual value here, it may represent a risk that value will not be found.

Note: the value need to be a numeric value, or a least start with a number. Examples:

  • 100 -> ok
  • 200 -> ok
  • -120.45 -> Ok
  • 100€ -> ok
  • 200 $ -> ok
  • 2000 pieces -> ok
  • price $20 -> NOT OK
  • $100 -> NOT OK

plugin_interval4

The field calendar work for the date search. Beware, it is necessary to let the plugin date format is used by Sobi (must refer to the parameters for that).

plugin_interval5

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 users 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".

WARNINGS:

  • 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).

plugin_interval5_1

The field type listbox works too, but be careful how to store values, because should always include an identification value that can be sort similar to the displayed value, as in the example below. Warning, if you change existing fields, the entries already created will not be updates (this is due to Sobi).

plugin_interval6


The plugin is composed of several tabs, including the tab 'help' that you sometimes can see! The plugin allows you to simultaneously search with multiple custom fields. This means that you can, on the same search form, use several fields "From... - To...".

plugin_interval7

For this the tabs 'Between method' and 'Limit method' work as blocks. A block manages a search field, and when a block is created, you can add a new one, so on indefinitely. You can also unpublish or delete any block. Each block is separated by a gray line.


The search method "From... - To..." allows you to search all entries between the values entered. For example, for 2, 4, 5, 6, 8, 10, a search for values returned from 5-9 are 5, 6, 8.

Simple values

In the case of values of type inputbox, open the tab "Between method" and choose the minimum required parameters:

  • - The choice of custom fields: Select the fields that you want to search the values. In our example we will work on the field field_code order to search entries on their postcode.
  • - Method: We will select 'by value', in order to set ourselves values backend.
  • - From list: On our site example, the postal code range is from 1001 to 1950. We will split the list into several groups and without entering the last value: 1000,1200,1400,1600,1800.
  • - To list: Enter the same values, but without entering the first and, this time entering the last: 1200,1400,1600,1800,2000
  • - State: verify that the state is 'publish'.

plugin_interval8

Click the save button and all settings are saved, for example if you selected 'mark for deletion' for the 'state' parameter, this block shall have been removed.

And the frontend result is correct. If I select "From 1000 - To 1200", only the entry with the postal code 1001 appears.

plugin_interval9

ListBox values

The operation with the type of field listbox is the same. Simply choose a field type listbox. In our example it is the custom field 'field_height', which contains this kind of values 150 -> 150 cm, 160 -> 160 cm, 170 -> 170 cm, ... You can enter values in the same way, ie "From: 150, 160, 170, 180, 190" and "To: 160, 170, 180, 190, 200.

Or maybe there is another solution, simply enter a value in the 'Step' parameter, and the plugin automatically calculates the values to be placed in the drop-down lists. For example, entering a value of 5, the plugin inserts these values: "150, 155, 160, 165, 170, 175, 180, 185, 190, 195, 200.

plugin_interval10

Calendar values

With this type of field it is not possible to work with the 'Step' method, we must work with the 'By values' mode. In our example, the dates of the entries are ranged from 16.01.2009 to 17.12.2009 (dd.mm.yyyy). Including an example we can seize these dates for the inputs ' From... To... ': 01.01.2009, 01.02.2009, 01.03.2009, 01.04.2009, 01.05.2009, 01.06.2009, 01.07.2009, 01.08.2009, 01.09.2009, 01.10.2009, 01.11.2009, 12.01.2009, 01.01.2010.

plugin_interval11

Also in the same block 'Calendar', trying to change the mode from 'By values' to 'User Input'. In this case it is allowed to leave the values 'From ...' and 'To ..' previously entered, they are simply not used.

plugin_interval12

And now in the frontend, the form is different, the section 'From... To... ' is now designed as calendar input.

plugin_interval13

Advanced options

In the previous examples, we used three different methods of user input, it is of course possible to use each method with each type of custom fields (except from the step mode with fields of type calendar).

Draw One list: If you dont want use 2 listbox for the 'from... to...' selection, you can set this value to yes. Then if you have these values: From: 1,5,10,15 To: 5, 10, 15, 20 then the result list will be: 1 to 5, 5 to 10, 10 to 15, 15 to 20.

Tolerance: You can set a tolerance value. This value is in percent. If you set 10 here, a tolerance of 10% minus of the from value and 10% bigger of the to values is used to find the result. Then, a from 100$ to 200$ search will include prices from 90$ to 220$.

Number format: You can specify the number of decimals, the thousand separator and the comma. Then a number like 1976, can be drawn 1,976.00 or 1'976,0. The original value is not changed. If all 3 parameters are given, number  will be formatted with entered decimals, decimal separator instead of a dot (".") before the decimals and the entered thousands separator instead of a comma (",") between every group of thousands.


With this search option, you can search all entries to your correspondent search filters Sobi, and more such filter the entries on a maximum price (all the red cars for a price of $ 5,000 maximum). In our example we will work with the same fields as in the method 'From... To... '.

Simple values

In the case of values of type inputbox, open the tab "Limit Method" and choose the minimum required parameters:

  • The choice of custom fields: Select the field that you want to search in our example we will work on the field field_postcode order to search entries on their postcode.
  • Method: We will select 'Minimum', in order to enter values in ourselves and allow backend search values greater than the user's selection.
  • Min-max list: On our example website, the postal code range from 1001 to 1950. We will split the list into several groups and without entering the last value: 1000,1200,1400,1600,1800.
  • State: verify that the state is 'publish'.

plugin_interval14

ListBox values

The operation with the type of field listbox is the same. Simply choose a field type listbox. Our example it is the custom chmaps 'field_height', which contains such valuable questions 150 -> 150 cm, 160 -> 160 cm, 170 -> 170 cm, ... Choose the option 'Maximum' to search for all values smaller than the one selected. You can enter values in the same way, ie "150, 160, 170, 180, 190, 200".

plugin_interval15

Calendar values

In our example, the dates of the entries are ranged from 16.01.2009 to 17.12.2009 (dd.mm.yyyy). Including an example we can seize these dates for the inputs ' From... To... ': 01.01.2009, 01.02.2009, 01.03.2009, 01.04.2009, 01.05.2009, 01.06.2009, 01.07.2009, 01.08.2009, 01.09.2009, 01.10.2009, 01.11.2009, 12.01.2009, 01.01.2010.

plugin_interval16

Also in the same block 'Calendar', trying to change the mode from 'Low' to 'Low and user input'. In this case it is allowed to leave the values entered above, they are simply not used.

In frontend, the form is different, it expects a calendar user input.

Advanced options

In the previous examples, we used three different methods of user input, it is of course possible to use each method with each type of custom fields (except from the step mode with fields of type calendar).

Number format: You can specify the number of decimals, the thousand separator and the comma. Then a number like 1976, can be drawn 1,976.00 or 1'976,0. The original value is not changed. If all 3 parameters are given, number  will be formatted with entered decimals, decimal separator instead of a dot (".") before the decimals and the entered thousands separator instead of a comma (",") between every group of thousands.

Applies To

All Products