2016-08-03 16 views
0

先月ColdFusionの問題を解決するために費やしたことがあります...私は5 cfmのファイルを持っています。これらは私が持っている次の問題です: ShoppingCart.cfm:テーブルは同じフォーマットのままではなくカスケード接続しています。 revieworder.cfm:customerinfo.cfmページのcustomerinfoが表示されません。 OrderConfirmation.cfm:顧客に請求書のコピーを送付していない...率直に言って、すべてがうまくいかず、私はセッションと何か関係があると感じています:application.cfmファイル。もし誰かが私をこれらのものに導くのを助けたら、私はそれを大いに感謝します!!ColdFusionショッピングカートが機能しない

のApplication.cfc

<cfcomponent> 
 
    <cfset this.name = "mmd24shoppingcart"> 
 
    <cfset this.datasource = "mmd24_shoppingcart"> 
 
    <cfset this.sessionmanagement="Yes"> 
 
    <cfset this.sessiontimeout="#createtimespan(0,0,45,0)#"> 
 
    <cfset This.applicationtimeout="#createtimespan(5,0,0,0)#"> 
 
    <cffunction name = "onApplicationStart"> 
 
    
 
    <cfscript> 
 
     Application.availableResources=0; 
 
     Application.counter1=1; 
 
     Application.sessions=0; 
 
    </cfscript> 
 
    </cffunction> 
 
    <cffunction name="onSessionStart"> 
 
    <cfscript> 
 
     Session.started = now(); 
 
     Session.shoppingCart = Structnew(); 
 
     Session.shoppingCart.items =0; 
 
    </cfscript> 
 
    </cffunction> 
 

 
    </cfcomponent>

shoppingcart.cfm

<!doctype html> 
 
    <htmllang="en"> 
 

 
    <meta charset="utf-8"> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 

 
    <head> 
 
    <cfparam name="url.productid" default=""> 
 
    <cfparam name="url.qty" default=""> 
 

 
    </head> 
 

 
    <title>shoppingcart</title> 
 

 
    <body> 
 
    <div class="container"> 
 
     <h3><center>Shopping Cart</center></h3>    
 
     
 
     <cfquery name = "getlist" datasource="mmd24_shoppingcart"> 
 
      SELECT * 
 
      FROM Products 
 
      WHERE Products.productID = <cfqueryparam 
 
    cfsqltype="cf_sql_integer" value="#url.productid#"> 
 
     </cfquery> 
 

 
    <cflock scope="session" timeout="10"> 
 

 
        <cfset addNew = true> 
 

 
        <cfif not isDefined("session.cart")> 
 

 
         <cfset session.cart = arrayNew(1)> 
 

 
        <cfelse> 
 

 
         <cfloop index="i" from="1" 
 
    to="#arrayLen(session.cart)#"> 
 

 
          <cfif URL.productid is session.cart[i].productId> 
 

 
           <cfset session.cart[i].productQty = 
 
    session.cart[i].productQty + 1> 
 

 
           <cfset addNew = false> 
 
          </cfif> 
 
         </cfloop> 
 

 
        </cfif> 
 

 
        <cfif addNew is true> 
 

 
         <cfset newItem=StructNew()> 
 

 
         <cfset newItem.productId = URL.productid> 
 

 
         <cfset newItem.productName = getlist.ProductName> 
 

 
         <cfset newItem.productPrice = getlist.ProductPrice> 
 

 
         <cfset newItem.productDescription = 
 
    getlist.ProductDescription> 
 

 
         <cfset newItem.productQty = URL.qty> 
 

 
         <cfset newItem.productPhoto = getlist.ProductPhoto> 
 

 
         <cfset ArrayAppend(session.cart, newItem)> 
 

 
        </cfif>   
 
\t \t 
 
\t \t <cfset TotalOrderAmount = 0> 
 
\t \t <cfset TotalItemAmount = 0> 
 
\t \t <cfset TotalTax = 0> 
 
\t \t <cfset counterhi = 0> 
 
    </cflock> 
 

 
    <cfoutput query ="getlist"> 
 

 
    <cflock scope="session" type="readonly" timeout="10"> 
 
     
 
    <cfloop index="i" from="1" to="#arrayLen(session.cart)#"> 
 

 
    <table class = "table table-bordered"> 
 
\t <thead> 
 
    \t <tr> 
 
      <th>Product Photo</th> 
 
      <th>Product Name</th> 
 
      <th>Product Description</th> 
 
      <th>Quantity Ordered</th> 
 
      <th>Product Price</th> 
 
      </th> 
 
\t </thead> 
 
    
 
    <tbody> 
 
      <tr> 
 
     <td><img src="#session.cart[i].ProductPhoto#"></td> 
 
    \t \t <td>#session.cart[i].ProductName#</td> 
 
    \t \t <td>#session.cart[i].ProductDescription#</td> 
 
     <td>#session.cart[i].ProductQty#</td> 
 
    \t \t <td>#DollarFormat(session.cart[i].ProductPrice)#</td> 
 
     </tr> 
 
    </tbody> 
 

 
    <table class = "table"> 
 
\t <cfset Itemtotal = #getlist.productprice# * 
 
    #session.cart[i].ProductQty#> 
 
\t \t <cfset OrderTotal = #Itemtotal#> 
 
\t \t <cfset Tax = #OrderTotal# * "0.08"> 
 
\t \t <cfset TotalOrderAmount = #OrderTotal# + #Tax# + #TotalOrderAmount#> 
 
\t \t <cfset TotalItemAmount = #Itemtotal# + #TotalItemAmount#> 
 
\t \t <cfset TotalTax = #Tax# + #TotalTax#> 
 
\t <tr> 
 
    \t <td class="col-lg-9 text-right">Subtotal</td>    
 
     <td class="text - left">#DollarFormat(itemTotal)#</td> 
 
    </tr> 
 
    
 
    \t <tr>    
 
     \t <td class="col-lg-9 text-right">Tax(8%)</td> 
 
     <td>#DollarFormat(Tax)#</td> 
 
    
 
    </tr> 
 
    \t <tr>    
 
     \t <td class="col-lg-9 text-right">Order Total</td> 
 
     <td>#DollarFormat(TotalOrderAmount)# 
 
     <br> 
 
     <br> 
 
     
 
    </cfloop> 
 
    </cflock>  
 
    </cfoutput> 
 
     
 
     <a input type="submit" name="submit" href="customerinfo.cfm" 
 
    class="btn btn-primary" role="button">Proceed to Checkout</a> 
 
     <br> 
 
     </br> 
 
     <a input type="submit" name="submit" href="productlist.cfm" 
 
    class="btn btn-primary" role="button">Continue Shopping</a> 
 
     
 
     </td> 
 
      </tr>    
 
    </tbody> 
 

 
      </div> 
 
    
 
    <script src="js/bootstrap.js"></script> 
 

 
    </body> 
 
    </html>

customerinfo.cfm

<!DOCTYPE HTML> 
 
    <html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>Customer Info</title> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <meta name="description" content=""> 
 
    <meta name="author" content="Html5TemplatesDreamweaver.com"> 
 

 
    <link href="scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet"> 
 
    <link href="scripts/bootstrap/css/bootstrap-responsive.min.css" 
 
    rel="stylesheet">  
 
    <script src="js/jquery.js"></script> 
 
\t <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
 
    \t 
 
    </head> 
 
    <body id="pageBody"> 
 
    </script> 
 

 
     
 
    <table border="3" style="background-color:#FFFFFF;border- 
 
    collapse:collapse; 
 
\t \t border:3px solid #0033FF;color:#000000;"> 
 
     
 
    <tr> 
 
\t \t <td>   
 
      <div id="divHeaderLine1">Billing Address</div> 
 
      <br> 
 
\t \t <label for="bFirstName"><font color="red">*</font>First Name</label> 
 
\t \t \t \t  <input type="text" size="20" required="" 
 
    name="bFirstName" id="bFirstName"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="bLastName"><font color="red">*</font>Last Name</label> 
 
\t \t \t \t  <input type="text" size="20" required="" 
 
    name="bLastName"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="bAddress"><font color="red">*</font>Address</label> 
 
\t \t \t \t  <input type="text" size="20" required="" name="bAddress"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="bCity"><font color="red">*</font>City</label> 
 
\t \t \t \t  <input type="text" size="20" required="" name="bCity"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="bState"><font color="red">*</font>State</label> 
 
\t \t \t \t  <select name="bState" size=”4”> 
 
\t \t \t \t \t <option value="" selected></option> 
 
\t \t \t \t \t <option value="GA">Georgia</option> 
 
\t \t \t \t \t <option value="FL">Florida</option> 
 
\t \t \t \t \t <option value="AL">Alabama</option> 
 
\t \t \t \t \t <option value="TX">Texas</option> 
 
\t \t \t \t \t <option value="MS">Mississippi</option> 
 
\t \t \t \t \t <option value="LA">Louisiana</option> 
 
\t \t \t \t \t </select> 
 
\t \t \t \t  <br> 
 
\t \t <label for="bZip"><font color="red">*</font>Zip Code</label> 
 
\t \t \t \t  <input type="text" size="20" required="" name="bZip"> 
 
\t \t \t \t  <br> 
 
\t \t <label for"bEmail"><font color="red">*</font>Email Address</label> 
 
\t \t \t \t  <input type="text" size="20" name="bEmail"> 
 
    </td> 
 

 
    <td>     
 
    <div id="divHeaderLine1">Shipping Address</div> 
 
    <br> 
 
    </br> 
 
    <input type="checkbox" name="billingtoo" 
 
    onclick="FillBilling(this.form)">Same as billing 
 
    <br> 
 
    <br> 
 
    
 
    <label for="sFirstName"><font color="red">*</font>First Name</label> 
 
\t <input type="text" size="20" name="sFirstName"> 
 
\t \t \t \t  
 
\t \t <label for="sLastName"><font color="red">*</font>Last Name</label> 
 
\t \t \t \t  <input type="text" size="20" name="sLastName"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="sAddress"><font color="red">*</font>Address</label> 
 
\t \t \t \t  <input type="text" size="20" name="sAddress"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="sCity"><font color="red">*</font>City</label> 
 
\t \t \t \t  <input type="text" size="20" name="sCity"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="sState"><font color="red">*</font>State</label> 
 
\t \t \t \t  <select name="sState" size=”4”> 
 
\t \t \t \t \t <option value="" selected></option> 
 
\t \t \t \t \t <option value="GA">Georgia</option> 
 
\t \t \t \t \t <option value="FL">Florida</option> 
 
\t \t \t \t \t <option value="AL">Alabama</option> 
 
\t \t \t \t \t <option value="TX">Texas</option> 
 
\t \t \t \t \t <option value="MS">Mississippi</option> 
 
\t \t \t \t \t <option value="LA">Louisiana</option> 
 
\t \t \t \t \t </select> 
 
\t \t \t \t  <br> 
 
\t \t <label for="sZip"><font color="red">*</font>Zip Code</label> 
 
\t \t \t \t  <input type="text" size="20" name="sZip"> 
 
\t \t \t \t  <br> 
 
\t \t <label for="sEmail"><font color="red">*</font>Email Address</label> 
 
\t \t \t \t  <input type="text" size="20" name="sEmail"> 
 
    <br/> 
 
    
 
    </td> 
 
\t </tr> 
 
    
 
\t <tr> 
 
\t <td>  
 
    <div id="divHeaderLine1">Shipping Method</div> 
 
    \t \t \t <br> 
 
       </br> 
 
\t \t \t \t <input class="validate[required] checkbox" type="checkbox" 
 
    name="Shipping" value="OverNight"> Over Night <br/> 
 
\t \t \t \t <input class="validate[required] checkbox" type="checkbox" 
 
    name="Shipping" value="OneDay"> One Day <br/> 
 
\t \t \t \t <input class="validate[required] checkbox" type="checkbox" 
 
    name="Shipping" value="TwoDay" checked> Two Day <br/> 
 
       
 
       <br> 
 
    </td> 
 
    
 
    <td> 
 
    <div id="divHeaderLine1">Payment Details</div> 
 
    <br> 
 
    <br> 
 
       <celect class="cc-ddl-type"> 
 
\t \t \t \t <input class="validate[required] radio" type="radio" 
 
    name="CC" value="Visa" checked> Visa <br/> 
 
\t \t \t \t <input class="validate[required] radio" type="radio" 
 
    name="CC" value="Master"> Master <br/> 
 
\t \t \t \t <input class="validate[required] radio" type="radio" 
 
    name="CC" value="Discover"> Discover <br/> 
 
       <br><label><font color="red">*</font> Card Number </label> 
 
    \t \t \t \t <input value="" class="ccNumber" type="text" required=""> 
 
       <br> 
 
    \t 
 
    <label>Expires on:</label> 
 
       \t \t <select name="ccMonth" class="validate[required]"> 
 
        <option value="January">January</option> 
 
        <option 
 
    value="February">February</option> 
 
              <option 
 
    value="March">March</option> 
 
              <option  
 
    value="April">April</option> 
 
              <option value="May">May</option> 
 
              <option  
 
    value="June">June</option> 
 
              <option 
 
    value="July">July</option> 
 
              <option 
 
    value="August">August</option> 
 
              <option 
 
    value="September">September</option> 
 
              <option 
 
    value="October">October</option> 
 
              <option 
 
    value="November">November</option> 
 
              <option 
 
    value="December">December</option> 
 
             </select> 
 
\t \t <br/> 
 
             <select name="ccYear" 
 
    class="validate[required]"> 
 
              <option 
 
    value="2011">2016</option> 
 
              <option 
 
    value="2012">2017</option> 
 
              <option 
 
    value="2013">2018</option> 
 
              <option 
 
    value="2014">2019</option> 
 
              <option 
 
    value="2015">2020</option> 
 
             </select> 
 
        
 
    </td> 
 
    </tr> 
 

 

 
       <br/> 
 
       <br> 
 
    <tr> 
 
    \t <td colspan="2" style="text-align: center; vertical-align: middle;"> 
 
    <a input type="submit" href="revieworder.cfm" class="btn btn-primary" 
 
    role="button">Review Order</a>    
 
    </td> 
 
    </tr> 
 
    
 
    </table> 
 
       
 
    </form>  
 
    <script src="scripts/jquery.min.js" type="text/javascript"></script> 
 
    <script src="scripts/bootstrap/js/bootstrap.min.js" 
 
    type="text/javascript"></script> 
 
    <script src="scripts/default.js" type="text/javascript"></script> 
 

 
    </body> 
 
    </html>

revieworder.cfm

<!DOCTYPE HTML> 
 
    <html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>revieworder</title> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
 
    <meta name="description" content=""> 
 
    <meta name="author" content=""> 
 

 
    <link href="scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet"> 
 
    <link href="scripts/bootstrap/css/bootstrap-responsive.min.css" 
 
    rel="stylesheet"> 
 

 
    <cfparam name="form.bFirstName" default=""> 
 
    <cfparam name="form.bLastName" default=""> 
 
    <cfparam name="form.bAddress" default=""> 
 
    <cfparam name="form.bCity" default=""> 
 
    <cfparam name="form.bState" default=""> 
 
    <cfparam name="form.bZip" default=""> 
 
    <cfparam name="form.bEmail" default=""> 
 

 
    <cfparam name="form.sFirstName" default=""> 
 
    <cfparam name="form.sLastName" default=""> 
 
    <cfparam name="form.sAddress" default=""> 
 
    <cfparam name="form.sCity" default=""> 
 
    <cfparam name="form.sState" default=""> 
 
    <cfparam name="form.sZip" default=""> 
 
    <cfparam name="form.sEmail" default=""> 
 

 
    <cfparam name="form.ccNumber" default=""> 
 
    <cfparam name="form.ccMonth" default=""> 
 
    <cfparam name="form.ccYear" default=""> 
 
    <cfparam name="form.shipping" default=""> 
 
    <cfparam name="form.CC" default=""> 
 

 
    <cfset TotalOrderAmount = 0> 
 
    <cfset TotalItemAmount = 0> 
 
    <cfset TotalTax = 0> 
 
    <cfset ShippingTotal = 0> 
 

 
    </head> 
 
    <body id="pageBody"> 
 
    <form action="OrderConfirmation.cfm" method="post"> 
 
    <table border="1" width="100%" align="center"> 
 
    <thead> 
 
    <tr> 
 
    <cfoutput> 
 
\t \t \t <td width="20%"> 
 
\t \t \t Product Photo</td> 
 
\t \t \t <td width="20%"> 
 
\t \t \t Product Name</td> 
 
\t \t \t <td width="20%"> 
 
\t \t \t UnitPrice</td> 
 
\t \t \t <td width="20%"> 
 
\t \t \t Quantity Ordered</td> 
 
\t \t \t <td width="20%"> 
 
\t \t \t Total Cost</td> 
 
\t \t \t </td> 
 
\t \t \t </tr> 
 
\t <tr> 
 
\t \t \t 
 
\t \t \t <cflock scope="session" type="readonly" timeout="5"> 
 
\t \t \t <cfparam name="session.cart" default="#ArrayNew(1)#"> 
 
\t \t \t <cfset cart = ArrayLen(session.cart)> 
 
\t \t \t <cfset total = 0> 
 
\t \t \t <cfloop index="i" from="1" to="#cart#"> 
 
\t \t \t <td width="20%"> 
 
      
 
\t \t \t \t \t <cfset Itemtotal = #session.cart[i].ProductPrice# *  
 
    #session.cart[i].ProductQty#> 
 
\t \t \t \t \t <cfset OrderTotal = #session.cart[i].ProductPrice#> 
 
\t \t \t \t \t <cfset Tax = #OrderTotal# * "0.08"> 
 
\t \t \t \t \t <cfset TotalOrderAmount = #OrderTotal# + #Tax# +  
 
    #TotalItemAmount#> 
 
\t \t \t \t \t <cfset TotalItemAmount = #Itemtotal# > 
 
\t \t \t \t \t <cfset TotalTax = #Tax# + #TotalTax#> 
 
        <cfif #Shipping# is "Ground"> 
 
\t \t \t \t \t <cfset ShippingTotal = .01 * #TotalOrderAmount#> 
 
\t \t \t \t \t </cfif> 
 
\t \t \t \t \t <cfif #Shipping# is "Air"> 
 
    \t \t \t \t \t <cfset ShippingTotal = .02 * #TotalOrderAmount#> 
 
    \t \t \t \t \t </cfif> 
 
    \t \t \t \t \t <cfif #Shipping# is "Overnight"> 
 
    \t \t \t \t \t <cfset ShippingTotal = .03 * #TotalOrderAmount#> 
 
    \t \t \t \t \t </cfif>     
 
\t \t 
 
\t \t \t <tr> 
 
    \t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t <img src="#session.cart[i].ProductPhoto#"></b></td> 
 
\t \t \t \t <td colspan="1"><b> 
 
\t \t \t \t \t #session.cart[i].ProductName#</b></td> \t 
 
    \t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t #session.cart[i].ProductPrice#</b></td> 
 
    \t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t #session.cart[i].ProductQty#</b></td> 
 
\t \t \t \t <td colspan="1"><b> 
 
\t \t \t \t \t #session.cart[i].ProductPrice#</b></td> 
 
    \t \t \t </tr> 
 
    \t \t \t </cfloop> 
 
\t \t \t </cflock> 
 
\t </tr> 
 
\t <td colspan="4"><b> 
 
\t \t \t Order Amount</b></td> 
 
\t <td colspan="1"><b> 
 
\t \t \t <center>#DollarFormat(TotalItemAmount)#</center></td> \t \t \t 
 
\t </tr> 
 
\t <tr> 
 
\t <td colspan="4"><b> 
 
    \t \t \t Tax</b></td> 
 
\t <td colspan="1"><b> 
 
    \t \t \t <center>#DollarFormat(TotalTax)#</center></td> \t \t 
 
\t </tr> 
 
\t <tr> 
 
\t <td colspan="4"><b> 
 
    \t \t \t Shipping Cost </b></td> 
 
\t <td colspan="1"><b> 
 
\t \t \t <center>#DollarFormat(ShippingTotal)#</center></td> \t \t 
 
\t </tr> 
 
\t <tr> 
 
\t <td colspan="4"><b> 
 
    \t \t \t Order Total</b></td> 
 
\t <td colspan="1"><b> 
 
\t \t \t <cfset TotalOrderAmount = + #TotalOrderAmount#> 
 
    \t \t \t <center>#DollarFormat(TotalOrderAmount)#</center></td> \t \t 
 
\t </tr> 
 
\t </cfoutput> 
 
\t </thead> 
 
\t </table> 
 
    
 
     <div id="divHeaderText" class="page-content">  
 
    <div id="divHeaderLine1">Your Address and Payment Details</div> 
 
\t \t \t \t \t </br> 
 
        
 
    <table border="1" width="75%" align="center"> 
 
\t <tr> 
 
    <cfoutput> 
 
     \t 
 
\t \t \t <td><b>Billing Address:</td></b> 
 
\t \t \t <td width="80%"> 
 
    \t \t \t #Form.bFirstName# #Form.bLastName#<br> 
 
\t \t \t #Form.bAddress# <br> 
 
    \t \t \t #Form.bCity#, #Form.bState# #Form.bZip#<br> 
 
    \t \t \t <strong>Email: </strong>#Form.bEmail#<br></td> 
 
\t \t \t </tr> 
 
\t \t \t <tr> 
 
\t \t \t <td><b>Shipping Address:</b></td> 
 
\t \t \t <td> 
 
    \t \t \t #form.sFirstName# #form.sLastName# <br> 
 
    \t \t \t #form.sAddress#<br> 
 
    \t \t \t #form.sCity#, #form.sState# #form.sZip#<br> 
 
\t \t \t <b>Email: </b>#form.sEmail#<br> 
 
\t \t \t </td> 
 
    \t \t \t </tr> 
 
    \t \t \t <tr> 
 
\t \t \t <td><b>Payment Type:</td> </b><br><td> 
 
\t \t \t #form.CC# Credit Card Number: #REReplace(form.ccNumber," 
 
      [0-9](?=.*.{4})", "*", "all")# <br> 
 
\t \t \t <tr> 
 
\t \t \t <td> 
 
\t \t \t <b>Exp Date: </b></td><td>#form.ccMonth# /#form.ccYear# 
 
\t \t \t </td> 
 
    \t \t \t </td> 
 
\t \t \t </tr> 
 
     </cfoutput> 
 
\t  </thead> 
 
\t  </table> 
 
     
 

 
\t <br><br><br><br> 
 
    <input type="hidden" name="Email" value="<cfoutput>#form.bEmail# 
 
    </cfoutput>"/> 
 
\t <input type="hidden" name="ShippingA" value="<cfoutput>#ShippingTotal# 
 
    </cfoutput>"/> 
 
\t <input type="hidden" name="OrderA" value="<cfoutput>#TotalOrderAmount# 
 
    </cfoutput>"/> 
 
\t <input type="hidden" name="ItemA" value="<cfoutput>#TotalItemAmount# 
 
    </cfoutput>"/> 
 
\t <input type="hidden" name="TaxA" value="<cfoutput>#TotalTax# 
 
    </cfoutput>"/> 
 
\t <input type="hidden" name="Address" value="<cfoutput>#form.bAddress# 
 
    </cfoutput>"/> 
 
\t <input type="hidden" name="Shipping" value="<cfoutput>#form.Shipping# 
 
    </cfoutput>"/> \t 
 
\t <a input type="submit" value="submit" href="OrderConfirmation.cfm" 
 
    class="btn btn-primary" role="button">Confirm Order</a> 
 

 
\t </form> 
 
    </body> 
 
    </html>

注文Confirmation.cfm(すべてがすべて台無しにした場合、これはある)

<!DOCTYPE HTML> 
 
    <html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>Order Confirmation</title> 
 
    <cfparam name="form.email" default="VOID"> 
 
    <cfparam name="form.Shipping" default=""> 
 
    <cfparam name="form.address" default=""> 
 
    <cfparam name="form.ShippingA" default="0"> 
 
    <cfparam name="form.OrderA" default="0"> 
 
    <cfparam name="form.ItemA" default="0"> 
 
    <cfparam name="form.TaxA" default="0"> 
 

 
    Email Confirmation 
 
    <cfmail from="[email protected]" to="#form.email#" subject="Your 
 
    Order Confirmation" type="html"> 
 
    <html>   
 
    <head></head>   
 
    <body>     
 
    <cfset r = randomize(7, "SHA1PRNG")> 
 
    <cfset Int = 10000 /> 
 
    <cfset Int2 = 80000 /> 
 
    <cfoutput> 
 
    Thank you for your Order #session.customerform.BfirstName#  
 
    #session.customerform.BlastName#</br> 
 
    Your order numer is #randRange(Int, Int2, "SHA1PRNG")# </br> 
 
    <cfif #session.customerform.Shipping# is "OverNight"> 
 
\t \t \t \t \t Your order will arive in 12 Hours since you opted 
 
    for Over Night shipping 
 
    \t \t \t \t \t </cfif> 
 
\t \t \t \t \t <cfif #session.customerform.Shipping# is "OneDay"> 
 
\t \t \t \t \t Your order will arive in 1 day since you opted for One 
 
     Day shipping 
 
\t \t \t \t \t </cfif> 
 
    \t \t \t \t \t <cfif #session.customerform.Shipping# is "TwoDay"> 
 
\t \t \t \t \t Your order will arive in 2 days since you opted for 
 
     Two Day shipping 
 
\t \t \t \t \t </cfif></br> 
 
    Your order will be shipped to the following address: 
 
    #session.customerform.address# 
 

 
    <table border="1" width="100%" align="center"> 
 
    <thead> 
 
    <tr> 
 
\t <th colspan="5"> 
 
    \t \t Your Order Details 
 
\t </th> 
 
\t </tr> 
 
\t <tr> 
 
    <cfoutput> 
 
\t \t \t <td width="20%"> 
 
    \t \t \t Product Photo</td> 
 
    \t \t \t <td width="20%"> 
 
    \t \t \t Product Name</td> 
 
    \t \t \t <td width="20%"> 
 
    \t \t \t UnitPrice</td> 
 
    \t \t \t <td width="20%"> 
 
    \t \t \t Quantity Ordered</td> 
 
\t \t \t <td width="20%"> 
 
    \t \t \t Total Cost</td> 
 
\t \t \t </td> 
 
    \t \t \t </tr> 
 
\t  <tr> 
 
\t \t \t 
 
\t \t \t <cflock scope="session" type="readonly" timeout="5"> 
 
    \t \t \t <cfparam name="session.cart" default="#ArrayNew(1)#"> 
 
    \t \t \t <cfset cart = ArrayLen(session.cart)> 
 
    \t \t \t <cfset total = 0> 
 
    \t \t \t <cfloop index="i" from="1" to="#cartSize#"> 
 
    \t \t \t <td width="20%"> 
 
\t \t \t <tr> 
 
    \t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t <img src="#session.cart[i].ProductPhoto#"></b></td> 
 
\t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t #session.cart[i].ProductName#</b></td> \t 
 
\t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t #session.cart[i].ProductPrice#</b></td> 
 
\t \t \t \t <td colspan="1"><b> 
 
\t \t \t \t \t #session.cart[i].ProductQTY#</b></td> 
 
    \t \t \t \t <td colspan="1"><b> 
 
    \t \t \t \t \t #session.cart[i].ProductPrice#</b></td> 
 
    \t \t \t </tr> 
 
    \t \t \t </cfloop> 
 
\t \t \t </cflock> 
 
     </tr> 
 
\t <td colspan="4"><b> 
 
\t \t \t Order Amount</b></td> 
 
\t <td colspan="1"><b> 
 
    \t \t \t <center>#DollarFormat(form.ItemA)#</center></td> \t \t \t 
 
\t </tr> 
 
\t <tr> 
 
\t <td colspan="4"><b> 
 
\t \t \t Tax</b></td> 
 
\t <td colspan="1"><b> 
 
\t \t \t <center>#DollarFormat(form.TaxA)#</center></td> \t \t 
 
\t </tr> 
 
\t <tr> 
 
\t <td colspan="4"><b> 
 
    \t \t \t Shipping Cost (Shipping Method: #session.customerform.Shipping#) 
 
     </b></td> 
 
\t <td colspan="1"><b> 
 
\t \t \t <center>#DollarFormat(form.ShippingA)#</center></td> \t \t 
 
\t </tr> 
 
\t <tr> 
 
\t <td colspan="4"><b> 
 
    \t \t \t Order Total</b></td> 
 
\t <td colspan="1"><b> 
 
    \t \t \t <center>#DollarFormat(form.OrderA)#</center></td> \t \t 
 
\t </tr> 
 
\t </cfoutput> 
 
\t </thead> 
 
\t </table>   
 
     </cfoutput> 
 
     </body> 
 
     </html> 
 
     </cfmail> 
 
     </head> 
 

 
     <cflock scope="session" timeout="10"> 
 

 
    <cfset session.customerform = StructNew()> 
 

 
    <cfset session.customerform.bFirstName = form.bFirstName> 
 
    <cfset session.customerform.bLastName = form.bFastName> 
 
    <cfset session.customerform.bAddress = form.bAddress> 
 
    <cfset session.customerform.bCity = form.bCity> 
 
    <cfset session.customerform.bCtate = Form.bState> 
 
    <cfset session.customerform.bZipCode = Form.bZipCode> 
 
    <cfset session.customerform.bEmail = Form.bEmail> 
 

 
    <cfset session.customerform.sFirstName = Form.sFirstName> 
 
    <cfset session.customerform.sLastName = Form.sLastName> 
 
    <cfset session.customerform.sAddress = Form.sAddress> 
 
    <cfset session.customerform.sCity = Form.sCity> 
 
    <cfset session.customerform.sState = Form.sState> 
 
    <cfset session.customerform.sZipCode = Form.sZipCode> 
 
    <cfset session.customerform.sEmail = Form.sEmail> 
 

 
    <cfset session.customerform.CC = Form.CC> 
 
    <cfset session.customerform.ccMonth = Form.ccMonth> 
 
    <cfset session.customerform.ccYear = Form.ccYear> 
 
    <cfset session.customerform.Shipping= Form.Shipping> 
 

 
    </cflock> 
 
    
 
    <div id="divHeaderText" class="page-content"> 
 
        <div id="divHeaderLine1">Thank you for your Order </div> 
 
\t \t \t \t \t 
 
    \t \t \t \t #session.customerform.bFirstName# 
 
    #session.customerform.bLastName# !!</div> 
 
        <h2>Your Order number is <font color="red"> 
 
    #randRange(Int, Int2, "SHA1PRNG")# </font></h2> 
 
        <h2><cfif #session.customerform.Shipping# is "OverNight"> 
 
    \t \t \t \t \t Your order will arive in 12 hours since you opted for 
 
    Overnight shipping 
 
    \t \t \t \t \t </cfif> 
 
\t \t \t \t \t <cfif #session.customerform.Shipping# is "OneDay"> 
 
\t \t \t \t \t Your order will arive in 1 day since you opted for One 
 
    Day shipping 
 
\t \t \t \t \t </cfif> 
 
\t \t \t \t \t <cfif #session.customerform.Shipping# is "TwoDay"> 
 
\t \t \t \t \t Your order will arive in 2 days since you opted for Two 
 
    Day shipping 
 
\t \t \t \t \t </cfif></h2> 
 
    <h2>Your order will be shipped to the following address: <font 
 
    color="red">#session.customerform.sAddress# </font></h2> 
 
        
 
\t \t \t \t \t </br>        
 
       </div> 
 

 
    <cflock timeout=20 scope="Session" type="Exclusive"> 
 
    <cfset StructDelete(Session, "cart")> 
 
    </cflock> 
 

 

 
    </body> 
 
    </html>

+6

いいえ、今すぐデータベースを投稿してください。完全なアプリがあります。真剣に関連するコードだけを投稿することはできませんか? – madalinivascu

+1

クイックルックがありました:application.cfcはOKです。 shopping.cfmでは、テーブル全体ではなくtbodyの行をループする必要があります。それ以外の部分は上記のように試してみるのは難しいです。また、あなたのコードを近代化して読んだり、開発したりするのに便利なように、どのバージョンのCFを開発していますか? –

+0

1つの問題を選択して解決します。他の問題がなくなるかどうか確認してください。 –

答えて

0

簡単に見ていたし、はっきりと 'customerinfo.cfm' には2つの問題があります。

  1. が出発<form>タグはありません。終了タグがありますが、</form>です。
  2. SUBMITボタンの構文が間違っています。

開始<form>タグを挿入し、フォームアクションを "reviewOrder.cfm"と定義します。送信ボタンを<input type="submit ...>

に変更します。もう1つ:bodyタグの開始後にスクリプトタグの末尾(</script>)が表示されています。

願っています。

関連する問題