Help with php code

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
gala
Forum Members
Forum Members
Posts: 25
Joined: Sat Jun 13, 2009 8:56 am

Help with php code

Post by gala »

Hi Guys,
Could you help me with the php code for Cataloger module.
{cms_module module='Cataloger' action='recent' sub_template='brands' alias='katalog' recurse='items_all' count='20'}.
"action='recent' "- means that you want to display the most recently-added catalog items and below is a php file for it- action.recent.php
I want to display the oldest , first-added items. So I decided to create a new file - action.first.php- and just change acs order to desc(descending).
But it doesn't work.
Could someone direct me to good source ? Any advice would be deeply appreciated.
----------------------------------------------------------
if (!isset($gCms)) exit;
foreach ($params as $key=>$val)
{
$this->smarty->assign($key, $params[$key]);
}
if (! isset($params['recurse']))
{
$params['recurse'] = 'items_all';
}

list($curPage,$categoryItems) = $this->getCatalogItemsList($params);

if (!isset($params['global_sort']) || $params['global_sort']=='date')
{
usort($categoryItems,array("Cataloger", "created"));
}
else
{
usort($categoryItems,array("Cataloger", "chrono"));
}

if (isset($params['global_sort_dir']) && $params['global_sort_dir']=='asc')
{
$categoryItems = array_reverse($categoryItems);
}

$count = count($categoryItems);
$start = 0;
$end = min($count,$params['count']);
$thisUrl = $_SERVER['REQUEST_URI'];
$thisUrl = preg_replace('/(\?)*(\&)*start=\d+/','',$thisUrl);
$categoryItems = array_splice($categoryItems, $start, $end);
$this->smarty->assign('items',$categoryItems);

$this->smartyBasics();
echo $this->ProcessTemplateFromDatabase($this->getTemplateFromAlias($params['sub_template']));
-------------------------------------------------------------------------------------
gala
Forum Members
Forum Members
Posts: 25
Joined: Sat Jun 13, 2009 8:56 am

Re: Help with php code [SOLED]

Post by gala »

SOLED!
I just changed
$start = 0; to $start = -10;
Works!
Post Reply

Return to “Modules/Add-Ons”