A patch from Anahita Goljahani  for "Duplicated 'ALSO_BOUGHT' associations in product details page" https://issues.apache.org/jira/browse/OFBIZ-5782

I have noticed an undesired behavior when two products are associated by the "ALSO_BOUGHT" association type. 

Specifically, when a product, e.g., Tiny Gizmo (productId  = "GZ-1000"), is associated to another product, e.g., Micro Chrome Widget (productIdTo  = "WG-1111"), by setting productAssocTypeId equal to "ALSO_BOUGHT" in ProductAssoc, the Tiny Gizmo web page in the ecommerce site correctly shows the Micro Chrome Widget as "Customers who bought this item also bought:". Accordingly with the current software behavior, even if Micro Chrome Widget (productId = "WG-1111") was not explicitly  associated to Tiny Gizmo (productIdTo  = "GZ-1000"), also the Micro Chrome Widget web page shows Tiny Gizmo as "Customers who bought this item also bought:",  which may be useful in cases where the 'ALSO_BOUGHT' association is meant to be necessarily bidirectional, i.e., if prodA is associated to prodB, then prodB is associated to prodA and vice-versa. However, when the user wants to express the symmetric nature of the relationship by explicitly associating both Tiny Gizmo to Micro Chrome Widget and Micro Chrome Widget to Tiny Gizmo in ProductAssoc, the system erroneously shows the associated products twice, both in the Tiny Gizmo and Micro Chrome web pages.  

The undesired behavior can be reproduced as follows: 
# Run OFBiz with demo data
# import the following associations from the OFBiz  XML Data Import form
{code}
<ProductAssoc productId="GZ-1000" productIdTo="WG-1111" productAssocTypeId="ALSO_BOUGHT" fromDate="2014-09-02 12:00:00.000"/>
<ProductAssoc productId="WG-1111" productIdTo="GZ-1000" productAssocTypeId="ALSO_BOUGHT" fromDate="2014-09-02 12:00:00.000"/>
{code}
# click on Tiny Gizmo or Micro Chrome Widget from the main page of the ecommerce site. 

The attached patch modifies the above behavior as follows:
- if only "prodA" (productId = "prodA") is associated to "prodB" (productIdTo = "prodB") in ProductAssoc, and not vice-versa, only "prodA" web page shows "prodB" as "Customers who bought this item also bought:".   This means that the 'ALSO_BOUGHT' association type becomes not necessarily bidirectional by default, which is in accordance with most common algorithms for the automatic generation of "WHO BOUGHT X ALSO BOUGHT Y" recommendations that may produce bidirectional associations for some couple of products and not for others, based on conditional probabilities and actual users behavior;  
- in those specific cases in which the association is actually bidirectional for a certain couple of products (prodA, prodB), i.e., both 'prodA to prodB' and 'prodB to prodA' associations are present in ProductAssoc, associated products are shown only ones in prodA and prodB web pages.  

The patch simply sets the value of the parameter "bidirectional" to its default value, i.e., "false", when alsoBoughtProducts are collected by calling getAssociatedProducts() from applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy.  


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1628096 13f79535-47bb-0310-9956-ffa450edef68