[ 
https://issues.apache.org/jira/browse/OFBIZ-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacopo Cappellato closed OFBIZ-1217.
------------------------------------


> 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)

Reply via email to