Update of /var/cvs/contributions/natmm/templates/nmintra/includes/shoppingcart In directory james.mmbase.org:/tmp/cvs-serv16647/templates/nmintra/includes/shoppingcart
Modified Files: result.jsp response.jsp Log Message: NMCMS-310 See also: http://cvs.mmbase.org/viewcvs/contributions/natmm/templates/nmintra/includes/shoppingcart See also: http://www.mmbase.org/jira/browse/NMCMS-310 Index: result.jsp =================================================================== RCS file: /var/cvs/contributions/natmm/templates/nmintra/includes/shoppingcart/result.jsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- result.jsp 26 Sep 2006 21:06:37 -0000 1.4 +++ result.jsp 13 May 2008 10:11:28 -0000 1.5 @@ -40,9 +40,10 @@ String warningLink = "Terug naar het formulier"; boolean isValidAnswer = true; - String clientEmail = ""; // *** see shoppingcartresponse.jsp + StringBuffer clientEmail = new StringBuffer(); // *** see shoppingcartresponse.jsp String clientDept = ""; // *** see shoppingcartresponse.jsp TreeMap responses = new TreeMap(); // *** treemap with response text for every shop item ordered *** + TreeMap shopItemPrices = new TreeMap(); // *** treemap with price for every shop item ordered *** TreeMap emails = new TreeMap(); // *** treemap with email address for every shop item ordered *** TreeMap product_groups = new TreeMap(); // *** treemap with product group for every shop item ordered *** // *** example: @@ -140,17 +141,19 @@ if(shopItems.hasNext()) { String responseText = ""; + int totalPrice = 0; while(shopItems.hasNext()) { - responseText += responses.get(shopItems.next()); + String currentShopItem = (String)shopItems.next(); + responseText += responses.get(currentShopItem); + totalPrice = totalPrice + ((Integer)shopItemPrices.get(currentShopItem)).intValue(); } - %><mm:node referid="productorder_email" ><mm:setfield name="subject"><%= emailSubject + orderId %></mm:setfield ><mm:setfield name="body"> <multipart id="plaintext" type="text/plain" encoding="UTF-8"> </multipart> <multipart id="htmltext" alt="plaintext" type="text/html" encoding="UTF-8"> - <%= "<html>" + responseText + "</html>" %> + <%= "<html>" + responseText + "<br/><b>Totaal prijs: € " + nf.format(((double) totalPrice )/100) + "</b>\n</html>" %> </multipart> </mm:setfield ><mm:setfield name="to"><%= (debug ? debugEmail : thisEmail ) %></mm:setfield @@ -168,12 +171,12 @@ </multipart> <multipart id="htmltext" alt="plaintext" type="text/html" encoding="UTF-8"> <%= "<html>Uw onderstaande bestelling heeft als ordernummer " + orderId + " en is verstuurd naar " + thisEmail + "<br><br>" - + responseText + "</html>" %> + + responseText + "<br/><b>Totaal prijs: € " + nf.format(((double) totalPrice )/100) + "</b>\n</html>" %> </multipart> </mm:setfield> </mm:node><% - String cEmails = clientEmail + ";"; + String cEmails = clientEmail.toString() + ";"; int semicolon = cEmails.indexOf(";"); while(semicolon>-1) { String emailAddress = cEmails.substring(0,semicolon).trim(); Index: response.jsp =================================================================== RCS file: /var/cvs/contributions/natmm/templates/nmintra/includes/shoppingcart/response.jsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- response.jsp 21 Nov 2007 13:15:06 -0000 1.4 +++ response.jsp 13 May 2008 10:11:28 -0000 1.5 @@ -25,6 +25,7 @@ } %><% String responseText = ""; +Integer shopItemPrice = null; String thisForm = null; %><mm:node number="<%= thisShop_item %>" ><mm:relatednodes type="pagina" max="1" jspvar="thisPage" @@ -61,10 +62,17 @@ %></mm:notpresent ></mm:isempty ></mm:field - ><mm:field name="titel" jspvar="dummy" vartype="String" write="false"><% - responseText += "<b>" + numberOfItems + " x " + dummy + "</b><br>\n"; - %></mm:field - ><mm:related path="posrel,formulier" orderby="formulier.pos" directions="UP" searchdir="destination" + > + <mm:field name="price1" jspvar="price" vartype="Integer" write="false"> + <% shopItemPrice = price;%> + </mm:field> + + <mm:field name="titel" jspvar="dummy" vartype="String" write="false"><% + responseText += "<b>" + numberOfItems + " x " + dummy + " รก € " + nf.format(((double) shopItemPrice.intValue() )/100) + "</b><br>\n"; + shopItemPrice = new Integer(Integer.valueOf(numberOfItems).intValue() * shopItemPrice.intValue()); + %></mm:field> + + <mm:related path="posrel,formulier" orderby="formulier.pos" directions="UP" searchdir="destination" ><mm:node element="formulier" jspvar="form"> <% thisForm = form.getStringValue("number"); @@ -155,7 +163,19 @@ // *** check whether this question provides the client email address *** // *** the object cloud has to contain a question with alias client_email *** %><mm:list nodes="client_email" path="formulierveld" constraints="<%= "formulierveld.number=" + questions_number %>"><% - clientEmail = answerValue; + clientEmail.append(answerValue); + %></mm:list> + <mm:list nodes="client_email2" path="formulierveld" constraints="<%= "formulierveld.number=" + questions_number %>"><% + clientEmail.append(";" + answerValue); + %></mm:list> + <mm:list nodes="client_email3" path="formulierveld" constraints="<%= "formulierveld.number=" + questions_number %>"><% + clientEmail.append(";" + answerValue); + %></mm:list> + <mm:list nodes="client_email4" path="formulierveld" constraints="<%= "formulierveld.number=" + questions_number %>"><% + clientEmail.append(";" + answerValue); + %></mm:list> + <mm:list nodes="client_email5" path="formulierveld" constraints="<%= "formulierveld.number=" + questions_number %>"><% + clientEmail.append(";" + answerValue); %></mm:list><% // *** check whether this question provides the client email address *** @@ -170,7 +190,9 @@ ></mm:related><% } - %></mm:node + %> + </mm:node ></mm:related><% responses.put(thisShop_item, responseText); +shopItemPrices.put(thisShop_item, shopItemPrice); %></mm:node> _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs