How to display your Country’s Alphabet in Mosets tree joomla component

Written on . Posted in .

Following our customers suggestions and requirements, we decided to stop supporting the “Mosets tree Greek Alphabet” plugin that was developed 4 years ago. Instead of this extension, we have created a useful guide that offers you the freedom to create your own custom Alphabet for the mosets tree joomla! component.

Let’s remind ourselves the scope of the Mosets Tree. Mosets tree is a directory component for Joomla! It gives you all the tools and features you need to run a business directory, real estate management system, web links directory, model profiles or almost any type of imaginable directories on your Joomla website. You can find more details in the mosets tree website as well.

mosets tree alphabet

Let’s see how you can display your Country’s Alphabet in Mosets tree Joomla! component.

Step 1:

From joomla admin panel, navigate to Components > Mosets Tree > Templates (left sidebar) > Click on your current mosets template > *Show Alpha Index > Select Yes> Save & Close.

Enable Alpha index in mosets tree

* Show Alpha Index
Alpba Index shows a list of alphabets on top of the Index page to provide quick access to listings and categories that start with a specific alphabet.

Step 2:

Open the file: YOUR_JOOMLA_ROOT/components/com_mtree/mtree.php

Find (line: ~1320):

$where[] = "link_name LIKE '" . $database->escape( $alpha, true ) . "%' COLLATE utf8_swedish_ci ";
$where_cat[] = "cat1.cat_name LIKE '" . $database->escape( $alpha, true ) . "%' COLLATE utf8_swedish_ci ";

Replace with:

// $where[] = "link_name LIKE '" . $database->escape( $alpha, true ) . "%' COLLATE utf8_swedish_ci ";
// $where_cat[] = "cat1.cat_name LIKE '" . $database->escape( $alpha, true ) . "%' COLLATE utf8_swedish_ci ";

// BEGIN: our own alphabet (Web357)
$alphacustom = JRequest::getVar('alphacustom');
if ($alphacustom):
   $where[] = "link_name LIKE '" . $database->escape( $alphacustom, true ) . "%'";
   $where_cat[] = "cat1.cat_name LIKE '" . $database->escape( $alphacustom, true ) . "%'";
else:
   $where[] = "link_name LIKE '" . $database->escape( $alpha, true ) . "%'";
   $where_cat[] = "cat1.cat_name LIKE '" . $database->escape( $alpha, true ) . "%'";
endif;
// END: our own alphabet (Web357)

Step 3:

Open the file: YOUR_JOOMLA_ROOT/components/com_mtree/templates/YOUR_TEMPLATE/page_listAlpha.tpl.php

Find (line: ~12):

?><center><?php echo sprintf(JText::_( 'COM_MTREE_THERE_ARE_NO_CAT_OR_LISTINGS' ), ( (is_numeric($this->alpha)) ? JText::_( 'COM_MTREE_NUMBER' ) : strtoupper($this->alpha)) )?></center><?php 

Replace with:

// BEGIN: our own alphabet (Web357)
$alphacustom = JString::strtoupper(JRequest::getVar('alphacustom'));
if ($alphacustom):
   ?><center><?php echo JText::sprintf( 'There are no cat or listings', ( (is_numeric($alphacustom)) ? JText::_( 'Number' ) : strtoupper($alphacustom)) )?></center><?php
else:
   ?><center><?php echo JText::sprintf( 'There are no cat or listings', ( (is_numeric($this->alpha)) ? JText::_( 'Number' ) : strtoupper($this->alpha)) )?></center><?php
endif;
// END: our own alphabet (Web357)

Step 4:

Open the file: YOUR_JOOMLA_ROOT/components/com_mtree/templates/YOUR_TEMPLATE/sub_alphaIndex.tpl.php

Find (line: 1):

<div class="alpha-index" style="text-align:center"><?php echo $this->plugin('listalphaindex', '') ?></div>

Replace with:

<div class="alpha-index" style="text-align:center"><?php echo $this->plugin('listalphaindex', '') ?></div>
<?php
// BEGIN: Display letters of the alphabet (Web357)
// Alphabet (A-Z index) http://www.omniglot.com/writing/
// Create your own alphabet by copying the below line and replace the greek letters with your alphabet letters
$my_alphabet_letters_arr = array('Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ','Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ','Χ','Ψ','Ω'); // Greek

// output
$web357_itemid = JRequest::getVar('Itemid');
if (!empty($my_alphabet_letters_arr)):
   echo '<div class="alpha-index" style="text-align:center; display: block; clear: both; margin: 20px 0;">';
   foreach ($my_alphabet_letters_arr as $letter):
      echo '<a href="index.php?option=com_mtree&amp;task=listalpha&amp;alpha=a&amp;alphacustom='.$letter.'&amp;cat_id=0&amp;Itemid='.$web357_itemid.'" class="alpha">'.$letter.'</a>';
   endforeach;
   echo '</div>';
endif;
// END: Display letters of the alphabet (Web357)
?>

Check out a very useful alphabetical index of all the writing systems and languages http://www.omniglot.com/writing/

Alternatively:

You can download the zip file “UNZIP-FIRST_mtreegreekalphabet_j25_j3x_free.zip” and follow the steps below:

  1. First take a backup of the folder “YOUR_JOOMLA_ROOT/components/com_mtree/”
  2. Extract the zip file. You will find a folder named “components”.
  3. Copy the folder “components” in YOUR_JOOMLA_ROOT.
  4. Create your Country’s alphabet by editing the file “OUR_JOOMLA_ROOT/components/com_mtree/templates/YOUR_TEMPLATE/sub_alphaIndex.tpl.php”.
  5. That’s it! Now you have the Greek alphabet in “mosets tree” joomla! component. 🙂

If you have any further questions or any difficulties with the instructions provided above, feel free to contact us or leave a comment in the form below.