Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Alphamenu on collection 04 Jun 2012 09:06 #2474

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
Hi,

I would be interested into create an alphamenu on the top of the collection of items on the frontend.
[ALL | A | B | C | D | .... ]
Anyone know how to implement it ?

thanks in advance

Please Log in or Create an account to join the conversation.

Re: Alphamenu on collection 05 Jun 2012 08:27 #2482

  • etc
  • etc's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 132
  • Thank you received: 19
Hi,

At the first glance I would see two possibilities.
First is to play with filtering, whether there is a way to customize it.
One of the files you can find in tmpl folder in case you used this in Cook Builder and others you will find in JDom (search).

The second is to create own module which will display alphamenu pattern.
It would just run simple sql query to display data that you need.

So this is just my idea what I would try to do.

Please Log in or Create an account to join the conversation.

Re: Alphamenu on collection 05 Jun 2012 08:53 #2483

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Yes,

In both cases you should customize the search query.

Example for D letter :
SELECT * FROM #__xxx WHERE name REGEXP '^d';

So, all you have to do is to add some code in : classes/jmodel.list.php :
function _buildSearch(...)
{
	if (!isset($this->_searches[$instance]))
		return;

	$db= JFactory::getDBO();
	$tests = array();
	foreach($this->_searches[$instance] as $namespace => $search)
	{
		$test = "";
		switch($search->method)
		{
			case 'like':
				$test = $namespace . " LIKE " . $db->Quote("%%s%");
				break;

			case 'exact':
				$test = $namespace . " = " . $db->Quote("%s");
				break;


			//ADD HERE
			case 'startwith':
				$test = $namespace . " = " . $db->Quote("^%s");
				break;

			//END

			case '':
				break;
		}

		if ($test)
			$tests[] = $test;
	}

...

So, where _addSearch() is called, change the search method name (you'll find this ;-) )


To finish, call your page adding in the url : &search_xxxx=D (example)



Not tested,
Try it and please furnish the working solution.
Coding is now a piece of cake
The following user(s) said Thank You: JoomGuy

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.094 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started