Setting CFPARAM default value
Hi,
I am working on a shopping cart site that I did not design.
The cart currently has 1 page for each product category so there is about 15 pages. I want to reduce it to one page and carry the cat_id through the URL. I am doing this successfully, however, when it comes to 'Adding and Item to the Cart' it loses the value for the cat_id and returns an error.
The following is the code I am using:
<cfparam name="url.cat_id" default="" />
<cfquery name="catalogue" datasource="#rxxxxx#" username="#xxxxxx#" password="#xxxxxxx#">
SELECT *
FROM products
WHERE prod_cat_id = #url.cat_id#
</cfquery>
However, when I change the code to the following (the difference is bolded), the cart works as expected:
<cfparam name="url.cat_id" default="9" />
<cfquery name="catalogue" datasource="#rxxxxx#" username="#xxxxxx#" password="#xxxxxxx#">
SELECT *
FROM products
WHERE prod_cat_id = #url.cat_id#
</cfquery>
My question is, is there a way to set the cfparam default value with the URL.cat_id value?
Any suggestions?
