[Typo3-shop] tt-products, product sorting by pid (based on tree position)
Rick - Futuros
typo3 at futuros.nl
Sat Sep 17 00:17:50 CEST 2005
Franz Holzinger wrote:
> Hello Rick,
>
>>I have an array with all the products so i use:
>>uasort($myarray,myCompFunc())
>>
>>So in my comp func i can easily get the pid of the rows:
>>$pid1 = $row1['pid'];
>>$pid2 = $row2['pid'];
>>
>>Now comes the tricky part:
>>I want to compare the both pids by there position in the tree. I couldnt
>>find a usefull function in the API, but i can't believe there isn't one.
>>
>>So before i start writing my own function, can some one point me to a
>>function i can use?
>>
>
> there is such a function in the Treelib from René Fritz. I have copied
> this also in an extended form into the library of the Commerce
> extension, but not yet published. So you need to contact the Commerce
> leaders to get the code.
>
>
>
> Franz
>
>
>
> /**
> * Count subrecords with parent_id=$uid
> * Additional WHERE clauses can be added by $where (fx. ' AND blabla=1')
> *
> * @param integer UIDs of records
> * @param string Additional WHERE clause, eg. " AND blablabla=0"
> * @return integer Count of subrecords
> */
> function countSubRecords($uid,$where='')
> ...
>
>
>
>
> /**
> * Returns an array with rows for subrecords with parent_id=$uid
> *
> * @param integer UID of parent of records
> * @param string List of fields to select (default is '*')
> * @param string Additional WHERE clause, eg. " AND blablabla=0"
> * @param boolean Enable sorting
> * @return array Returns the rows if found, otherwise empty array
> */
> function getSubRecords ($uid, $fields='', $where='', $sorting=true) {
>
>
> ...
I have already written my own function. It works, but is probably not
the best way to code it.
BTW. what is the potential of the ttproducts extension compared to the
upcoming commerce ext.
i read the paper end it seems the commerce ext is far superior.
What could be a reason to choose for ttproducts when both are available
(simplicity?)
More information about the TYPO3-project-tt-products
mailing list