jooDatabase Forum
Welcome Guest   [Register]  [Login]
 Subject :Re:Alphabox Search Bug.. 2011-08-19 00:20:21 
Fred

Guest

PS: Forum cuts code to the right

'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z' ALL

 

would be the right line

 

IP Logged
 Subject :Alphabox Search Bug.. 2011-08-19 00:17:11 
Fred

Guest

I extended the Alpha Search to numbers as well. The row looks like that now:

 

'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' ALL

 

instead of just letters we have numbers as well now and we could search also for 0. 1. 2. and so on in the DB.

 

Problem:

When I view members/items in lets say for example starting with "F", and I do a search on lets say for example names starting with "M" it would not show results even there are entries in the DB already starting with "M"

If I hit "ALL" the listview will reset and I can do a search for "M" again

Any ideas how to fix the alphabox search? I use this php code:

/**
     * Returns a roman alphabet to select the first letters ot the title
     *
     * @access public
     * @param current Alphachar
     */
    function getAlphabox($alphachar,$joobase,$filter)
    {
        $alphabox = "<div style='width:auto;text-align:center;' class='pagination alphabox'>";
        $alphabet= array ('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
        foreach ($alphabet as $achar) {
            if ($achar==$alphachar) {
                $alphabox .= "<span class='active'>".ucfirst($achar)."</span>";
            } else {
                $alphabox .= "<a href='".JoodbHelper::_findItem($joobase,"&filter=".$filter."&letter=".$achar)."'>".ucfirst($achar)."</a>";
            }
        }
        $alphabox .=  "<a href='".JoodbHelper::_findItem($joobase)."'>&raquo;".JText::_(' All')."</a></div>";
        return $alphabox;
    }


    /**
     * Returns Filter box for catalog view
     *
     * @access public
     * @param  current FilterSelect, Joobase, Searchstring
     */
    function getFilterbox($filter,$joobase,$search,$letter)
    {
        $db =& JFactory::getDBO();

        $filterform =  "<form name='filterbox' method='post' action='".JoodbHelper::_findItem($joobase)."'><b>".$joobase->ffilter.": </b>"
                      ."<select name='filter' style='width: 200px' >";

                      $queryfilter = "SELECT distinct(".$joobase->ffilter.") FROM ".$joobase->table." ";

                      if ($filter != '')
                      {
                          $queryfilter .= " WHERE ".$joobase->ffilter." != '".$filter."' ";
                          $filterform .= "<option value='".$filter."'>".$filter."</option>";
                      }

                      $filterform .= "<option value=''>...</option>";

                      $db->setQuery($queryfilter);
                      $result = $db->loadRowList();
                        foreach ($result as $fname)
                        {
                            $filterform .="<option value='".$fname[0]."'>".$fname[0]."</option>";
                        }

            $filterform .="</select><input type='hidden' name='alphachar' value='".$letter."'><input type='hidden' name='search' value='".$search."'><input type='hidden' name='task' value='search'>&nbsp;<input class='button' type='submit' value='filter'></form>";

        return $filterform;
    }

 

 

 

IP Logged
Page # 


Powered by ccBoard