Home : OpenEdit SDK : Programming OpenEdit : ECommerce Setup : Listing Catalogs
Listing Catalogs
You can change the look of how search results are displayed when a person clicks on a catalog./store/layout/catalogdetails.html - Displays the name of the catalog and text description.
/store/search/results.html - This list rows of thumbnails. The thumbnails are bottom aligned with the text top aligned on the next row.
List of Child Catalogs
To list the children of a catalog add this action to the page that you want to list the catalogs from: /electronics123.xconf:<page>
<page-action name="CartModule.loadCatalog"/>
</page>
By default it will use the name of the file to determine the ID of the catalog you want to load. Otherwise you can set this property:
/index.xconf:
<page>
<page-action name="CartModule.loadCatalog"/>
<property name="catalogid">electronics123</property>
</page>
Listing Children
Once the $catalog variable is available you can use $catalog.name and this syntax to loop over the children:#foreach ( $subcat in $catalog.children )
<nobr><a href="$home/store/catalogs/${subcat.id}.html" >$subcat.name</a></nobr><br>
#end
Selecting Self
Here is an a more complex example of what you can do to build a smart menu tree:xconf:
<page-action name="CartModule.loadCatalog">
<catalogid>rootcatalog</catalogid>
</page-action>
<page-action name="SessionValue.loadSessionVariable" bean="pathutil" class="com.openedit.util.PathUtilities" />
html:
#foreach( $child in $catalog.children )
#set( $on = "/media/${child.id}-on.gif")
#set( $off = "/media/${child.id}-off.gif" )
#set( $thiscatalog = $pathutil.extractPageName($content.path) )
#set( $selected = $child.hasCatalog( $thiscatalog ) )
<a href="/store/catalogs/${child.id}.html" onmouseOver="${catalog.id}.src='$on'"
#if( !$selected ) onmouseOut="${catalog.id}.src='$off'" #end > <img src="#if ( $selected )${on}#else${off}#end" name="$catalog.id" border=0></a><br>
#end
