<?xml version="1.0" ?> 
<?xml-stylesheet type='text/xsl' href='rss.xslt' version='1.0'?>
<!--  RSS generation by 'A blog for web developers about all things ecommerce.' on Tue, 07 Sep 2010 19:32:54 GMT   --> 
<rss version="0.92">
	<channel>
		<title>Tom Muck's blog at A blog for web developers about all things ecommerce.</title> 
		<link>http://blog.cartweaver.com/?blogger=1</link> 
		<description>A blog for web developers about all things ecommerce.: Tom Muck's blog</description> 
		<webMaster>lawrence@cartweaver.com</webMaster> 
		<language>en-us</language> 

		<item>
			<title>Removing items from cart that are sold (ColdFusion)</title>
			<description><![CDATA[<p>One of the frequent questions I get doing support for Cartweaver is "How do I make sure that all the items in a customer's cart are still available?" What happens is that a customer will place an item in the cart, and then leave the site. Another customer comes along and buys the product. The first customer comes back and tries to purchase the item, but cannot. Unfortunately, the customer doesn't find out until the order information is entered. </p>
<p>The following modification for the ColdFusion version will remove items from the cart that are no longer available, and show the customer a message that an item has been removed from the cart because it is no longer available. </p>
<p>Now, in CWIncFunctions.cfm, add the following section of code at line 399, right after this line:</p>
<p class="code"> <cfset Cart.Products = ArrayNew(1) /> <br />
</p>
<p>Add the following code:</p>
<p class="code"><cfif application.allowbackorders EQ 0><br />
  <cfquery name="checkStock" datasource="#request.dsn#" username="#request.dsnusername#" password="#request.dsnpassword#"><br />
  SELECT c.cart_sku_ID, c.cart_sku_qty, s.SKU_Stock, c.cart_Line_ID<br />
  FROM tbl_cart c<br />
  INNER JOIN tbl_skus s<br />
  ON c.cart_sku_ID = s.SKU_ID<br />
  WHERE c.cart_custcart_ID = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Arguments.CartID#" /><br />
  AND s.SKU_Stock < c.cart_sku_qty<br />
  </cfquery><br />
  <cfif checkStock.recordCount GT 0><br />
  <cfset request.FieldError = "An item or items in your cart are no longer available or had quantities adjusted" /><br />
  <cfloop query="checkStock"><br />
    <cfif checkStock.SKU_Stock LTE 0><br />
      <cfquery  datasource="#request.dsn#" username="#request.dsnusername#" password="#request.dsnpassword#"><br />
      DELETE FROM tbl_cart <br />
      WHERE cart_Line_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#checkStock.cart_Line_ID#" /><br />
      </cfquery><br />
    <cfelse><br />
      <cfquery  datasource="#request.dsn#" username="#request.dsnusername#" password="#request.dsnpassword#"><br />
      UPDATE tbl_cart SET cart_sku_qty = <cfqueryparam cfsqltype="cf_sql_integer" value="#checkStock.SKU_Stock#" /><br />
      WHERE cart_Line_ID = <cfqueryparam cfsqltype="cf_sql_integer" value="#checkStock.cart_Line_ID#" /><br />
      </cfquery><br />
    </cfif><br />
  </cfloop><br />
  </cfif><br />
</cfif></p>
<p>Now, when a user comes back to view his cart, any items that are no longer available are removed from the cart and a message is displayed to the customer, and items that have smaller quantities available than were available at the time of the cart creation have their values adjusted. This only affects carts where Allow Backorders is unchecked in the Cartweaver admin. </p>
<p><strong>Update: 10/4/2009</strong> Thanks to Alex in the CW support newsgroup for pointing out that the method does not consider quantities in the cart greater than available quantities. It was written for one situation, but I have now adjusted the code to work with all situations where a quantity is no longer available for a given item</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=78</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=78</guid>
			<pubDate>Sat, 03 Oct 2009 15:22:04 GMT</pubDate>
		</item>
		<item>
			<title>Removing items from cart that are sold (PHP)</title>
			<description><![CDATA[<p>One of the frequent questions I get doing support for Cartweaver is &quot;How do I make sure that all the items in a customer's cart are still available?&quot; What happens is that a customer will place an item in the cart, and then leave the site. Another customer comes along and buys the product. The first customer comes back and tries to purchase the item, but cannot. Unfortunately, the customer doesn't find out until the order information is entered. </p>
<p>The following modification for the PHP version will remove items from the cart that are no longer available, and show the customer a message that an item has been removed from the cart because it is no longer available. </p>
<p>In CWIncFunctions.php, add the following section of code at line 470, right after this line:</p>
<p class="code"> $Cart[&quot;Products&quot;] = array();</p>
<p>Add the following code:</p>
<p class="code"> if(!$cartweaver-&gt;settings-&gt;allowBackOrders) {<br />
&nbsp;&nbsp;$query_rsCWCheckStock = sprintf(&quot;SELECT <br />
&nbsp;&nbsp;s.SKU_Stock, <br />
&nbsp;&nbsp;c.cart_Line_ID<br />
&nbsp;&nbsp;FROM tbl_cart c<br />
&nbsp;&nbsp;INNER JOIN tbl_skus s<br />
&nbsp;&nbsp;ON c.cart_sku_ID = s.SKU_ID<br />
&nbsp;&nbsp;WHERE c.cart_custcart_ID = '%s'<br />
&nbsp;&nbsp;AND s.SKU_Stock &lt; c.cart_sku_qty&quot;,$cartID);<br />
&nbsp;&nbsp;$rsCWCheckStock = $cartweaver-&gt;db-&gt;executeQuery($query_rsCWCheckStock, &quot;rsCWCheckStock&quot;);<br />
&nbsp;&nbsp;$rsCWCheckStock_recordCount = $cartweaver-&gt;db-&gt;recordCount;<br />
&nbsp;&nbsp;$row_rsCWCheckStock = $cartweaver-&gt;db-&gt;db_fetch_assoc($rsCWCheckStock); <br />
&nbsp;&nbsp;if($rsCWCheckStock_recordCount &gt; 0) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$cartweaver-&gt;setCWError(&quot;Item Sold&quot;, &quot;An item or items in your cart are no longer available or had quantities adjusted&quot;); <br />
&nbsp;&nbsp;&nbsp;&nbsp;do {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($row_rsCWCheckStock[&quot;SKU_Stock&quot;] &lt;= &quot;0&quot;) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query_rsCW = sprintf(&quot;DELETE FROM tbl_cart <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE cart_Line_ID = %d&quot;,$row_rsCWCheckStock[&quot;cart_Line_ID&quot;]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$rsCW = $cartweaver-&gt;db-&gt;executeQuery($query_rsCW, &quot;rsCW&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query_rsCW = sprintf(&quot;UPDATE tbl_cart SET cart_sku_qty = %d<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE cart_Line_ID = %d&quot;,$row_rsCWCheckStock[&quot;SKU_Stock&quot;], $row_rsCWCheckStock[&quot;cart_Line_ID&quot;]);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$rsCW = $cartweaver-&gt;db-&gt;executeQuery($query_rsCW, &quot;rsCW&quot;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;} while ($row_rsCWCheckStock = $cartweaver-&gt;db-&gt;db_fetch_assoc($rsCWCheckStock));<br />
&nbsp;&nbsp;}<br />
}
</p>
<p>Now, when a user comes back to view his cart, any items that are no longer available are removed from the cart and a message is displayed to the customer. This only affects carts where Allow Backorders is unchecked in the Cartweaver admin.</p>
<p><strong>Update: 10/4/2009</strong> Thanks to Alex in the CW support newsgroup for pointing out that the method does not consider quantities in the cart greater than available quantities. It was written for one situation for a customer, but I have now adjusted the code to work with all situations where a quantity is no longer available for a given item.]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=77</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=77</guid>
			<pubDate>Sat, 03 Oct 2009 14:13:18 GMT</pubDate>
		</item>
		<item>
			<title>PHP 5.3 deprecated functions -- Cartweaver PHP 3.1.16 released</title>
			<description><![CDATA[<p>PHP 5.3.0 has been released, and contains many changes from previous PHP releases. Because of this, we have updated the Cartweaver code to work with this release, and will also allow the code to work on PHP 6.0 as well.</p><p>The full list of release notes can be found at <a href="http://us2.php.net/migration53">http://us2.php.net/migration53</a>.</p><p>The main reason for the updated code is the fact that the following functions are now all deprecated in PHP and will throw E_DEPRECATED error messages when used (E_DEPRECATED is a new error message level). The functions are removed in PHP 6:</p><p><strong>Deprecated functions:</strong> </p><blockquote dir="ltr" style="margin-right: 0px"><p>call_user_method() (use call_user_func() instead) <br />call_user_method_array() (use call_user_func_array() instead) <br />define_syslog_variables() <br />dl() <br />ereg() (use preg_match() instead) <br />ereg_replace() (use preg_replace() instead) <br />eregi() (use preg_match() with the 'i' modifier instead) <br />eregi_replace() (use preg_replace() with the 'i' modifier instead) <br />set_magic_quotes_runtime() and its alias, magic_quotes_runtime() <br />session_register() (use the $_SESSION superglobal instead) <br />session_unregister() (use the $_SESSION superglobal instead) <br />session_is_registered() (use the $_SESSION superglobal instead) <br />set_socket_blocking() (use stream_set_blocking() instead) <br />split() (use preg_split() instead) <br />spliti() (use preg_split() with the 'i' modifier instead) <br />sql_regcase() <br />mysql_db_query() (use mysql_select_db() and mysql_query() instead) <br />mysql_escape_string() (use mysql_real_escape_string() instead) <br />Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead. <br />The is_dst parameter to mktime(). Use the new timezone handling functions instead. </p></blockquote><p>The functions previously used by Cartweaver are ereg(), ereg_replace(), session_unregister(), and split().</p><p>There is also a new PHP site devoted to Windows installations at <a href="http://windows.php.net/">http://windows.php.net/</a></p><p>If anyone has a Cartweaver version pre-3.1.16, you will want to download the latest version and apply the fixes/changes. To download Cartweaver, go to <a href="http://www.cartweaver.com/customers">http://www.cartweaver.com/customers</a> and login as a customer. You should see your downloads. If you have not updated a Cartweaver installation, the easiest way is to simply replace the files in the /cw3 folder. If you have made changes to any of the files in your site, the UpdateNotesCW3PHP.htm file details each change to each file showing line numbers and code before/after. I've found Beyond Compare (<a href="http://www.scootersoftware.com/">http://www.scootersoftware.com/</a>) to be a valuable tool for making line-by-line file changes, or comparing directories.<br /></p>
<p><strong>Update: 2009-09-08 6:47pm</strong> One thing I noticed on the PHP site is that the Windows ISAPI version of PHP is not supported any more. Hopefully the bugs have been addressed in the CGI versions, as previous versions of PHP were crash-prone when using the old CGI version. Supposedly the new FastCGI version is better.</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=75</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=75</guid>
			<pubDate>Wed, 09 Sep 2009 03:47:28 GMT</pubDate>
		</item>
		<item>
			<title>Customer Contact plugin hints</title>
			<description><![CDATA[Our new <a href="http://www.cartweaver.com/store/detail/?id=cwPICustContact" target="_self" title="Cartweaver Customer Contact Plugin">Customer Contact eNewsletter plugin</a> allows you to send emails to customers and other contacts in your Cartweaver database. Sending email through a browser is a little different than using a service, if you have not done it before -- the execution time will vary depending on the speed of your server and number of emails you are creating. A list of 1000 emails might take 1-3 minutes to complete, and bigger lists can take proportionally longer. I used to send to lists of 50,000-100,000 for a large company, and the browser would be open for up to an hour. Sending personalized email can be a slow process.<br /><br />As with anything, it's probably a good idea to test with smaller lists first, or lists consisting of your own email address, however there are a few things you can do if you are timing out or having other difficulties with larger lists: <br /><br /><strong>For PHP: </strong><br /><br />1. make sure you have a valid file and/or email address in the CWError.php file. This can help track down problems<br />&nbsp;<br />2. make sure that your php.ini setting for max_execution_time is set high enough for the large list. By default the maximum is 30 seconds, which can get you through a small list, but to send 1000 messages your maximum might need to be 100-200 seconds or more. Your page will take the full time to complete. <br />&nbsp;<br />3. Make sure web server timeouts are large enough. Consult your web server documentation about page request timeouts.<br />&nbsp;<br /><strong>For ColdFusion:</strong><br /><br />1. Make sure the ColdFusion setting for page execution is large enough, if it is enabled, or put a &lt;cfsetting&gt; tag in your cwcc_SendEmails.cfm file. This article talks about ColdFusion timeouts:<br /><a href="http://kb2.adobe.com/cps/194/tn_19438.html">http://kb2.adobe.com/cps/194/tn_19438.html</a><br /><br />2. Make sure web server timeouts are large enough. Consult your web server documentation about page request timeouts.<br /><br />]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=70</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=70</guid>
			<pubDate>Fri, 26 Jun 2009 00:10:46 GMT</pubDate>
		</item>
		<item>
			<title>New CW article at Community MX</title>
			<description><![CDATA[<p>I started a series at Community MX about modifying and enhancing the Cartweaver admin using the configuration options and custom coding. The first article is about adding a <a title="Cartweaver PHP Low Stock Warning" href="http://www.communitymx.com/content/article.cfm?cid=B6908">low-stock warning to your admin home page</a>.</p>
<p>Some other past Community MX articles about Cartweaver are:</p>
<blockquote>
<p><a href="http://www.communitymx.com/abstract.cfm?cid=52740">Integrating Cartweaver with a Page Design</a></p><p><a href="http://www.communitymx.com/abstract.cfm?cid=A4BB0">Showing Results and Details on One Page Using AJAX</a></p><p><a href="http://www.communitymx.com/abstract.cfm?cid=F9EAC">Using JumpStarts with Cartweaver, Featuring Minneapolis </a></p>
</blockquote>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=65</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=65</guid>
			<pubDate>Fri, 05 Jun 2009 01:21:33 GMT</pubDate>
		</item>
		<item>
			<title>Make Add to Cart buttons (php)</title>
			<description><![CDATA[<p>I get a lot of questions about making an Add to Cart button for Cartweaver. This is not something that is available out of the box, but easily implemented. Cartweaver doesn't work like Paypal, where you need static add to cart buttons to make the cart work. CW is self-contained and database driven, where all products are stored in the database. However, an add to cart button is easily added. I have been using them for years on my own site <a title="Tom Muck's web site" href="http://www.tom-muck.com/extensions" target="_blank">www.tom-muck.com/extensions</a>. The following can be added to the ProductForm.php file in the Cartweaver admin, right before the closing &lt;/div&gt; tag on the Page 1 div. Find this code:</p><p class="code">&nbsp;&lt;/div&gt;<br />&nbsp;&lt;div id=&quot;page2&quot;&gt;</p><p>add this:</p><p class="code">&lt;p&gt;&lt;a href=&quot;AddToCartButtons.php?prodId=&lt;?php echo($row_rsCWGetProduct[&quot;product_ID&quot;]);?&gt;&quot; target=&quot;_blank&quot;&gt;Make Add To Cart Buttons&lt;/a&gt;&lt;/p&gt;<br />&nbsp;&lt;/div&gt;<br />&nbsp;&lt;div id=&quot;page2&quot;&gt;</p><p>Now, create a new page in the /cw3/admin folder called AddToCartButtons.php and put this code on it:</p><p class="code">&lt;?php<br />include(&quot;application.php&quot;);<br />$productId = isset($_GET[&quot;prodId&quot;]) ? intval($_GET[&quot;prodId&quot;]): 0;<br/><br/>/* Get Product Data */<br />$query_rsCWGetProduct = sprintf(&quot;SELECT DISTINCT product_ID,<br />product_Name,<br />product_Description,<br />s.SKU_ID,<br />s.SKU_MerchSKUID<br />FROM tbl_products p<br />INNER JOIN tbl_skus s<br />ON p.product_ID = s.SKU_ProductID<br />WHERE product_ID = %d<br />AND product_Archive = 0<br />AND product_OnWeb = 1<br />&quot;, $productId);<br />$rsCWGetProduct = $cartweaver-&gt;db-&gt;executeQuery($query_rsCWGetProduct, &quot;rsCWGetProduct&quot;);<br />$rsCWGetProduct_recordCount = $cartweaver-&gt;db-&gt;recordCount;<br />$row_rsCWGetProduct = $cartweaver-&gt;db-&gt;db_fetch_assoc($rsCWGetProduct);</p><p>do {<br />?&gt;<br />&lt;h2&gt;&lt;?php echo($row_rsCWGetProduct[&quot;product_Name&quot;] .&quot;: skuid &quot; . $row_rsCWGetProduct[&quot;SKU_MerchSKUID&quot;]);?&gt;&lt;/h2&gt;<br />&lt;textarea cols=&quot;80&quot; rows=&quot;10&quot;&gt;</p><p>&lt;form action=&quot;details.php?prodId=&lt;?php echo($row_rsCWGetProduct[&quot;product_ID&quot;]);?&gt;&quot; method=&quot;post&quot; name=&quot;AddToCart&quot;&gt; <br />&nbsp;&lt;input name=&quot;qty&quot; type=&quot;hidden&quot; value=&quot;1&quot;&gt; <br />&nbsp; &lt;input name=&quot;skuid&quot; type=&quot;hidden&quot; value=&quot;&lt;?php echo($row_rsCWGetProduct[&quot;SKU_ID&quot;]);?&gt;&quot;&gt;<br />&nbsp; &lt;input name=&quot;prodId&quot; type=&quot;hidden&quot; value=&quot;&lt;?php echo($row_rsCWGetProduct[&quot;product_ID&quot;]);?&gt;&quot;&gt;<br />&nbsp; &lt;input name=&quot;submit&quot; type=&quot;submit&quot; class=&quot;formButton&quot; value=&quot;Add to Cart&quot;&gt; <br />&lt;/form&gt;&lt;/textarea&gt;<br />&lt;br/&gt;&lt;br/&gt;&lt;hr/&gt;<br />&lt;?php<br />} while ($row_rsCWGetProduct = $cartweaver-&gt;db-&gt;db_fetch_assoc($rsCWGetProduct));</p><p>That should do it. Now, when you click the link, the page populates with add to cart button code for each sku for that product.</p><p>The add to cart button code looks like this:</p><p class="code">&lt;form action=&quot;details.php?prodId=31&quot; method=&quot;post&quot; name=&quot;AddToCart&quot;&gt; <br />&nbsp;&lt;input name=&quot;qty&quot; type=&quot;hidden&quot; value=&quot;1&quot;&gt; <br />&nbsp; &lt;input name=&quot;skuid&quot; type=&quot;hidden&quot; value=&quot;59&quot;&gt;<br />&nbsp; &lt;input name=&quot;prodId&quot; type=&quot;hidden&quot; value=&quot;31&quot;&gt;<br />&nbsp; &lt;input name=&quot;submit&quot; type=&quot;submit&quot; class=&quot;formButton&quot; value=&quot;Add to Cart&quot;&gt; <br />&lt;/form&gt;</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=64</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=64</guid>
			<pubDate>Sat, 30 May 2009 01:49:09 GMT</pubDate>
		</item>
		<item>
			<title>Integrating a page design</title>
			<description><![CDATA[<p>I posted a new free article at Community MX, intended mostly for beginners with   Cartweaver on integrating a page design with Cartweaver: <a href="http://www.communitymx.com/content/article.cfm?cid=52740" title="Integrating a Page Design with Cartweaver">http://www.communitymx.com/content/article.cfm?cid=52740.</a></p>
<p>The article shows how to use the standard Dreamweaver page layouts with Cartweaver, but is intended to show how any page design can be made to work with Cartweaver, and explains the include file concept that we use.</p>
]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=54</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=54</guid>
			<pubDate>Sat, 13 Sep 2008 13:51:16 GMT</pubDate>
		</item>
		<item>
			<title>New round of SQL injection attempts</title>
			<description><![CDATA[ <p>Be on the watch for new SQL injection attempts, coming from China, using an ascii-encoded binary string. Essentially, what it does is find a vulnerable database and append a string to the fields in every table. The string is  a closing &lt;/title&gt; tag with a script, followed by a comment to hide the rest of the page:
</p>
<p><a target="_blank" href="http://www.bloombit.com/Articles/2008/05/ASCII-Encoded-Binary-String-Automated-SQL-Injection.aspx">http://www.bloombit.com/Articles/2008/05/ASCII-Encoded-Binary-String-Automated-SQL-Injection.aspx</a></p>
<p>I put something like this in my application.cfm file to re-rout the 
	attackers temporarily:</p>
<p class='code'>&lt;cfif FindNoCase('user&gt;0',cgi.query_string) OR findNoCase('declare',cgi.query_string) <br>
	OR findNoCase('EXEC(@',cgi.query_string)&gt;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&lt;cflocation url=&quot;http://www.ftc.gov&quot;&gt;<br>
&lt;/cfif&gt;<br>
</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=52</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=52</guid>
			<pubDate>Fri, 08 Aug 2008 17:08:42 GMT</pubDate>
		</item>
		<item>
			<title>Using GoDaddy with Cartweaver -- Transactions</title>
			<description><![CDATA[<p>GoDaddy provides an excellent service for domain registration and domain management, but when it comes to web hosting, there are a few gotchas to be aware of. One of them is the proxy server that is used for SSL. When you are setting up your e-store and using a payment gateway like Authorize.Net, you have to communicate via SSL behind the scenes. In ColdFusion, this is done with the &lt;cfhttp&gt; tag. In PHP, it is done with cURL or OpenSSL.</p>
<p>To convert the payment gateway file in Cartweaver to use the proxy server, you have to edit the file located in /cw3/CWLibrary/ProcessPayment/ for PHP or /cw3/CWTags/ProcessPayment/ for ColdFusion. A typical file would be CWIncAuthorizeNet.cfm or CWIncAuthorizeNet.php. For ColdFusion, the code looks like this:</p>
<p class="code">&lt;cfhttp url=&quot;<a href="https://secure.authorize.net/gateway/transact.dll">https://secure.authorize.net/gateway/transact.dll</a>&quot;<br />
	method=&quot;post&quot;
	&gt;</p>
<p>You would change it to this to use the proxy server:</p>
<p class="code">&lt;cfhttp url=&quot;<a href="https://secure.authorize.net/gateway/transact.dll">https://secure.authorize.net/gateway/transact.dll</a>&quot;<br />
	method=&quot;post&quot;<br />
	proxyserver=&quot;proxy.shr.secureserver.net&quot;<br />
	proxyport=&quot;3128&quot;
&gt;</p>
<p>For PHP, the cURL code looks like this:</p>
<p class="code"> $url = &quot;https://secure.authorize.net&quot;;<br />
$path = &quot;/gateway/transact.dll&quot;;<br />
<br />
// post back to Authorize.net system <br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL,$url . $path);<br />
curl_setopt($ch, CURLOPT_VERBOSE, 1);<br />
curl_setopt($ch, CURLOPT_POST, true);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);<br />
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);<br />
$authNetResult = curl_exec($ch);<br />
curl_close ($ch);</p>
<p>You have to add a few lines for the proxy:</p>
<p class="code">$url = &quot;https://secure.authorize.net&quot;;<br />
	$path = &quot;/gateway/transact.dll&quot;;<br />
	<br />
// post back to Authorize.net system <br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_URL,$url . $path);<br />
curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);<br />
curl_setopt ($ch,   CURLOPT_PROXYTYPE, CURLPROXY_HTTP);<br />
curl_setopt ($ch,   CURLOPT_PROXY,&quot;http://proxy.shr.secureserver.net:3128&quot;); <br />
curl_setopt($ch, CURLOPT_VERBOSE, 1);<br />
curl_setopt($ch, CURLOPT_POST, true);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);<br />
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);<br />
$authNetResult = curl_exec($ch);<br />
curl_close ($ch);</p>
<p>If you still can't get it to work, call GoDaddy support. They can usually help. GoDaddy does not outsource their support overseas, unlike other companies, and is usually pretty good and easy to get on the phone.<br />
</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=50</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=50</guid>
			<pubDate>Sat, 19 Jul 2008 14:30:38 GMT</pubDate>
		</item>
		<item>
			<title>Adding a second payment type in ColdFusion</title>
			<description><![CDATA[<p>This modification can be used for &quot;Pay by Credit Card or Check&quot; or for &quot;Pay now or request a Quote&quot;. 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 &quot;none&quot; on the fly, based on user input. The code for this modification in PHP is shown at <a href="http://www.tom-muck.com/cw/">http://www.tom-muck.com/cw/</a></p>
<p>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>
<p class="code">&lt;p&gt;Pay by:&lt;br /&gt;<br />
  Send check:<br />
  &lt;input type=&quot;radio&quot; name=&quot;paymenttype&quot; value=&quot;0&quot; checked=&quot;checked&quot; /&gt;<br />
  Credit Card:<br />
  &lt;input type=&quot;radio&quot; name=&quot;paymenttype&quot; value=&quot;1&quot; /&gt;<br />
  &lt;/p&gt;<br />
</p>
<p> then add a bit of code to the CWIncOrderForm.cfm file around line 43, right after &lt;cfif IsDefined ('FORM.OrderFormNext')&gt; :</p>
<p class="code"> &lt;cfif isDefined(&quot;Form.paymenttype&quot;)&gt;<br />
&lt;cfset session.paymenttype = form.paymenttype /&gt;<br />
&lt;/cfif&gt;</p>
<p>then a bit of code to the CWIncShowCart.cfm file:</p>
<p class="code">&lt;cfif IsDefined(&quot;Session.paymenttype&quot;)&gt;<br />
&nbsp;&lt;cfswitch expression=&quot;#Session.paymenttype#&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;cfcase value=&quot;0&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthType = &quot;none&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthName = &quot;none&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/cfcase&gt; <br />
&nbsp;&nbsp;&nbsp;&lt;cfcase value=&quot;1&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthType = &quot;gateway&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthName = &quot;CWIncAuthorizeNet.cfm&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/cfcase&gt;<br />
&nbsp;&lt;/cfswitch&gt;<br />
&lt;/cfif&gt;</p>

<p>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:</p>
<p class="code">&lt;cfif IsDefined(&quot;Session.paymenttype&quot;)&gt;<br />
&nbsp;&lt;cfswitch expression=&quot;#Session.paymenttype#&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;cfcase value=&quot;0&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthType = &quot;none&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthName = &quot;none&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/cfcase&gt; <br />
&nbsp;&nbsp;&nbsp;&lt;cfcase value=&quot;1&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthType = &quot;gateway&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset request.paymentAuthName = &quot;CWIncAuthorizeNet.cfm&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&lt;/cfcase&gt;<br />
&nbsp;&lt;/cfswitch&gt;<br />
&lt;/cfif&gt;</p>
<p>Then you can make your changes in the email within the CFMAIL tag however you like, such as:</p>
<p class="code">Your order has been received.<br />
	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.<br/><br/>
#EmailContents# </p>
<p>You might also add a bit of code after the &lt;h2&gt;Order Details&lt;/h2&gt; line:</p>
<p class="code">&lt;h2&gt;Order Details&lt;/h2&gt;<br />
	&lt;cfif request.paymentAuthType EQ &quot;none&quot;&gt;<br />
&lt;p&gt;Your order has been recieved. The order will be shipped when your check or money order is received.&lt;/p&gt;<br />
&lt;/cfif&gt;</p>
<p>This could also be used to switch between a gateway and Paypal, or even 3 options -- credit card, check, or Paypal. </p>
<p><strong>Update:</strong> 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:</p>
<p class="code">&lt;a href="&lt;cfoutput&gt;#request.targetCheckOut#&lt;/cfoutput&gt;"&gt;&lt;strong&gt;Change your 
payment type&lt;/strong&gt;&lt;/a&gt;</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=46</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=46</guid>
			<pubDate>Sun, 11 May 2008 15:37:41 GMT</pubDate>
		</item>
		<item>
			<title>Protect that download directory</title>
			<description><![CDATA[<p>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:</p>
<p>Deny from all</p>
<p>or</p>
<p>Redirect /yourstorefolder/ http://yourdomain.com/yourstorefolder/error.php?error=No%20access%20allowed%20</p>
<p>That should take care of any attempts to download from the folder.</p>
<p>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.<br />
</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=42</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=42</guid>
			<pubDate>Sun, 30 Mar 2008 05:00:00 GMT</pubDate>
		</item>
		<item>
			<title>New price format string functionality in Cartweaver</title>
			<description><![CDATA[<p>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:</p>
<p>The function takes these arguments.<br />
	<strong>productID</strong>: The product ID to display.<br />
	<strong>allowBackOrders</strong>: Do we allow back orders?<br />
	<strong>taxRate</strong>: Rate of tax for the item<br />
	<strong>currentRecord</strong>: row number for CSS ids<br />
	<strong>showMax</strong>: flag to show max price along with min price<br />
	<strong>priceFormat</strong>: string with replaceable masks for price parts</p>
<p>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:<br />
	@@beforeDiscountPrice@@<br />
	@@currentPrice@@<br />
	@@tax@@<br />
	@@priceWithTax@@<br />
	@@taxAmount@@<br />
</p>
<p>Use in combination with <strong>showMax</strong>. By default, minimum and maximum price of product are shown ($1.00 - $5.00).
Set to false to show only the minimum price. Then, <strong>priceFormat</strong> can be used to format the price like this:</p>
<p>	for example, assuming a 50% discount, 5% tax rate, showing prices before tax and after tax:<br />
	@@beforeDiscountPrice@@ @@currentPrice@@ (@@priceWithTax@@ including @@tax@@% tax)<br />
	shows <span style="text-decoration: line-through;">2.00 - 10.00 (2.10 - 10.50 including 5% tax)</span> 1.00 - 5.00 (1.05 - 5.25 including 5% tax)</p>
<p>Another example shows displaying minimum price only with 50% discount, 25% VAT, and showing price with VAT included and excluded:<br /> 
	@@beforeDiscountPrice@@ @@priceWithTax@@ (@@currentPrice@@ + @@taxAmount@@ VAT)<br />
shows 	<span style="text-decoration: line-through;"> 2.50 (2.00 excluding.50 VAT)</span> 1.25  (1.00 excluding .25 VAT)</p>
<p>A simple example with no discount and no tax, showing only minimum price:<br />
	Prices starting at @@currentPrice@@<br />
	shows: Prices starting at $1.00</p>
<p>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:</p>
<p>$_SESSION[&quot;PriceFormatString&quot;] = "@@beforeDiscountPrice@@ @@priceWithTax@@ (@@currentPrice@@ + @@taxAmount@@ VAT)";</p>
<p>Or for CF:<br/><br/>
&lt;cfset Session.PriceFormatString = &quot;@@beforeDiscountPrice@@ @@priceWithTax@@ (@@currentPrice@@ + @@taxAmount@@ VAT)&quot;&gt;</p>
<p><strong>UPDATE:</strong></p>
<p>The getPriceList() function is called like this:</p>
<p class="code">

echo(getPriceList($productID,  <br/>
$allowBackOrders, <br/>
$taxRate, <br/>
$currentRecord, <br/>
$showMax,<br/>
$priceFormat));<br/>
</p><p>
Essentially, you find the place on CWIncResults or CWIncDetails where the function is being called from, and adjust it to your liking:</p>
<p class="code">


echo(getPriceList($row_rsCWGetProduct["product_ID"], <br/>
$cartweaver->settings->allowBackOrders, <br/>
$taxRate, <br/>
', <br/>
true, <br/>
$priceFormatString));</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=41</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=41</guid>
			<pubDate>Mon, 03 Mar 2008 23:19:11 GMT</pubDate>
		</item>
		<item>
			<title>Open House at Community MX</title>
			<description><![CDATA[<p><a href="http://www.communitymx.com/" title="Community MX -- Web Developmend tutorials">Community MX</a> is having an open house where visitors are able to view over 2400 articles and tutorials. Community MX is a subscription service, so this is a good opportunity to see what is available. The open house is from 12/24/2007 through 1/1/2008. </p>
<p>Some articles relevant to Cartweaver users are <a href="http://www.communitymx.com//abstract.cfm?cid=F9EAC">Using JumpStarts with Cartweaver, Featuring   Minneapolis</a>, <a href="http://www.communitymx.com//abstract.cfm?cid=A1009C7E225D7B46">Using a ColdFusion Custom Tag as a   Site Template</a>, 
<a href="http://www.communitymx.com//abstract.cfm?cid=CD8AF">Resending Undeliverable Mail in ColdFusion</a>, <a href="http://www.communitymx.com//abstract.cfm?cid=A5B54EAAE1BC138F">Writing Readable SQL</a>, <a href="http://www.communitymx.com//abstract.cfm?cid=54E52">PHP Site Simplification with Application.php</a>. For a full list of what I've written for Community MX, see this page: <a href="http://www.communitymx.com/author.cfm?cid=1003">http://www.communitymx.com/author.cfm?cid=1003</a></p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=37</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=37</guid>
			<pubDate>Mon, 24 Dec 2007 14:19:49 GMT</pubDate>
		</item>
		<item>
			<title>Adding Payment Gateways and Processors</title>
			<description><![CDATA[<p>There are literally hundreds of payment processors out there. We support a   few out of the box, and have several others available as free downloads to customers, but it is not too difficult to add a new payment processor   using an existing gateway/processor as a guide.<br />
		<br />
	Basically there are two   types of payment processors: gateway or processor. A gateway communicates behind the scenes (like   Authorize.net) and processes the transaction in realtime, and a processor shows a form on a third-party web site, and credit card data is collected there (like   Paypal.)<br />
	<br />
	The basic procedure to create a new payment processor file in Cartweaver is to get the API from your payment   processor, and use one of our payment processor files as a guide. Modify the   form values in the file to use the names specified by your processor (for   example, it might use &quot;x-lastname&quot; or &quot;UserLastName&quot; or &quot;LastName&quot;). Once you do   this, you should be able to turn on the debugging email functionality, post test   transactions to your payment processor, and proceed from there. </p>
<p>The next step is to parse the result, and all payment processors handle this differently. For example, Authorize.Net passes results in comma-delimited form, so this sample line would parse the result, for PHP:</p>
<p class="code">$authNetCodes = explode(&quot;,&quot;,$authNetResult);</p>
<p>For ColdFusion, use the simple list functions:</p>
<p class="code">&lt;cfset request.TransactionResult = Val(ListFirst(cfhttp.fileContent))&gt;</p>
<p>Some processors use name/value pairs in a querystring. The following will parse those types of results in PHP:</p>
<p class="code"> $resultArray = explode('&amp;', $result);<br />
foreach($resultArray as $val) {<br />
&nbsp;&nbsp;$temp = explode('=', $val);<br />
&nbsp;&nbsp;$response[$temp[0]] = $temp[1];<br />
}</p>
<p>or for ColdFusion:</p>
<p class="code">&lt;cfset resultArray = ListToArray(result, &quot;&amp;&quot;)&gt;<br />
	&lt;cfset response = StructNew()&gt;<br />
	&lt;cfloop from=&quot;1&quot; to=&quot;#ArrayLen(resultArray)#&quot; index=&quot;i&quot;&gt;<br />
&nbsp;&nbsp;&lt;cfset response[ListFirst(resultArray[i], &quot;=&quot;)] = ListLast(resultArray[i], &quot;=&quot;)&gt;<br />
&lt;/cfloop&gt;</p>
<p>After this parsing, you can read the response array/struct values using the variable names described in the gateway API document, such as $response[&quot;success&quot;]. The main point is that we have quite a few payment processors available, and although each one is different, you can probably locate code in these files that will assist you in creating a new payment processor file. For a list of which processors we support, check <a href="http://www.cartweaver.com/features/payments/" title="Cartweaver payment processors">http://www.cartweaver.com/features/payments/</a><br />
	<br />
	If you   find out about the API and want me to take a look at it, let me know through my <a href="http://www.tom-muck.com/contact.cfm" title="Contact Tom Muck">contact form</a>. In the past I   have converted payment processor files for customers for a fee, but it does not   usually fit into my schedule.</p>
]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=34</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=34</guid>
			<pubDate>Fri, 09 Nov 2007 14:15:37 GMT</pubDate>
		</item>
		<item>
			<title>Locale settings in Cartweaver PHP</title>
			<description><![CDATA[<p>One of the frequent questions we get is about locales in Cartweaver PHP. Because of the varying nature of locale settings in Windows, Linux, Mac, and other systems running PHP, it is hard to come up with a reliable way to get the locale setting of the server. The locale setting is in application.php, and is how we determine how to format money and date/time displays. For Windows systems, the Dreamweaver setup server behavior takes care of this. A full list of Windows locales is at <a href="http://tom-muck.com/cw/windowslocales.cfm">http://tom-muck.com/cw/windowslocales.cfm</a>. Linux locales are not quite as easy. For that reason, we include a file at http://[yourserver]/cw3/setup/locales/CWGetLocales.php that lists your locales on your server. This is a Linux-only function, and does not work on all Linux server due to security restrictions. I have posted a list of locales on my Linux server at <a href="http://www.tom-muck.com/cw/linuxlocales.cfm">http://www.tom-muck.com/cw/linuxlocales.cfm</a>.</p>
<p>If you are unable to obtain the locale setting on your server, and the listed locales do not work, you can modify the function in CWIncFunctions.php to hard-code the currency symbol like this:</p>
<p class="code">// for CW3<br />
	function cartweaverMoney($theNum, $showCurrencySymbol = true,   $stripComma = false) {<br />&nbsp;&nbsp;$currencySymbol = '$';<br />&nbsp;&nbsp;$theNum =   number_format($theNum, 2, &quot;.&quot;,&quot;,&quot;);<br />&nbsp;&nbsp;if($showCurrencySymbol) $theNum =   $currencySymbol . $theNum;<br />&nbsp;&nbsp;if($stripComma) $theNum =   str_replace(&quot;,&quot;,&quot;&quot;,$theNum);<br />return $theNum;<br />
}</p>
<p>Some typical locales for US format are:</p>
<ul>
<li>en_US</li>
<li> en_US.iso88591 </li>
<li> en_US.iso885915 </li>
<li>english-us</li>
<li>eng</li>
</ul>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=32</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=32</guid>
			<pubDate>Mon, 05 Nov 2007 02:54:34 GMT</pubDate>
		</item>
		<item>
			<title>Using Application.cfc with Cartweaver ColdFusion</title>
			<description><![CDATA[<p>Cartweaver was designed for use with the Application.cfm file, but versions 7 and 8 of ColdFusion allow the use of an Application.cfc file, giving greater control over application events. Cartweaver can be used with Application.cfc with a few tweaks. </p>
<p>1. First, set up your Application.cfc with some settings (these would be from your cfapplication tag):</p>
<p class="code">&lt;cfcomponent&gt;<br />  &lt;!--- Initialize the application ---&gt;<br />
&lt;cfscript&gt;<br />
this.name = &quot;testCW&quot;; // make sure every application has a unique name<br />
  
  this.applicationTimeout = createTimeSpan(7,0,0,0);<br />
  this.clientmanagement= &quot;yes&quot;;<br />
  this.sessionmanagement = &quot;yes&quot;;<br />
  this.sessiontimeout = createTimeSpan(0,0,30,0);<br />
  this.setClientCookies = &quot;yes&quot;;<br />
  this.clientstorage=&quot;clientvariables&quot;; // datasource for client variables <br />
&lt;/cfscript&gt;</p>
<p>2. Then, copy the &lt;cfmodule&gt; tag from your existing Application.cfm to your onRequestStart method. </p>
<p class="code"> &lt;!--- On request start ---&gt;<br />
&lt;cffunction name=&quot;onRequestStart&quot;&gt; <br />
&nbsp;&nbsp;&lt;cfargument name=&quot;requestname&quot; required=true/&gt;
<br />
&nbsp;&nbsp;&lt;cfmodule <br />
  &nbsp;&nbsp;&nbsp;&nbsp;id = &quot;CW3GlobalSettings&quot;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;template = &quot;cw3/CWTags/CWTagGlobalSettings.cfm&quot; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;datasource = &quot;yourdatasource&quot;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;etc.....  &gt; <br />
&lt;/cffunction&gt;</p>
<p>3. In the onError method,   you'll have to create your own error handling to 
take the place of the error   pages.</p>
<p>4. Rename OnRequestEnd.cfm at the store root to debugger.cfm and   include 
this method in Application.cfc (if you want the   debugging functionality of CW):</p>
<p class="code">
&lt;cffunction name=&quot;onRequestEnd&quot; output=&quot;true&quot;&gt;<br />
&nbsp;&nbsp;&lt;cfargument type=&quot;String&quot; name=&quot;targetPage&quot; required=true/&gt;<br />
&nbsp;&nbsp;&lt;cfinclude template=&quot;debugger.cfm&quot;&gt;<br />
&lt;/cffunction&gt;</p>
<p>5. Include other methods, if needed (onSessionStart, onSessionEnd, etc).</p>
<p>6. Close the component tag:</p>
<p class="code">&lt;/cfcomponent&gt;</p>
<p>7. We include two files of frequently used functions in application.cfm because they are used thoughout the application, but that won't work in 
  Application.cfc. Add these two include files to the rest of your presentation 
  pages (results, details, confirmation, orderform, and showcart):</p>
<p class="code">
&lt;cfinclude   template=&quot;cw3/CWTags/CWIncFunctions.cfm&quot;&gt;<br />
&lt;cfinclude   template=&quot;cw3/CWTags/CWIncDiscountFunctions.cfm&quot;&gt;</p>
<p>8. 
Then create   an ApplicationProxy.cfc file at the store root with this in it:</p>
<p class="code">
&lt;cfcomponent   name=&quot;ApplicationProxy&quot;   extends=&quot;Application&quot;&gt;&lt;/cfcomponent&gt;
</p>
<p>9. That is for the admin functionality, which will have it's own Application.cfc extending the site root Application.cfc. Put a new  Application.cfc file at the root of /cw3/admin, including only 
  the   onRequestStart function:</p>
<p class="code">
&lt;cfcomponent name=&quot;Application&quot;   extends=&quot;ApplicationProxy&quot;&gt;<br />
&nbsp;&nbsp;&lt;cffunction   name=&quot;onRequestStart&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfargument name=&quot;requestname&quot;   required=true/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;cfset   super.onRequestStart(requestname)&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--- Here, insert everything   from the Application.cfm from the admin 
folder<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EXCEPT for the application.cfm include and the error handling ----&gt;<br />
&nbsp;&nbsp;&lt;/cffunction&gt;<br />
&lt;/cfcomponent&gt;</p>
<p>That should be all that is required. There can be further optimizations, however this should give you a working site.</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=26</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=26</guid>
			<pubDate>Wed, 17 Oct 2007 00:22:18 GMT</pubDate>
		</item>
		<item>
			<title>Adding CSV File Downloads to the Cartweaver Admin (PHP)</title>
			<description><![CDATA[<p>I dug up an old PHP class that I wrote a few years back and thought I would post it for anyone who needs CSV functionality on their site. It will work with any PHP recordset, including Cartweaver recordsets, which use my custom DB abstraction class (only for MySQL, though). The class is simple, and can be downloaded <a href="http://www.tom-muck.com/downloads/csvfile.zip">here</a>.</p>
<p>The class is typically used on a page by itself, or on any page within conditional statements. You link to the page and the file download begins. The class constructor has 3 arguments:</p>
<p class="code">$csvfile = new CSVFile(recordsetName, [quotes true or false], [filename]);</p>
<p>The first is the MySQL recordset. The second optional argument is true or false to put quotes around the fields. The third optional argument is the filename, which defaults to Download.csv by default.</p>
<p>To use it, follow these instructions:</p>
<p>1. If this is a Cartweaver recordset, make sure you include the application.php file at the top of the page:</p>
<p class="code">require_once(&quot;application.php&quot;);</p>
<p>2. Include the class file:</p>
<p class="code">require_once(&quot;yourclassdirectory/CSVFile.php&quot;);</p>
<p>3. Create your recordset. Below is a typical Dreamweaver recordset, using the Northwind database that you can download <a href="http://www.tom-muck.com/downloads/northwindmysql.zip">here</a> for MySQL if you don't have it:</p>
<p class="code">mysql_select_db($database_connNorthwind, $connNorthwind);<br />
  $query_rs = &quot;SELECT p.ProductID, p.ProductName, p.UnitPrice FROM products p ORDER BY p.ProductID&quot;;<br />
  $rs = mysql_query($query_limit_rs, $connNorthwind) or die(mysql_error());<br /></p>
<p>For Cartweaver, a typical recordset might look like this:</p>
<p class="code">  $query_rs = &quot;SELECT * FROM tbl_orders ORDER BY order_Date&quot;;<br />
  $rs = $cartweaver-&gt;db-&gt;executeQuery($query_rs, &quot;rs&quot;);<br />
</p>
<p>4. Add a line to invoke the CSVFile class:</p>
<p class="code">$csvfile = new CSVFile($rs, true);</p>
<p>5. Link to the file. </p>
<p>Now, when the page is browsed, the file download will begin immediately.</p>
<p>Cross-posted from <a href="http://www.tom-muck.com/blog/index.cfm?newsid=173" title="PHP class for CSV file from Tom-Muck.com">tom-muck.com</a>. See <a href="http://blog.cartweaver.com/index.cfm?newsid=23" title="Cartweaver CSV file download for ColdFusion">this blog post</a> for info on creating a button in the CW admin for order downloads.</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=24</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=24</guid>
			<pubDate>Sat, 13 Oct 2007 15:14:18 GMT</pubDate>
		</item>
		<item>
			<title>Adding CSV File Downloads to the Cartweaver Admin (ColdFusion)</title>
			<description><![CDATA[<p>One of the frequent requests in the forums is to provide a downloadable list of orders, customers, products, or other items from the Cartweaver admin. The following applies to ColdFusion, but is an easy way to create downloadable files for Quickbooks, Excel, or other applications where you might need a CSV file. </p>
<p>The functionality revolves around a custom tag I wrote a while back called CF_CSVFILE. You can find it available free on my blog:</p>
<p><a href="http://www.tom-muck.com/blog/index.cfm?newsid=46">http://www.tom-muck.com/blog/index.cfm?newsid=46</a></p>
<p>I'll go through a simple example using the Cartweaver orders page. The basic technique to using this tag within CW (or any other application) is to create a &lt;cfquery&gt; tag using the data you want to download, put the csvfile tag on the page, and then simply link to the page. We can do this with dynamic queries as well -- the orders page uses form fields to create the display list. We can simply divert this form to a new OrdersDownload.cfm page by following these steps:</p>
<p>1. Create a file called OrdersDownload.cfm. It should be totally blank -- no tags or any other characters in the file.</p>
<p>2. Save the csvfile.cfm tag from my blog to a directory within /cw3/admin called &quot;tags&quot;. </p>
<p>3. Add this code to the top of the OrdersDownload.cfm file: <br />
<br />
<span class="code">&lt;cfimport prefix=&quot;mytag&quot; taglib=&quot;tags&quot;&gt;</span></p>
<p>4. Copy the rsByDate query from the Orders.cfm page to the OrdersDownload.cfm page.</p>
<p>5. Add the reference to the csvfile custom tag to the OrdersDownload page beneath the query:<br /><br />
<span class="code">&lt;mytag:csvfile rs=#rsByDate#&gt;</span></p>
<p>6. Add a new button to the Orders.cfm page next to the submit button that is already there to create a link to the new form post:<br /><br />

<span class="code">&lt;input name=&quot;Submit2&quot; type=&quot;submit&quot; class=&quot;formButton&quot; value=&quot;Download Orders&quot; &nbsp; onclick=&quot;document.DateForm.action='OrdersDownload.cfm'&quot;&gt; </span></p>
<p>That's all there is to it. It looks more complicated than it is, and can be used with any query. For example, to create a downloadable list of all customers, create the CustomersDownload page with this code:</p>
<p class="code">&lt;cfimport prefix=&quot;mytag&quot; taglib=&quot;tags&quot;&gt;<br />
  &lt;!--- retrieve all customers ---&gt;<br />
  &lt;cfquery name=&quot;rsCustomers&quot; datasource=&quot;#request.dsn#&quot;&gt;<br />
  SELECT * FROM tbl_customers<br />
  &lt;/cfquery&gt;<br />
&lt;mytag:csvfile rs=#rsCustomers#&gt;</p>
<p>Then simply link to it. Since you are getting all customers, you don't need the submit button or extra javascript -- a simple link will do.</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=23</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=23</guid>
			<pubDate>Sat, 13 Oct 2007 02:15:59 GMT</pubDate>
		</item>
		<item>
			<title>Changing Cartweaver Shipping Options</title>
			<description><![CDATA[<p>One of the frequent questions we see in the forums is &quot;How do I implement XXXX shipping?&quot; Cartweaver has flexible shipping, but we also left it open for others to implement their own shipping. The key to CW shipping is in the file  CWFunShipping (or CWTagShipping in ColdFusion). The getShippingRates() function (cwShipping() in the ASP version) returns the shipping cost, given weight or cart cost. There are several things that can be done in this function if you need more complex shipping than CW offers (such as real-time UPS or FedEx shipping), or simpler shipping (such as &quot;$4 shipping for all orders&quot;), or conditional shipping (such as &quot;free shipping over $100&quot;).</p>
<p>If you keep in mind that the shipping function returns the shipping cost, you can use logic to determine the cost. The function is dual purpose, however. If the mode &quot;ShipList&quot; is passed to the function, it returns a list of shipping functions. If the mode &quot;Calculate&quot; is passed, the return value will be the shipping cost. So you must check first for the mode and then return the shipping cost if the mode is &quot;Calculate&quot;.</p>
<p>For UPS/FedEx, you would need a script to contact UPS/FedEx, and an account with them. Modify the getShippingRates() function to use the script:</p>
<p class="code"> // If not listing ship methods, call your UPS function<br />
if($mode == &quot;Calculate&quot;) return getMyUPSFunction();</p>
<p>For simpler shipping, first make sure you have set up a shipping method in the CW admin, then simply re-write the function to use your simpler shipping, such as:</p>
<p class="code"> // If not listing ship methods, return $4 for shipping cost<br />
if($mode == &quot;Calculate&quot;) return 4;</p>
<p>For conditional shipping, simply add a line in the function before any other calculations are made:</p>
<p class="code"> // If over $100, return 0 for shipping<br />
if($mode == &quot;Calculate&quot; &amp;&amp; $cartTotal &gt; 100) return 0;</p>
<p>You could also create your own custom function here to use your own criteria for shipping.</p>
<p>The bottom line is that CW shipping is flexible, but it is also easily changed if you need something different.
</p>
<p><strong>Update (11/12/2007): </strong>Another simple modification is to charge X$ for each item in the cart, like $3 shipping for 4 items would be $12. Basically you need to pass a quantity to the function and rewrite the function so that it multiplies $3 x number of items. Add a quantity field at the end of the method:</p>
<p>function getShippingRates($mode=&quot;ShipList&quot;, $shipType=null, $shipToCountryID=0, $cartWeight=0, $cartTotal=0, $qty=0)</p>
<p>Then add a line as first line of the function:</p>
<p>if($mode == &quot;Calculate&quot;) return $qty * 3;</p>
<p>Then change the calls to getShippingRates() to pass the cart quantity to the function on CWIncShowCartSetup.php.</p>
<p>$_SESSION[&quot;shipTotal&quot;] = getShippingRates(&quot;Calculate&quot;, null, 0, 0, 0, $cartweaver-&gt;getCartQty());</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=20</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=20</guid>
			<pubDate>Wed, 19 Sep 2007 12:22:46 GMT</pubDate>
		</item>
		<item>
			<title>Adding New Image Types to Cartweaver 3</title>
			<description><![CDATA[<p>One of the limitations of Cartweaver 2 was that only 2 images were allowed per product, and the system was not set up to allow for more image types. Cartweaver 3 comes with 4 image types out of the box and allows the programmer to add as many more images as he needs. All that is required is add the image type to the database, create the folder, and then manually code the image somewhere in the details page. </p>
<p>For example, to add an image type of &quot;Secondary&quot;, follow these steps:</p>
<blockquote>
  <p>1. Add &quot;Secondary&quot; to the tbl_listimgtypes table and then note it's ID. It is probably 5. You can do this in any database admin, or run an insert statement like this:</p>
  <p class="code">INSERT INTO tbl_list_imagetypes (imgType_Name, imgType_SortOrder, imgType_Folder) VALUES <br />
    ('Secondary', 1, 'cw3/assets/product_secondary/')</p><p>2. Create the product_secondary folder in the /cw3/assets/ directory (or whereever you are storing images).</p>
  <p>3. Display it on the details page with:</p>
  <p class="code">&lt;?php echo(cwDisplayImage($productId, 5, $row_rsCWGetProduct[&quot;product_Name&quot;], &quot;No image available&quot;));?&gt;</p>
  <p>...for php, or:</p>
  <p class="code">&lt;cfoutput&gt;#cwDisplayImage(request.Product_ID, 5, rsGetProduct.product_Name, &quot;No image available&quot;)#&lt;/cfoutput&gt;</p>
  <p>...for ColdFusion, or:</p>
  <p class="code">&lt;%= cwDisplayImage(rsCWGetProduct(&quot;product_ID&quot;), 5, rsCWGetProduct(&quot;product_Name&quot;), &quot;No image available&quot;) %&gt;</p>
  <p>...for ASP.</p>
</blockquote>
<p>The function cwDisplayImage takes the following arguments:</p>
<p><strong>cwDisplayImage([product id], [image type], [product name, or alt text], [to display if no image available])</strong></p>
<p>After adding the new image type to the database, it will show up among the images to be uploaded in the Cartweaver admin. You can have an unlimited number of images per product.</p>
]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=18</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=18</guid>
			<pubDate>Wed, 12 Sep 2007 13:50:53 GMT</pubDate>
		</item>
		<item>
			<title>Welcome</title>
			<description><![CDATA[<p>Hello! Welcome to the new Cartweaver blog. We will be posting things here pertaining to e-commerce in general and Cartweaver in particular, with some other technology or non-technology related items as well. In case you don't know me, my name is <a href="http://www.tom-muck.com/" title="Tom Muck, Dreamweaver extensions">Tom Muck</a>, and I am the lead programmer of the PHP version of the Cartweaver shopping cart. I have also taken over the duties for the ColdFusion version as well. My posts will be primarily about different coding aspects, FAQ items, or other technical concerns with Cartweaver, ColdFusion, PHP, SQL, or other topics. I have been doing this many years, and have my own site <a title="Tom Muck, Dreamweaver Extensions" href="http://www.tom-muck.com">www.tom-muck.com</a> where I have been selling Dreamweaver extensions for years. I also write for <a href="http://www.communitymx.com">Community MX</a>, and have over 100 articles available there and other places, dealing mostly with ColdFusion, PHP, SQL, and e-commerce.</p>
<p>One of my goals here will be to document many of the little code enhancements or modifications that I have been posting on my own site. </p>
<p>Thanks for listening!</p>]]></description> 
			<link>http://blog.cartweaver.com/index.cfm?newsid=8</link>
			<guid isPermaLink="true">http://blog.cartweaver.com/index.cfm?newsid=8</guid>
			<pubDate>Tue, 14 Aug 2007 17:04:58 GMT</pubDate>
		</item>
	</channel>
</rss>


