Author: jleroux
Date: Sun Dec  5 19:09:57 2010
New Revision: 1042411

URL: http://svn.apache.org/viewvc?rev=1042411&view=rev
Log:
A patch from Anne Jessel "Wrong product displayed as associated product" 
(https://issues.apache.org/jira/browse/OFBIZ-4023) - OFBIZ-4023

To reproduce:
    * add two associated products to a main product, both with "Complementary 
or Cross-Sell" association type
    * view the main product in ecommerce

Expected behaviour: the two associated products are listed near the bottom of 
the page
Actual behaviour: two products are listed at the bottom of the page, but only 
one of them is an associated product. The other is the main product.
The problem is caused by the value of a freemarker variable changing at a point 
where other freemarker code assumes the variable does not change. The execution 
path is complicated.
The patch fixes the problem by saving the value of the key variable into 
another variable, and restoring it later. However I do wonder if there is a 
better solution.

JLR: I did not try to find a better solution

Modified:
    
ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl

Modified: 
ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl?rev=1042411&r1=1042410&r2=1042411&view=diff
==============================================================================
--- 
ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl 
(original)
+++ 
ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl 
Sun Dec  5 19:09:57 2010
@@ -762,6 +762,7 @@ ${virtualJavaScript?if_exists}
   </#if>
 <#-- Upgrades/Up-Sell/Cross-Sell -->
   <#macro associated assocProducts beforeName showName afterName 
formNamePrefix targetRequestName>
+  <#assign pageProduct = product />
   <#assign targetRequest = "product" />
   <#if targetRequestName?has_content>
     <#assign targetRequest = targetRequestName />
@@ -791,6 +792,7 @@ ${virtualJavaScript?if_exists}
         ${setRequestAttribute("targetRequestName", targetRequestName)}
       </#if>
           ${screens.render(productsummaryScreen)}
+      <#assign product = pageProduct />
       <#local listIndex = listIndex + 1 />
     </#list>
     </div>


Reply via email to