[TYPO3-commerce] Recursive product list

Dominik Wezel dominik.wezel at datenpark.ch
Fri Sep 14 21:24:05 CEST 2007


Hi List

I was in need of a recursive product list view, so I replaced
*makeListView()* in
typo3conf/ext/commerce/lib/class.tx_commerce_pibase.php with the
attached code (see makeListView.txt attachment), locally of course =;
).  Short summary of what I changed:

   1. The building of the category header, including the part that
      builds the inner product list, was removed from
      *makeListView()**function buildRecursiveCategoryList($cat)* to so
      that it can call itself recursively.
   2. The outermost 'foreach' was left in the makeListView, because that
      level (the product list itself) has no category header.
   3. The category header including its product list re-use the
      /###CATEGORY_LIST###/ subpart recursively; this makes sense for
      both <TABLE>-driven and CSS-driven layouts.  In CSS, cascaded
      "li", "li li", "li li li" styles can be built to set the level
      apart visually.  I chose a definition list instead of an unordered
      list: <dl> for the list, <dt> for the category header and <dd> for
      the product list, which gives me better control over the layout.

The code works for me, and it behaves correctly, too, when I remove or
rename the /###CATEGORY_ITEM_PRODUCTLIST###/ marker.  Commenting it out
however is only successful if nothing in the
/###CATEGORY_ITEMS_LISTVIEW_2###/ subpart is commented out (the closing
inner comment also closes the outer comment and dissipates uncomplete
parts of the recursive buildup --- it is therefore better to just remove
a leading '#' if the recursion is not needed.

If you find this contribution useful, may I please ask someone of the
code maintainers to take it to the correct release/build, because I'm
not really into TYPO3 code management --- even if I have published some
patches in the TYPO3 bug tracker and will probably do so again if need
arises.  Since I'm now using tx_commerce in a commercial application
however, chances are that I will have further contributions.  =; )

-- 

Regards

Dominik Wezel
Consultant

---------------------------------------------

IntellAgent GmbH
on behalf of DATENPARK
Badenerstraße 69, Postfach
CH-8026 Zürich

dominik.wezel at datenpark.ch   www.datenpark.ch

---------------------------------------------


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: makeListView.txt
Url: http://lists.netfielders.de/pipermail/typo3-project-commerce/attachments/20070914/a3ca7c2e/attachment-0001.txt 


More information about the TYPO3-project-commerce mailing list