CMS MADE SIMPLE FORGE

Cataloger

 

[#5547] Shuffle order, search and search by first letter

avatar
Created By: Téïcée (teicee)
Date Submitted: 2010-10-18 18:49

Assigned To:
Resolution: None
State: Open
Summary:
Shuffle order, search and search by first letter
Detailed Description:
Hello,

I have modified the code for one of our project :
http://www.teicee.fr/artistes-normands/index.php?page=artistes-societaires

Then I published it and i let you see if you want to include it in the next
version.

For all questions, you can contact me : abonanni at teicee dot com


Modification of file : "action.defaultcategory.php"


/*
        * 19/10/2010 - Aurélien BONANNI - TEICEE - support@teicee.com
* Spécifications pour ce site : recherche d'un produit, recherche par la
première lettre de ce produit, et tri par aléatoire
        */
        if(isset($_POST['recherche']) && $_POST['recherche']!="") {
                $new = array();
                for($i=0;$i<count($categoryItems);$i++) {
if(stristr($categoryItems[$i]['title'],trim($_POST['recherche'])))
                                array_push($new,$categoryItems[$i]);
                }
                $categoryItems = $new;
        }
        elseif(isset($_GET['lettre']) && $_GET['lettre']!='') {
                //print_r($categoryItems);
                $new = array();
                for($i=0;$i<count($categoryItems);$i++) {
                        if($categoryItems[$i]['title'][0]==$_GET['lettre'])
                                array_push($new,$categoryItems[$i]);
                }
                $categoryItems = $new;
                usort($categoryItems,array("Cataloger", "contentalpha"));
        }
elseif (isset($params['sort_order']) && $params['sort_order'] ==
'alpha')
            {
            usort($categoryItems,array("Cataloger", "contentalpha"));
            }
else { shuffle($categoryItems); $new = array_chunk($categoryItems,5);
$categoryItems=$new[0];  }
        /*
        * Fin modification recherche ; lettres et tri en aléatoire
        */

History