Special Links & Variables - Tips & Tricks

NOTE! See the ReadMe.txt file in the store folder you uploaded. Some of the files in that folder contain code snippets you may use or cfinclude into your own template.

These are some various links, variables, etc., that you may find useful in integrating cf_cart into your website. Please keep an eye out for updates to this page. We will be more adding tips and tricks.

Please be aware that many links here (as shown) will require that the cartpage and securepage variables be set on the page where the links are called. Please see the "cartpage" section.

  1. Keeping the shopping cart session alive if the user has cookies disabled.
  2. Redirection after placing an item into the cart.
  3. ColdFusion CFLOCATION "bug" workaround.
  4. Hide number of products found message at top of product lisiting.
  5. Show the shopping cart total.
  6. Show a "View Cart" link.
  7. Show a "Checkout" link.
  8. Change "Continue Shopping" Destination.
  9. Simple Order Link. Link from anywhere to order products.
  10. Hide Search Button.


Keeping the shopping cart session alive if the user has cookies disabled.
All pages must be .cfm pages. Every link must end in one of two variables.

  1. #querystring# - If the URL does not have a query string or at the end of any search engine safe URL:
    href="http://www.test.com/mypage.cfm<CFOUTPUT>#querystring#</CFOUTPUT>"
  2. #querystringback# - If the URL DOES have a query string:
    href="http://www.test.com/mypage.cfm?page=login<CFOUTPUT>#querystringback#</CFOUTPUT>"
These variables will not be activated until the user logs in or places an item into their basket. While not as important for the querystringback variable (since that is used on URLs that already have a query string), it is important for links without a query string already, as many search engines will not follow links with a query string ESPECIALLY if they are on a page with a query string. This will allow your site to be indexed more completely while still keeping it friendly for cookieless browsers.

If you are running on ColdFusion MX and using J2EE session variables, there is another variable that you must add if you wish to run without cookies. This is if your host is using J2EE session variables as opposed to ColdFusion session variables. You should ask them.

Back To Top


Redirection after placing an item into the cart.
Two variables available:

  1. <cfset showupdatedtotal = "1"> - If this variable is set at the top of the cartpage template, when placing an item into the cart, updaing an item in the cart, or deleting an item from the cart, there will be an immediate refresh. This is in case you wish to show a total of what is in the basket, such as...
    Your Basket Total: $29.00
    If we don't refresh, and the code you use to show the amount above is ABOVE where we cfinclude the cart.cfm page, when someone adds an item to the cart, this amount will be different than what the basket shows.
  2. <cfset returntoproducts = "1"> - This is basically the same, except when someone places an item into their cart, they will be redirected back to the product listing. You may want to use this even if you aren't showing a running total.
  3. <cfset autoupdatelink = "[url]"> - This can be a redirect to anywhere you like. The code below would redirct them to checkout after entering an item into the cart.

    <cfset autoupdatelink = "">

Back To Top


ColdFusion CFLOCATION "bug" workaround.
With ColdFusion 5.0 running IIS on the server side, occasionally after a redirection using cflocation, header information will appear at the top of the web page. This has sometimes appeared running IE6 under Windows XP on the client side. We have 2 variables available. Set either one of these at the top of the cartpage template.

  1. <cfset usejscript = "1"> - Uses javascript redirection. Works fast.
  2. <cfset usecfheader = "1"> - Uses header redirection. Slower, but works on non-javascript enacled broswsers.

Back To Top


Hide number of products found message at top of product lisiting.
There is a message showing the number of items found above the product list after browsing or searching. Some people only have several items and always show them all when browsing. To hide the X Items Found message, set the following variable.

Back To Top


Show the shopping cart total.
The cart total is held in a variable called "client.total". Set the following variable code where you wish to show the total.

You may use a CFIF statement if you wish, something to the effect of:

<CFIF client.total GT "0">
Your Total: <CFOUTPUT>#LSCurrencyFormat(client.total)#</CFOUTPUT>
<CFELSE>
Your Shopping Cart Is Empty
</CFIF>

Back To Top


Show a "View Cart" link.
Just paste the link below into any or all of your ColdFusion templates. You may also use it on the code above if you like. We often set the dollar amount as the link to the cart.

Back To Top


Show a "Checkout" link.
There will always be a checkout link from the Shopping Cart page. If you would also like to place a link to checkout from your templates, add the code below. Note that you may check that their are items in the basket before showing a checkout link.

<CFIF client.total GT "0">
<a href="<CFOUTPUT>#ezcartcheckout#</CFOUTPUT>">Checkout</a>
</CFIF>

If for any reason you will ever have any items that are free, you may change client.total to client.realquantity.

Back To Top


Change "Continue Shopping" Destination

By default, whenever we click the Continue Shopping button, we pass a "page" value of "list.cfm" to return to the product listing. You may change this. For example, you may be using the cf_specials tag and loading it when passing a page value of "specials". The cf_specials tag sends an "action" value of "showspecials". When someone clicks on a Special item you may not want to send them back to that individual item since they're probably not going to order it again. Adding the code below would cause them to return to the page showing all the specials when clicking on Continue Shopping.

<CFIF action IS "showspecials"><cfset returnpage = "specials"></CFIF>

May also be used with the returntoproducts variable to automatically return them to the last shopping page.

Back To Top


Simple Order Link
Pass a single variable to allow ordering. May be used with the integration method or with the standalone version.

Pass a variable named orderitem with the value being one or more Product IDs in a comma delimited list. This may be a form or url variable. You may also pass a matching orderqty variable with the quantity of each item. If this is not passed or is a different length than the orderitem variable, one of each will be placed in the cart.

Examples:

To use the standalone cart with this, just pass the variables directly to ezcart/cart.cfm.

Back To Top


Hide Search Button
Place this variable at the top of the cartpage template:
<cfset hidesearch = "1">

Back To Top