Yeah I did that further up the code to ensure the itemID's were being returned ok. I remembered that from something I did a while ago. Its weird though that the values must be returned properly to populate the dropdowns. I'll give it a go and see what happens ....

Regards - Paul


From: [EMAIL PROTECTED]
Reply-To: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Re: [ cf-dev ] Free Beer!
Date: Mon, 19 Jul 2004 10:46:04 +0100


Paul, this *may* be connected to the bug where this code wouldn't work:

<cfoutput query="whatever">
     <cfloop query="something else">
          #reference to whatever.variable#
     </cfloop>
</cfoutput>

in the above instance, #whatever.variable# would always equal the first
value from that query, not the one currently being looped.  you have to set
a temp variable before you enter the cfloop, and reference that instead:
<cfoutput query="whatever">
     <cfset somevariable = whatever.variable>
     <cfloop query="something else">
          #somevariable#
     </cfloop>
</cfoutput>

This bug might have been fixed in CFMX, not sure...?




"Paul Swingewood"
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
tmail.com> cc:
Subject: Re: [ cf-dev ] Free Beer!
19/07/2004 10:40
Please respond to
dev






Heres the problem.

Best viewed visually at http://217.43.93.212/store/

Select Footwear, Stilettos, Choose a shoe, put this in my basket.

Change the size and the new size change is reflected in the drop down list.

Perfect!
Now add another stiletto to the basket change size (Dispear! - Angst and
stress)


You will see ive added a few debugging lines to the table to show the values. I can't understand why this works first time but then not for any other item added....

Now for the code ....


<cfoutput query = "GetCartItems">
<cfset tblitemsItemID =
GetCartItems.ItemIdPK>
<!--- Get sizess relevant for this item --->
<CFQUERY NAME="Getsizes" datasource="
#application.dsn#">
SELECT tblItemSizes.FKItemID,
tblSizes.Size,
tblItemSizes.FKSizeID,
tblSizes.SizeID
FROM tblSizes
INNER JOIN tblItemSizes
ON tblSizes.SizeID =
tblItemSizes.FKSizeID
WHERE (tblItemSizes.FKItemID
= #tblitemsItemId#)
</cfquery>
<tr><td BGCOLOR="##cc0000" colspan="7">
Possible Sizes for this item are :
<cfloop query="GetSizes">
#GetSizes.Size#,</cfloop>
</td></tr>
<!--- Get colours relevant for this item
--->
<CFQUERY NAME="GetColours" datasource="
#application.dsn#">
SELECT tblItemColours.FKItemID,
tblColours.Colour,


tblItemColours.FKColourID,
                                                    tblColours.ColourID
                                          FROM tblColours
                                          INNER JOIN tblItemColours
                                          ON tblColours.ColourID =
tblItemColours.FKColourID
                                          WHERE
(tblItemColours.FKItemID = #tblitemsItemId#)
                                          Order By ColourID ASC
                               </cfquery>
                               <tr><td BGCOLOR="##cc0000" colspan="7">Get
Cart Items Size(Outer loop) =
#GetCartItems.ItemSize#</td></tr>
                               <TR>
                                          <TD BGCOLOR="##cc0000">
#PartNum#</TD>
                                          <TD BGCOLOR="##cc0000">
#ItemName#</TD>
                                          <td BGCOLOR="##cc0000">
                                                    <cfif GetSizes.size eq
"">
                                                              N/A
                                                    <cfelse>
                                                              <select name
="selectSize#Replace(ItemIDPK,"-","_","ALL")#">
                                                                   <cfloop
query="Getsizes"><!--- Sizes relevant for this item only
--->

<cfif Getsizes.Size eq GetCartItems.ItemSize>

                <option value="#GetCartItems.ItemSize#"
selected>#GetCartItems.ItemSize#</option>

                <!--- Increment the cart query here? --->

      <cfelse>

                <option value="#GetSizes.Size#">#GetSizes.Size#</option>

      </cfif>

</cfloop>
                                                              </select>
                                                    </cfif>
                                          </td>
                                          <td BGCOLOR="##cc0000">
                                                    <select name
="selectColour#Replace(ItemIDPK,"-","_","ALL")#">
                                                         <cfloop query
="GetColours"><!--- Colours relevant for this item
only --->

<cfif GetColours.ColourID eq GetCartItems.ItemColour>

      <option value="#GetColours.ColourID#"
selected>#GetColours.Colour#</option>

<cfelse>

      <option value="#GetColours.ColourID#">#GetColours.Colour#</option>

</cfif>
</cfloop>
</select>
</td>
<td ALIGN="RIGHT" bgcolor="
##cc0000">#lscurrencyFormat(ItemCost)#</TD>
<td bgcolor="##cc0000">
<input type="Text" name
="Quantity#Replace(ItemIDPK,"-","_","ALL")#"
value="#Quantity#" align="RIGHT" size="3">
</TD>
<TD BGCOLOR="##cc0000" ALIGN
="RIGHT">


#lscurrencyFormat(ItemCost * Quantity)#
                                          </TD>
                               </TR>
                               <!--- Add cost of current item(s) to total
cost --->
                               <CFSET TotalCost = TotalCost +
(GetCartItems.ItemCost *
GetCartItems.Quantity)>
                     </cfoutput>

Regards- Paul



--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]






--
These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/


CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com*
*Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*


To unsubscribe, e-mail: [EMAIL PROTECTED]




-- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
     *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
          *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Reply via email to