EasyCFM.COM ColdFusion Forums / Tutorial Requests! / Computer builder application

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Computer builder application

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

sebberry
02-08-2009 @ 10:33 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 7
Joined: Feb 2009

Hello, I'm new here (if my post count didn't give it away).

I understand some of the basics (ie outputting data, submitting data) but not much more.  

What I am trying to do is build a page that lets visitors custom build a computer system.  The back-end database is actually a point of sale system with data readily accessible with SQL queries, so really this is just a front-end.

I have figured out the SQL commands for the CFQuery tags to get the data I want and also how to display it on the page via drop-down lists with the upgrade price.  (oddly tho, it appears to add $10.00 to each price)

What I don't understand how to do is this:  Take what the user has selected in the several drop down boxes on the page and make it so the user can print the page and have it show the selected upgrades and the new price of the system.

Not asking to be spoon fed here, but if someone could point me in a few places that addresses this topic that would be great Smile
Thanks!

louissto56
02-08-2009 @ 10:37 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 1149
Joined: Jan 2007

Well you'd need a form and then an action page to read
the entered form values, then using the values,
determine the output.

I could post code if I knew exactly what you are trying
to output

Louis

--Louis

sebberry
02-09-2009 @ 12:19 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 7
Joined: Feb 2009

Thanks for your reply and I appreciate any advice you can provide.


Here is what I have so far - nothing else on the page, just playing with the data.  The only upgrades shown so far are for the Processor and Hard Drive.

The page loads the components of the computer, in this case the computer system is named "Surfer".  This data is already in our POS system "Atrex".

When we set up what components are inside each computer in Atrex, we use the "related codes" feature in the POS system to add the components we wish to have listed as upgrade options.  

Two problems I am having with the code so far:
>I have to add a "-10" as CF increases the prices after the subtraction by 10

>For a reason unknown to me, the CPU upgrade prices are showing incorrectly.  Further examination based on prices in Atrex show that it is calculating the CPU upgrade price by subtracting the BasePrice of the Hard Drive from the CPU UpgradePrice instead of the BasePrice of the CPU.

Here is the code:



<!--/*Get components for surfer system from Atrex*/-->
<CFQUERY name="Surfer" datasource="Atrex" username="Web" password="password">
SELECT condef.STOCKCODE, condef.CONTAINER, condef.sequence,
       condef.QUANTITY, code.onlinename, code.MODEL,
       code.Mfr, code.OnlineDescrHTML, Code.Price
FROM condef condef INNER JOIN code code ON
     (code.STOCKCODE = condef.STOCKCODE)
WHERE condef.container ='SYS-STAR-SURFER' AND posttoweb
ORDER BY condef.sequence
</CFQUERY>

<CFQUERY name="Surfer_CPU" datasource="Atrex" username="Web" password="password">
SELECT condef.STOCKCODE, condef.CONTAINER, condef.sequence,
       condef.QUANTITY, code.onlinename, code.MODEL,
       code.Mfr, code.OnlineDescrHTML, Code.Price as BasePrice
FROM condef condef INNER JOIN code code ON
     (code.STOCKCODE = condef.STOCKCODE)
WHERE condef.container ='SYS-STAR-SURFER' AND posttoweb
ORDER BY condef.sequence
</CFQUERY>

<CFQUERY name="Surfer_HD" datasource="Atrex" username="Web" password="password">
SELECT condef.STOCKCODE, condef.CONTAINER, condef.sequence,
       condef.QUANTITY, code.onlinename, code.MODEL,
       code.Mfr, code.OnlineDescrHTML, Code.Price as BasePrice
FROM condef condef INNER JOIN code code ON
     (code.STOCKCODE = condef.STOCKCODE)
WHERE condef.container ='SYS-STAR-SURFER' AND posttoweb
ORDER BY condef.sequence
</CFQUERY>



<!--Get list of processor upgrades from Surfer system related codes-->
<CFQUERY name="Surfer_CPU_Upgrade" datasource="Atrex" username="Web" password="password">
  SELECT Code.Descr AS Upgrade, Code.Price AS UPGPrice,
         Relcodes.StockCode
    FROM relcodes Relcodes
         INNER JOIN code Code
                 ON Relcodes.Related = Code.StockCode
WHERE Relcodes.Stockcode='SYS-STAR-SURFER' AND Code.Category='Processors'
</CFQUERY>

<!--Get list of hard drive upgrades from Surfer system related codes-->
<CFQUERY name="Surfer_HD_Upgrade" datasource="Atrex" username="Web" password="password">
  SELECT Code.Descr AS Upgrade, Code.Price AS UPGPrice,
         Relcodes.StockCode
    FROM relcodes Relcodes
         INNER JOIN code Code
                 ON Relcodes.Related = Code.StockCode
WHERE Relcodes.Stockcode='SYS-STAR-SURFER' AND Code.Category='Hard Drives'
</CFQUERY>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="expires" content="0">

<title>Builder test</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="main"><table border="0" align="center" cellpadding="3" cellspacing="0">
      <tr>
        <td width="314" class="sys_name">Sneakers Surfer configuration </td>
      </tr>
      <CFOUTPUT query="Surfer">
        <tr>
          <td class="partlist">#Surfer.onlinename# #DollarFormat(Surfer.Price)#</td>
        </tr>
      </CFOUTPUT>
    </table>
      <p> </p>
      <table border="0" align="left" cellspacing="2">
        <tr>
          <td width="651" class="parthead">Processor upgrade options: </td>
        </tr>
        <tr>
          <td><select name="select" id="select">
            <CFOUTPUT query="Surfer_CPU_Upgrade">
              <option value="#Surfer_CPU_Upgrade.Upgrade#">#Surfer_CPU_Upgrade.Upgrade#  #DollarFormat (Surfer_CPU_Upgrade.UPGPrice-Surfer_CPU.BasePrice-10)#</option>
            </CFOUTPUT>
          </select></td>
        </tr>
        <CFOUTPUT query="Surfer_HD_Upgrade"> </CFOUTPUT>
      </table>
      <p> </p>
      <p> </p>
      <table border="0" align="left">
        <tr>
          <td width="653" class="parthead">Hard drive upgrade options:</td>
        </tr>
        <tr>
          <td><select name="select2" id="select2">
              <CFOUTPUT query="Surfer_HD_Upgrade">
                <option value="#Surfer_HD_Upgrade.Upgrade#">#Surfer_HD_Upgrade.Upgrade#  #DollarFormat (Surfer_HD_Upgrade.UPGPrice-Surfer_HD.BasePrice-10)#</option>
              </CFOUTPUT>
            </select></td>
        </tr>
        <CFOUTPUT query="Surfer_HD_Upgrade"> </CFOUTPUT>
      </table>
      <p> </p>
      <p> </p>
    </td>
  </tr>
</table>
<p> </p>
<p> </p>
</body>
</html>


  1. null


What I would like to output is a page that contains the list of components in the computer based on the selection that the user has made, plus the total price of the upgrades and new price of the computer.  Basically a quote that the user can print and bring into the store.

This message was edited by sebberry on 2-9-09 @ 12:20 AM


Website Designed and Developed by Pablo Varando.