General discussion

Locked

Coldfusion CFIF help

By emcounts ·
Customers receive a percentage discount on a sliding scale for certain products, otherwise receive the overall web discount price of 5%.

Here is the scale:
1 - 99 pieces = 5%, 100 - 249 = 7%, 250 - 499 = 8%, 500 - 999 = 9%

The code is working and giving the overall of 5%; however, for those products I've specified in the discount.cfm file, it does not give the discount. If I change insert_part.cfm file from LT to GT, they get discount, but the other products don't receive overall discount. 2 files are not working together.

INSERT_PART.CFM (NOTE: part file)
<CFINCLUDE TEMPLATE="multiplier.cfm">
<CFINCLUDE TEMPLATE="discount.cfm">
<CFSET #overall_discount# = #ccost# * #universal_discount#>

<CFIF (#overall_discount# LT (#userdiscount#) ) OR (#userdiscount# IS 0)>
<cfset #userdiscount# = #overall_discount#>
</cfif>

<CFSET #list_price# = #ccost#>
<CFIF ( ((#multiplier# * #ccost#) LT (#userdiscount#)) ) !--- OR ( (#multiplier# * #ccost#) LT #ccost# ) --->
<CFSET #ccost# = #multiplier# * #ccost#>
<cfelseif #userdiscount# IS NOT 0>
<CFSET #ccost# = #userdiscount#>
</CFIF>

<!---
<CFIF #userdiscount# IS NOT 0>
<CFSET #ccost# = #userdiscount#>
</CFIF>
--->

DISCOUNT.CFM
<CFSET universal_discount = 0.95>
<!-- pogo pin ---->
<CFELSEIF #priceID# is "9552">
<CFIF #qquantity# LT 100>
<CFSET #userdiscount# = 9.50>
<CFELSE>
<CFSET #userdiscount# = 9.10>
</CFIF>

MULTIPLIER.CFM
<!--- If 6 <= quantity <= 9, set discount multiplier to 0.9 --->
<cfif (#qquantity# GTE 6) AND (#qquantity# LTE 9)>
<CFSET #multiplier# = 0.9>

<!--- If 10 <= quantity <= 24, set discount multiplier to 0.85 --->
<cfelseif (#qquantity# GTE 10) AND (#qquantity# LTE 24)>
<CFSET #multiplier# = 0.85>
<!--- If 25 <= quantity, set discount multiplier to 0.80 --->
<cfelseif (#qquantity# GTE 25)>
<CFSET #multiplier# = 0.80>
<cfelseif (#qquantity# LTE 5)>
<CFSET #multiplier# = 1>
</cfif>

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Try this

by CGSJohnson In reply to Coldfusion CFIF help

In the discount.cfm file, the third line, which begins "cfelseif #priceID#..." doesn't have a beginning cfif tag. Also, pound symbols are not required in cfif tags. I hope that this helps. Thanks.

Chris

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums