Author: jleroux
Date: Sat Sep 24 08:28:29 2011 New Revision: 1175127 URL: http://svn.apache.org/viewvc?rev=1175127&view=rev Log: A patch from Kiran Gawde "breadcrumbs.ftl code is not efficient" https://issues.apache.org/jira/browse/OFBIZ-4410 breadcrumbs.ftl recuses all the categories to show the correct breadcrumbs. Instead it should iterate over values from trail. Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl?rev=1175127&r1=1175126&r2=1175127&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl Sat Sep 24 08:28:29 2011 @@ -16,52 +16,32 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> -<#-- variable setup and worker calls --> -<#assign topLevelList = requestAttributes.topLevelList?if_exists> -<#assign curCategoryId = requestAttributes.curCategoryId?if_exists> - -<#-- looping macro --> -<#macro categoryList parentCategory category> - <#if parentCategory.productCategoryId != category.productCategoryId> - <#local previousCategoryId = parentCategory.productCategoryId /> - </#if> - - <#if (Static["org.ofbiz.product.category.CategoryWorker"].checkTrailItem(request, category.getString("productCategoryId"))) || (curCategoryId?exists && curCategoryId == category.productCategoryId)> - <li> - <#if catContentWrappers?exists && catContentWrappers[category.productCategoryId]?exists> - <a href="<@ofbizCatalogAltUrl productCategoryId=category.productCategoryId previousCategoryId=previousCategoryId!""/>" class="<#if curCategoryId?exists && curCategoryId == category.productCategoryId>buttontextdisabled<#else>linktext</#if>"> - <#if catContentWrappers[category.productCategoryId].get("CATEGORY_NAME")?exists> - ${catContentWrappers[category.productCategoryId].get("CATEGORY_NAME")} - <#elseif catContentWrappers[category.productCategoryId].get("DESCRIPTION")?exists> - ${catContentWrappers[category.productCategoryId].get("DESCRIPTION")} - <#else> - ${category.description?if_exists} - </#if> - </a> - </#if> - </li> - <#local subCatList = Static["org.ofbiz.product.category.CategoryWorker"].getRelatedCategoriesRet(request, "subCatList", category.getString("productCategoryId"), true)> - <#if subCatList?exists> - <#list subCatList as subCat> - <@categoryList parentCategory=category category=subCat/> - </#list> - </#if> - </#if> -</#macro> - <div class="breadcrumbs"> <ul> <li> - <a href="<@ofbizUrl>main</@ofbizUrl>" class="linktext">${uiLabelMap.CommonMain}</a> + <a href="<@ofbizUrl>main</@ofbizUrl>" class="linktext">${uiLabelMap.CommonMain}</a> > </li> <#-- Show the category branch --> - <#list topLevelList as category> - <@categoryList parentCategory=category category=category/> - </#list> + <#assign crumbs = Static["org.ofbiz.product.category.CategoryWorker"].getTrail(request)/> + <#list crumbs as crumb> + <#if catContentWrappers?exists && catContentWrappers[crumb]?exists> + <li> + <a href="<@ofbizCatalogUrl currentCategoryId=crumb previousCategoryId=previousCategoryId!""/>" class="<#if crumb_has_next>linktext<#else>buttontextdisabled</#if>"> + <#if catContentWrappers[crumb].get("CATEGORY_NAME")?exists> + ${catContentWrappers[crumb].get("CATEGORY_NAME")} + <#elseif catContentWrappers[crumb].get("DESCRIPTION")?exists> + ${catContentWrappers[crumb].get("DESCRIPTION")} + <#else> + ${crumb} + </#if> + </a> + </li> + <#assign previousCategoryId = crumb /> + </#if> + </#list> <#-- Show the product, if there is one --> <#if productContentWrapper?exists> <li>${productContentWrapper.get("PRODUCT_NAME")?if_exists}</li> </#if> - </ul> + </ul> </div> -<br /> |
Free forum by Nabble | Edit this page |