<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dunamis Design Net &#187; OS Commerce</title>
	<atom:link href="http://dunamisdesign.net/archives/category/os-commerce/feed" rel="self" type="application/rss+xml" />
	<link>http://dunamisdesign.net</link>
	<description>Our work, forums, and play.</description>
	<lastBuildDate>Sat, 12 Jun 2010 08:22:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>osCommerce Pop on Confirmation</title>
		<link>http://dunamisdesign.net/archives/17</link>
		<comments>http://dunamisdesign.net/archives/17#comments</comments>
		<pubDate>Fri, 30 Apr 2010 17:15:07 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[OS Commerce]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://dunamisdesign.net/archives/17</guid>
		<description><![CDATA[This was designed to solve the problem of duplicate orders being generated in osCommerce from a customer hitting the confirmation button more than once. So, I set this up to pop-up a &#8220;please wait&#8221; dialog with a progress bar to assure the customer that something was happening. If the progress bar make it to the [...]]]></description>
			<content:encoded><![CDATA[<section>
<p>This was designed to solve the problem of duplicate orders being generated in osCommerce from a customer hitting the  confirmation button more than once.  So, I set this up to pop-up a &#8220;please wait&#8221; dialog with a progress bar to assure the customer that something was happening.  If the progress bar make it to the end (currently programed for 125 seconds),  then the dialog box changes to display an error occured and they can press the refresh button (in the dialog box) and try again.
    </p>
</section>
<p><span id="more-17"></span></p>
<section>
<h3>Install:</h3>
<p>Edit the osCommerce catalog/checkout_confirmation.php (osCommerce vanilla) or catalog/template/content/checkout_confirmation.tpl.php (creloaded).</p>
<p>Insert the following code either just below the &lt;body&gt; tag or at the top of the creloaded template file.</p>
<pre>
&lt;!-- PopupConf - Copyright (c) 2010 Michael Calabrese, Dunamis Design --&gt;
&lt;link type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/cupertino/jquery-ui.css" rel="Stylesheet" /&gt;
&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
  jQuery.noConflict();
  var percent_progress=0;
  var count = 0;
  var progress_update_interval = 40; //usec
  var progress_delay = 125; //seconds
  function reload() {
      location.reload();
  }
  function startProgress() {
    jQuery("#progress_bar").progressbar("value", percent_progress);
    var max_count= progress_delay*(1000/progress_update_interval)
    if(count < max_count) {
      count=count+1;
      //percent_progress=(count/130) * 100;
      percent_progress=(count*100) /max_count;
      //alert(percent_progress);
      setTimeout("startProgress()", progress_update_interval);
    } else {
      //timer is up.
      jQuery("#dialog_process").empty();
      jQuery("#dialog_process").append(  jQuery("&lt;div&gt;Processing your order failed. Please press the reload button and try again.&lt;br&gt; &lt;button class=\"ui-state-default ui-corner-all\" onclick=\"reload();\"&gt;Reload&lt;/button&gt;&lt;/div&gt;")  );
    }
  }

  jQuery(document).ready(function($) {
  jQuery("#dialog_process").dialog({ autoOpen: false, closeOnEscape: false, draggable: false, modal: true,resizable: false })
    // Code that uses jQuery's $ can follow here.
    jQuery("#progress_bar").progressbar({value: count});
    jQuery("#popup_test").click(function() {
        jQuery("#dialog_process").dialog("open");
        startProgress();
    });
    $(".button_confirm_order").click(function(event) {
        jQuery("#dialog_process").dialog("open");
        startProgress();
        setTimeout("document.forms[0].submit()", 1000);
        event.preventDefault();
    });
  });
&lt;/script&gt;
&lt;div id="dialog_process" style="display:none;font-size:70%;"  title="Please Wait" &gt;
  We are processing your order, it could take up to 2 minutes. Thank you.
  &lt;div id="progress_bar"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;!-- PopupConf - Copyright (c) 2010 Michael Calabrese, Dunamis Design --&gt;
</pre>
<p>Find the following php code (which generates the confirmation button).  Please note that tep_template_image_submit will be tep_image_submit), I would search for IMAGE_BUTTON_CONFIRM_ORDER:</p>
</pre>
<pre>
 echo tep_template_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER)
</pre>
<p>Added the class paramater to look like:</p>
<pre>
 echo tep_template_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER,'class="button_confirm_order"')
</pre>
<p>All done, that should be it.</p>
</section>
]]></content:encoded>
			<wfw:commentRss>http://dunamisdesign.net/archives/17/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

