2014-06-24, 05:59:36
(2014-06-24, 02:41:14)shawn_a Wrote: What have you tried , what is not working ?
PHP Code:
function cateogory_list() {
// get our controller parameter
global $args;
// get number of items displayed per category
$items_per_cat = isset($args[0]) ? $args[0] : 10;
// define output
$output = '';
// initialize controller
$manager = new ImController();
// get IManager preferences
$preferences = imModel::getPref();
foreach($preferences->categories->category as $cat)
{
// setup items by category
ImCategory::setCategory($cat);
$manager->runModelMethod( 'gen_register',
array('', '')
);
$items = array_reverse($manager->getModelValue('items_ordered_struct'));
$items_arr = array_merge($items_arr, $items);
// get number of items per categorie
$item_count = count($items);
$ipc = ($item_count > $items_per_cat) ? $items_per_cat : $item_count;
$row = '';
for($i = 0; $i < $ipc; $i++)
{
}
// Render wrapper template
// THIS LINE IS IMPORTANT --> i getting a category from here
echo '<a class=" aa" title="'.$items[0]['category'].'" href="nasza-oferta?kategoria='.$items[0]['category'].'">'.$items[0]['category'].' ('.$item_count.')</a><br />';
}
}
i'm was trying too do this with a code to
PHP Code:
function sort_array_cat($a, $b)
{
if ($a['category'] == $b['category'])
{
return 0;
}
else
{
if($a['category'] < $b['category'])
{
return 1;
}
else
{
return -1;
}
}
}
i want to sorting a category list by asc or desc - this plugin not have a custom sorting name of categories.. and it's display it by the created date.
i can sort a categories.. THANK YOU Bigin
but i have a difficult problem with sorting a categories with asc dsc...
user plugin: scroll to top