[TYPO3-commerce] how to change sorting of articles in list view
Morten Olesen
mo at idefa.dk
Wed Jun 3 08:38:50 CEST 2009
Hi Toni
Not really sure why you would want to do this now that sorting is
finally in...
at any rate
articles,products,etc have a postinit hook that allowes you to change
stuff such as which fields to load or sortorder ($this->orderField)
before the actual database call
Hook:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['postinit']
function: postInit($ref)
Article order even has it's own hook
Hook:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['articleOrder']
function: articleOrder($originalOrder)
so:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['articleOrder'][]='EXT:/yourextension/class_tx_yourextension.php:tx_yourextension';
<?php
class tx_yourextension{
function articleOrder($originalOrder){
return 'uid';
}
}
?>
ps. even if a hook is not documented you can easily find it your self by
grepping through the source;
grep -nR classRef | grep foreach
you can then grep through that result with what your looking for - in
your case article & order:
/Morten
toni milovan wrote:
> Hi,
>
> I need to change sotring of articles in in Listview so they are sorted
> by uid instead of sorting field. Anyone can point me to where in the
> code I can change this?
>
> Thanks,
>
> Toni
>
More information about the TYPO3-project-commerce
mailing list