[ https://issues.apache.org/jira/browse/OFBIZ-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacopo Cappellato resolved OFBIZ-1217. -------------------------------------- Resolution: Fixed Fix Version/s: Release Branch 13.07 Release Branch 12.04 SVN trunk I have commented out the code and added a comment to explain its purpose: see rev 1603741, 1603740, 1603739 > mis-committed code in productdetail.bsh? > ---------------------------------------- > > Key: OFBIZ-1217 > URL: https://issues.apache.org/jira/browse/OFBIZ-1217 > Project: OFBiz > Issue Type: Bug > Components: order > Reporter: Si Chen > Assignee: Jacopo Cappellato > Priority: Minor > Fix For: SVN trunk, Release Branch 12.04, Release Branch 13.07 > > > I just noticed this in productdetail.bsh which looked suspicious: > 1. Why is SYMPTOM hardcoded? > 2. Why does this block not use getAssociatedProducts like the section above it? > Does anybody need this code? If not can I remove it and clean this up? > // get other cross-sell information: product with a common feature > commonProductFeatureId = "SYMPTOM"; > // does this product have that feature? > commonProductFeatureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId, "productFeatureTypeId", commonProductFeatureId), UtilMisc.toList("sequenceNum", "defaultSequenceNum")); > if (commonProductFeatureAndAppls.size() > 0) { > commonProductFeatureIds = EntityUtil.getFieldListFromEntityList(commonProductFeatureAndAppls, "productFeatureId", true); > > // now search for other products that have this feature > visitId = VisitHandler.getVisitId(session); > > productSearchConstraintList = new LinkedList(); > productSearchConstraintList.add(new ProductSearch.FeatureSetConstraint(commonProductFeatureIds)); > // make sure the view allow category is included > productSearchConstraintList = ProductSearchSession.ensureViewAllowConstraint(productSearchConstraintList, currentCatalogId, delegator); > // don't care about the sort on this one > resultSortOrder = null; > commonFeatureResultIdsOrig = ProductSearch.searchProducts(productSearchConstraintList, resultSortOrder, delegator, visitId); > commonFeatureResultIds = new LinkedList(); > commonFeatureResultIdIter = commonFeatureResultIdsOrig.iterator(); > while (commonFeatureResultIdIter.hasNext()) { > commonFeatureResultId = commonFeatureResultIdIter.next(); > // filter out the current product > if (commonFeatureResultId.equals(productId)) { > continue; > } > // filter out all variants > commonProduct = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", commonFeatureResultId)); > if (commonProduct == null || ("Y".equals(commonProduct.getString("isVariant")))) { > continue; > } > commonFeatureResultIds.add(commonFeatureResultId); > } > if (commonFeatureResultIds.size() > 0) { > context.put("commonFeatureResultIds", commonFeatureResultIds); > } > } -- This message was sent by Atlassian JIRA (v6.2#6252) |
Free forum by Nabble | Edit this page |