Hi Ike and Adam (and others),
I tried Ike's suggestion below but with the same outcome.
<cfif session.basket.ProductURL EQ "">
<cfset URL = "">
<cfelse>
<cfset URL =
URLEncodedFormat(session.basket.ProductURL)>
</cfif>
<cfset thisStruct = URL> <!--- Did this just to keep the sample
simple --->
<cfscript>
thisStructList = structKeyList(thisStruct);
thisString = "";
for(i = 1; i LTE listLen(thisStructList); i = i + 1)
{
thisString = listAppend(thisString,
evaluate(listGetAt(thisStructList, i)));
}
</cfscript>
The error that it gets is :
Complex object types cannot be converted to simple values.
The expression has requested a variable or an intermediate expression
result as a simple value, however, the result cannot be converted to a
simple value. Simple values are strings, numbers, boolean values, and
date/time values. Queries, arrays, and COM objects are examples of
complex values.
The most likely cause of the error is that you are trying to use a
complex value as a simple one. For example, you might be trying to use a
query variable in a <CFIF> tag. This was possible in ColdFusion 2.0 but
creates an error in later versions.
The error occurred in C:\Documents and Settings\mpicker\My Documents\My
Webs\ttzed.com\web\products\products_process.cfm: line 327
Called from C:\Documents and Settings\mpicker\My Documents\My
Webs\ttzed.com\web\products\products_process.cfm: line 425
Called from C:\Documents and Settings\mpicker\My Documents\My
Webs\ttzed.com\web\products\products_process.cfm: line 513
325 : for(i = 1; i LTE listLen(thisStructList); i = i + 1)
326 : {
327 : thisString = listAppend(thisString,
evaluate(listGetAt(thisStructList, i)));
328 : }
329 : </cfscript>
As requested by Ike, there is a page elsewhere on the site when the user
is looking through products, sets a hidden form variable named
"ProductURL":
<input type="Hidden" name="ProductURL"
value="cat=#url.cat#&grouping=#grouping#&grouptitle=#URLEncodedFormat(gr
ouptitle)#&PartID=#fldPartID#&page=#page#&title=#URLEncodedFormat(title)
#&do=action">
If the user clicks to add the product to their basket it goes onto a
processing page that has the following in it:
<cflock scope = "Session" timeout = "30" type =
"Exclusive">
<cfset tempValue = queryAddRow(newBasket)>
<cfset tempValue = querySetCell(newBasket,
"PartID", PartID)>
<cfset tempValue = querySetCell(newBasket,
"PartNumber", PartNumber)>
<cfset tempValue = querySetCell(newBasket,
"ProductURL", ProductURL)>
<cfset tempValue = querySetCell(newBasket,
"Price", Price)>
<!--- ***************** START Change qty to the value entered on the
basket form *********** --->
<cfset productRow =
listFind(valueList(session.basket.PartID), PartID)>
<cfset newQuantity =
listGetAt(valueList(tmpQtyList.formqty), productRow)>
<cfset tempValue = querySetCell(newBasket,
"Quantity", newQuantity)>
<!--- ***************** END Change qty to the value entered on the
basket form *********** --->
<cfset tempValue = querySetCell(newBasket,
"saleDate", saleDate)>
<cfset tempValue = querySetCell(newBasket,
"GroupBuy", GroupBuy)>
<cfset tempValue = querySetCell(newBasket,
"Grouping", Grouping)>
</cflock>
So now (5th line on the above code) the ProductURL is stored as a
session variable in the newBasket session.
Later on if the user proceeds through the checkout the following code is
on the checkout processing page :
(the below is all included in some looping code)
<cfif session.basket.ProductURL EQ "">
<cfset URL = "">
<cfelse>
<cfset URL =
URLEncodedFormat(session.basket.ProductURL)>
</cfif>
<cfset thisStruct = URL> <!--- Did this just to keep the sample
simple --->
<cfscript>
thisStructList = structKeyList(thisStruct);
thisString = "";
for(i = 1; i LTE listLen(thisStructList); i = i + 1)
{
thisString = listAppend(thisString,
evaluate(listGetAt(thisStructList, i)));
}
</cfscript>
<CFQUERY datasource="#dsn_orders#">
INSERT INTO
tblInvoiceLineDetails
(
fldInvoiceID,
fldPartID,
fldPartNumber,
fldProductURL,
fldPrice,
fldQuantity,
fldGroupBuy,
fldGrouping
)
VALUES
(
#getLastInvoiceID.LastInvoice#,
#session.basket.PartID#,
'#session.basket.PartNumber#',
'#URL#',
#PriceForQuery#,
#session.basket.Quantity#,
#session.basket.GroupBuy#,
#session.basket.Grouping#
)
</CFQUERY>
And as show at the top of this email, it stops with an erro when trying
to use the URL or thisStructList variables.
Does anybody else have any ideas?
Cheers
Mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com