This Function Has Been Available Since:
(AFCommerce v 2.1, Functions v 1.1)
Sorts an array of id numbers for either products or categories, depending on what you pass to this function.
Description
string = afc_sort_array (idarray, type, mode)
This function sorts an array of id numbers for either products or categories, depending on what you pass to this function. This function uses the mysql "array_multisort", which is the best function to use for sorting. You can sort the array by name or by the sort order number you assign in the admin area. If sorting by name, you do not need to do any work.
Parameters
idarray (array) - This is the array of id numbers that is to be sorted.
type (string) - If type is "cat", this tells the function we will be sorting categories. If type is "prod", this tells the function we will be sorting products.
mode (string) - This parameter sets how we will be sorting the array. If mode = "bynumber", then the array is sorted by the number you assign in the admin area. Sort order by number will give the number a "sorting weight" where you may use the same number twice, and they will be treated as equal and ordered in the order they were found in (inside the database table). So if you leave them all zero, they will sort in the order in which they are found.
If mode = "byname", then the array will be sorted in alphabetical order. This value can be set in the admin area.
Return Values
Returns the sorted array.
Open Source: YesPaul's Examples There are currently no examples for this function.
|
Back to Functions List
|