Knowledge Base - Tutorial Easy Category plugin for Sobi2

Welcome to this tutorial for the Sobi Easy Category plugin. The screen captures are made with the current version of the plugin (May 2010) and with Sobi 2.9.2.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 and that the help Tab of the plugin contains useful informations.

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


Plugin installation

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_cat1

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

plugin_cat2

Once installation is complete, you will be asked for for an order, enter the number (for exemple: 123456789) which we mentioned above. Click save.

plugin_cat3

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.

Finalising installation

This plugin replaces the category manager of Sobi. For this reason, there are some small adjustments to be made manually to complete the integration of the plugin. These adjustments cannot be do in the installation process.

Disable the Sobi2 category management

It is necessary to remove the function that displays the choice of categories. This does not change the core code of Sobi, and you can update the component without problems. Follow these simple steps:

  • Go into Component > Sobi2 > Configuration > Registry Editor
    Locate the key cats_selection in the section edit_form
    Change the value of 1 to 0
    Locate the key cats_selection_adm in the section edit_form
    Change the value of 1 to 0
    Click on save (on the top)

plugin_cat4

Include verification of selected categories of Sobi2.

It must indicate what function Sobi2 use to verify that at least one category is selected. This does not change the code of Sobi2, and you can update the component without problems. For that you must follow these simple steps:

  • Go into Component > Sobi2 > Configuration > Registry Editor
    Locate the key cat_select_callback_func in the section edit_form
    Change the value of 0 to validateCategories
    Click on save (on the top)

plugin_cat5

Until the version 2.9.2.3 (-> april 2010), Sobi2 contains a small bug in the code (it was reported here). To enable the check that at least one category is selected, you must change the code of Sobi2. For this correction we need to modify the core code of the component, it will be lost during a future update of the component, and this operation will therefore be repeated. This bug is corrected since the version 2.9.2.4. Follow these simple steps:

  • The file to edit is located here: components/com_sobi2/form.class.php
  • Use your ftp client or a component such as eXtplorer to edit the file form.class.php
  • Find the line 1414 in the file (line number may vary depending on the version of Sobi2)
  • Find the following text:
  • * if( $f = $config->key( "edit_form", "cat_select_callback_func", false ) && function_exists( $f )) {
  • And replace it (by adding a pair of parentheses):
  • * if( ($f = $config->key( "edit_form", "cat_select_callback_func", false )) && function_exists( $f )) {
  • Save the file, and... voila.

plugin_cat6


Ci-dessous quelques explication concernant les paramètres du plugin. Dans l'exemple suivant, vous comprendrez mieux l'utilité des divers paramèters. Les paramètres sobi propres aux categories sont pris en compte. C'est à dire que le nombre de catégories, leur prix respectifs, ... définis dans sobi sont utilisés et gérés par le plugin.

Below some explanations for the plugin's parameters. In the following examples, you will better understand the utility of various parameters. The Sobi specific categories parameters are used. This means that the number of categories, their respective prices, ... defined in Sobi are used and managed by the plugin.

plugin_cat7

Select Form Position: Select the position in the form page, where the categories selector should be displayed. Note that you can show them only into the custom fields. If you enter 1, the selector should be on the first position (after the Title), if you enter 99, it's at the last position (before icon and image). If you use a custom entry form template, then this parameter take no effect.

Add custom JS function (Y/N): This allows to enable a JS function named 'customCategoriesAction_1(list)' (_1, _2, ... ) on the onChange event of the list. Then you can write a JS function in the template of the entry form to do a custom action.

Show price (Y/N): Show the price of the free and not free category, depending the sobi parameters.

Show description (Y/N): Show the short description of each category when is selected.

Disable parents (Y/N): If the selection of categories with children cats is disaloved by sobi, then the parent is disabled (non-selectable) in the listbox.

ID parent category (Y/N): Allows to define the parent category of a listbox. This listbox should display only the childs categories for the ID category, for example: if you have a 'cities' category that contains cities and a 'age' category that contains ages. You find the category ids in the category manager. In this case, the title of the listbox is the parent category.


The following capture show you my category structure:

plugin_cat8

We want to simply replace the Sobi categories selector by dropdown lists. The following parameters are chosen:

plugin_cat9

In this sample, the first 3 categories are for free.

plugin_cat10

And finally the result that appears in the add entry form:

plugin_cat11

Note the parent categories that are disabled (shaded depending the system / browser):

plugin_cat12

Once your selected categories, and entry is validated, the payment screen show you the non free optiosn, especialy the categories

plugin_cat13


Now we will work with a little more advanced categories structure:

plugin_cat14

The goal is to separate the different subject in order to clarify the user interactions. We will then enter the ID of parent categories 45, 46, 47. Warning, the entered ID are relative to my installation!

plugin_cat15

The Sobi configuration has been modified to allow only 3 categories (free) for each entry.

plugin_cat16

Try creating an entry, the category selector resume clearly each parent category, and allow select the corresponding childrens. Note also the description of the selected category that appears on the right and the description of parent during the parent label flyover.

plugin_cat17

Applies To

All Products