Blog search

Blog Calendar

S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
<<  May  >>
2008

Blog stats

Blogs - 2
Posts - 40
Comments - 98


cARTWEAVER.COM
Cartweaver.com ColdFusion, PHP, and ASP Shopping carts for Adobe™ Dreamweaver.

The technology and business of selling on the web.

A blog about all things ecommerce.

Adding a second payment type in ColdFusion

Sunday, May 11, 2008 10:37:41 AM

This modification can be used for "Pay by Credit Card or Check" or for "Pay now or request a Quote". This is simply a matter of changing the credit card processor from your payment processor that is set up in the Application.cfm file to "none" on the fly, based on user input. The code for this modification in PHP is shown at http://www.tom-muck.com/cw/

You should be able to set up a form field on the order form to allow for checks to be sent on CWIncOrderForm.cfm:

<p>Pay by:<br />
Send check:
<input type="radio" name="paymenttype" value="0" checked="checked" />
Credit Card:
<input type="radio" name="paymenttype" value="1" />
</p>

then add a bit of code to the CWIncOrderForm.cfm file around line 43, right after <cfif IsDefined ('FORM.OrderFormNext')> :

<cfif isDefined("Form.paymenttype")>
<cfset session.paymenttype = form.paymenttype />
</cfif>

then a bit of code to the CWIncShowCart.cfm file:

<cfif IsDefined("Session.paymenttype")>
 <cfswitch expression="#Session.paymenttype#">
   <cfcase value="0">
    <cfset request.paymentAuthType = "none">
    <cfset request.paymentAuthName = "none">
   </cfcase>
   <cfcase value="1">
    <cfset request.paymentAuthType = "gateway">
    <cfset request.paymentAuthName = "CWIncAuthorizeNet.cfm">
   </cfcase>
 </cfswitch>
</cfif>

Also, if you want to change the confirmation emails based on the payment type, add this code to the top of CWIncConfirmation.cfm as well:

<cfif IsDefined("Session.paymenttype")>
 <cfswitch expression="#Session.paymenttype#">
   <cfcase value="0">
    <cfset request.paymentAuthType = "none">
    <cfset request.paymentAuthName = "none">
   </cfcase>
   <cfcase value="1">
    <cfset request.paymentAuthType = "gateway">
    <cfset request.paymentAuthName = "CWIncAuthorizeNet.cfm">
   </cfcase>
 </cfswitch>
</cfif>

Then you can make your changes in the email within the CFMAIL tag however you like, such as:

Your order has been received.
As soon as your payment is received you will receive a confirmation notice and your order will be shipped! Your order details are as follows.

#EmailContents#

You might also add a bit of code after the <h2>Order Details</h2> line:

<h2>Order Details</h2>
<cfif request.paymentAuthType EQ "none">
<p>Your order has been recieved. The order will be shipped when your check or money order is received.</p>
</cfif>

This could also be used to switch between a gateway and Paypal, or even 3 options -- credit card, check, or Paypal.

Update: If the customer is logged in already, the default payment option only is shown, but you can set up a link to change the payment type like this:

<a href="<cfoutput>#request.targetCheckOut#</cfoutput>"><strong>Change your payment type</strong></a>

Category tags: Adobe Dreamweaver, Cartweaver, ColdFusion, FAQ

How to "Hard Code" links to categories and products.

Tuesday, April 08, 2008 12:00:00 AM

"I am building a site and the links to the categories are images. I don't know how to do this."

Due tot he fact that a lot of Cartweaver users are new to dynamic web development we frequently get asked this question. Fortunately, when it comes to learning code, this is one of the easiest things you'll learn. Another good thing is that all server models, ASP, PHP, and ColdFusion handel this is the same way, so that makes things pretty easy.

Here's what you do. You select the image or test you want to use as the category link and simply link it to the search results page, by default this is Results.cfm, (or .asp or .php) depending on which server model you are using. This is pretty standard, you've done this plenty of times. Next come the "coding part" Here's all you need to do... In code view, look at your link

Results.cfm

Then add this

Results.cfm?category=1

The question mark tells the server that a variable is being passed followed by the name of the variable, in this case "category" then the equal sign tells the server that what follows is the variable's value. Here I used the number 1, for your case you will need to look into the database and see what the actual ID is for the category you are wanting to pull.

That's it. Easy stuff no?

Now what if you want to narrow things down by searching on both a category and a secondary category? You can do this by using the ampersand to tack the secondary category ID, like this...

Results.cfm?category=1&secondary=2

Notice there are no spaces, that the values and the names and = and & are all bunched together. Be sure you do it this way. Spaced will cause this to fail.

One additional way to use your new found coding skills. What if you want to "hard code" a link to a particular product... Easy. Just do the same as you've done above but this time link to the Details page and pass the product ID. Like this...

Details.cfm?ProdID=1

Again, you'll need to check in your database to see what the ID is, or as a short cut you can use one if the links that Cartweaver generates for you and link to the product you want then look in the address bar of your browser and low and behold, there's the ID and the link you'll need.

This one little coding technique make it very easy to manually place links through out the site to put products you want to feature on you home page or where every you wish.

If you have any questions stop by our newsgroups, we will be happy to help out.

news://support.cartweaver.com

Category tags: ASP, Cartweaver, ColdFusion, PHP

Adobe Releases ColdFusion 8.01!

Friday, April 04, 2008 12:00:00 AM

Mac Leopard users rejoice! Adobe has just released 8.01 update to ColdFusion and among the notable fixes and enhancements included in this update is an updated installer for OSX Leopard.

Traditionally the cool thing about updates to ColdFusion, is besides fixing any glitches or bugs found since the version release, Adobe sees fit to add more features and functionality that many companies would hold over till the next "paid" update! This update is no different. With the addition of Windows 64bit support, better AJAX support, new features in the text editor function (ala FCKEditor), some new cfimage features and a ton more.

ColdFusion just keeps getting better and better!

For more info, check out the ColdFusion 8 Update 1 FAQ and Release Notes.

Mac Leopard users should go to: http://www.adobe.com/products/coldfusion/ and download CF8 Developer's Version, the version you will download is the 8.01 update.

Category tags: Cartweaver, ColdFusion, General Topics

Cartweaver and Database driven web development on the Mac

Thursday, April 03, 2008 12:00:00 AM

Cartweaver, like with many other we applications comes with an Access database. Access is fine for small, low traffic sites and a lot of sites around the web use it, also it's really easy to set up, so for training purposes it offer a pretty easy entry into database driven web development. But, what if you are on a Mac? You'll quickly find that the Mac does not support MS Access, so you'll have to use a database that the Mac and most web hosts support. That would be MySQL.

What we usually tell folks who are new to dynamic development who are looking to use Cartweaver is, "you don't need to know code or databases to use Cartweaver to create ecommerce sites, but you do need to be willing to learn some new things." Cartweaver makes developing a standalone shopping cart / ecommerce site about as easy as it can be, but there is going to be a learning curve. You will need to learn how to set up a dynamic development environment and create a DSN (data source name) to connect to the database, and in the case of the Mac that database will need to be MySQL, so you will need to install and set up MySQL and get familiar with a MySQL GUI admin. I can recommend CoCoaMySQL as a free admin, I also highly recommend Navicat, it cost about $90 but it is really about the best there is and is very user friendly. Cartweaver has a script that creates all the tables and fields you need for you so you don't need to know databases, but you will have to become familiar enough with MySQL and the admin tool to be able to run the script.

Please note: The above is not a Cartweaver specific process, this will be necessary to develop any dynamic database driven web site on your Mac, be it a shopping cart application or even a simple "Hello World" script. The good news is that, even though it's a little more involved setting up a dynamic development environment on a Mac, once done the Mac can serve as an excellent development platform! So it's worth the effort.

Here are some resources for you to look at…

GUI downloads:

As a follow up, Lynda.com has this course:

This covers installing and testing CF8 on a Mac and should be helpful. Fortunately, this part of the title is free, so you can view it even if you aren't subscribed to Lynda.com!

There is an additional glitch that has to do with Mac Leopard. It is not a Cartweaver specific issue, but it will impact your situation until Adobe comes up with an update. Here is a blog post about it.

http://blog.cartweaver.com/index.cfm?newsid=40

Don't let the extra steps involved stop you from your plans to begin developing dynamic web site! Believe me the effort involved is well worth it. Your "market value" as a web designer/developer will be much higher once you get over the initial learning curve and can offer the benefits of dynamic development to your clients or employer.

If you have any questions stop by our newsgroups, we will be happy to help out.

news://support.cartweaver.com

Category tags: Adobe Dreamweaver, Cartweaver, ColdFusion, PHP

Protect that download directory

Sunday, March 30, 2008 12:00:00 AM

When running a digital downloads store, you want to make sure your web visitors do not have access to the folder where your downloads are contained. This also applies to anyone using the Cartweaver Downloadable Products plug-in. Depending on your server, you have different options. If the web server is IIS, you can go into the admin and turn off anonymous access. If it is an Apache server, add an .htaccess file to the downloads folder like this:

Deny from all

or

Redirect /yourstorefolder/ http://yourdomain.com/yourstorefolder/error.php?error=No%20access%20allowed%20

That should take care of any attempts to download from the folder.

Note that not all web hosts allow the use of .htaccess. If not, you may have to contact the web host to ask them to turn off web access to this folder. You may also have access to an administrative panel for your web hosting account that has this functionality available.

Category tags: Cartweaver, ColdFusion, FAQ, PHP, Plug-ins

New price format string functionality in Cartweaver

Monday, March 03, 2008 6:19:11 PM

The lastest versions of Cartweaver PHP and ColdFusion contain a new price format string. This was a much requested feature, as many CW users wanted to format prices in a different way than it was set up by default. Some users might need to display prices with tax, prices without tax, both prices, tax amounts, etc. VAT formatting in particular needed a different format. We came up with a price format string in the getPriceList() function:

The function takes these arguments.
productID: The product ID to display.
allowBackOrders: Do we allow back orders?
taxRate: Rate of tax for the item
currentRecord: row number for CSS ids
showMax: flag to show max price along with min price
priceFormat: string with replaceable masks for price parts

Price format string new in 3.0.7 (PHP) and 3.0.9 (ColdFusion) to format price on results and details page for taxable items $priceFormat in this format:
@@beforeDiscountPrice@@
@@currentPrice@@
@@tax@@
@@priceWithTax@@
@@taxAmount@@

Use in combination with showMax. By default, minimum and maximum price of product are shown ($1.00 - $5.00). Set to false to show only the minimum price. Then, priceFormat can be used to format the price like this:

for example, assuming a 50% discount, 5% tax rate, showing prices before tax and after tax:
@@beforeDiscountPrice@@ @@currentPrice@@ (@@priceWithTax@@ including @@tax@@% tax)
shows 2.00 - 10.00 (2.10 - 10.50 including 5% tax) 1.00 - 5.00 (1.05 - 5.25 including 5% tax)

Another example shows displaying minimum price only with 50% discount, 25% VAT, and showing price with VAT included and excluded:
@@beforeDiscountPrice@@ @@priceWithTax@@ (@@currentPrice@@ + @@taxAmount@@ VAT)
shows 2.50 (2.00 excluding.50 VAT) 1.25 (1.00 excluding .25 VAT)

A simple example with no discount and no tax, showing only minimum price:
Prices starting at @@currentPrice@@
shows: Prices starting at $1.00

The format string is called from the CWIncDetails and CWIncResults pages, but you can also set up a simple session variable or configuration item to handle this:

$_SESSION["PriceFormatString"] = "@@beforeDiscountPrice@@ @@priceWithTax@@ (@@currentPrice@@ + @@taxAmount@@ VAT)";

Or for CF:

<cfset Session.PriceFormatString = "@@beforeDiscountPrice@@ @@priceWithTax@@ (@@currentPrice@@ + @@taxAmount@@ VAT)">

UPDATE:

The getPriceList() function is called like this:

echo(getPriceList($productID,
$allowBackOrders,
$taxRate,
$currentRecord,
$showMax,
$priceFormat));

Essentially, you find the place on CWIncResults or CWIncDetails where the function is being called from, and adjust it to your liking:

echo(getPriceList($row_rsCWGetProduct["product_ID"],
$cartweaver->settings->allowBackOrders,
$taxRate,
',
true,
$priceFormatString));

Category tags: Adobe Dreamweaver, Cartweaver, ColdFusion, FAQ, PHP

Before posting comments or trackbacks, please read the posting policy.

Full Blog Calendar