[TYPO3-commerce] number of products

Simon Berg druzil69 at gmx.de
Thu Aug 30 10:00:59 CEST 2007


"Ingo Schmitt" <mailinglisten at i-schmitt.de> schrieb im Newsbeitrag 
news:mailman.1.1188231843.25252.typo3-project-commerce at lists.netfielders.de...
> Hi Simon,
>
>> "Ingo Schmitt" <mailinglisten at i-schmitt.de> schrieb im Newsbeitrag 
>> news:mailman.1.1188210659.10988.typo3-project-commerce at lists.netfielders.de...
>>
>>>Hi,
>>>
>>>>"Ingo Schmitt" <mailinglisten at i-schmitt.de> schrieb im Newsbeitrag 
>>>>news:mailman.1.1188203866.22574.typo3-project-commerce at lists.netfielders.de...
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>
>>>>>
>>>>>>hi!
>>>>>>how is it possible to indicate the number of products that are in one 
>>>>>>category, like books (24)?
>>>>>>
>>>>>
>>>>>so a count of active products?
>>>>>
>>>>>You could use
>>>>>tx_commerce_category::get_subproducts  (     )
>>>>>and ocunt the entries. You could easily add this by woud own marker 
>>>>>hook.
>>>>>
>>
>>
>> thanks so far,
>>
>> but could you explain me where to put and how add this hook. and where do 
>> i have to can call the function
>>
>>
>
> Currently we don't have hooks in the navigation. To be honest, I don't 
> think it's easy to add hooks in the navigation, since it's realy complex. 
> If you add more functionality to the navigation, please hav a look at the 
> class.tx_commerce_navigation.php and send me you new thinks as a patch, 
> I'll add this to SVN.

hi,
here is the code  that worked for my needs .
i've added it in class.tx_commerce_navigation.php after line 367 and 
replaced $nodeArray['title'] = $dataRow['title']. i don't know weather if it 
is good coding style, maybe you can improve something and add a switch so 
that the shopadmin can decide to show the number of products or not.

      $sql1 = mysql_query('SELECT count(*) FROM '.$tableSubMain.' WHERE 
deleted = 0 AND categories = '.$row['uid_local'].'');
         $res2 = mysql_fetch_array($sql1);
         $number_of_products = $res2[0];

     $sql2 = mysql_query('SELECT uid_local FROM '.$tableMm.' WHERE 
uid_foreign = '.$row['uid_local'].'');
         while ($res3 = mysql_fetch_array($sql2, MYSQL_NUM)){
          if ($res3){
            $sql3 = mysql_query('SELECT count(*) FROM '.$tableSubMain.' 
WHERE deleted = 0 AND categories = '.$res3[0].'');
            $res4 = mysql_fetch_array($sql3);
            $number_of_products += $res4[0];
          }
         }

         $nodeArray['title'] = $dataRow['title'] . " (" . 
$number_of_products . ")";


> Regards
>
> ingo
>
>>
>> best regards, simon
>>
>>
>>
>>>Mit freundlichen Gruessen
>>>-- 
>>>Ingo Schmitt                        mailto:is at marketing-factory.de
>>>Marketing Factory Consulting GmbH   http://typo3.marketing-factory.de/
>>>Content Management mit Typo3: Beratung - Schulung - Realisierung
>>
>>
>>
>
>
> Mit freundlichen Gruessen
> -- 
> Ingo Schmitt                        mailto:is at marketing-factory.de
> Marketing Factory Consulting GmbH   http://typo3.marketing-factory.de/
> Content Management mit Typo3: Beratung - Schulung - Realisierung 




More information about the TYPO3-project-commerce mailing list