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
            Priority: Minor


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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to