title: Place Order fails in Magento OnePage Checkout
body: <p>I have a Magento store that has been converted to a "one deal at a time" type store, and the checkout process is broken. I've been trying to debug this, but have hit a wall, primarily due to my limited understanding of Magento.</p>
  
  <p>On the saveOrder step, when clicking "Place Order", the page shows "submitting order information, then the message clears and the shopper is still on the Order Review page.</p>
  
  <p>I've analyzed with Firebug and HttpFox, and I can see the order information is being sent</p>
  
  <pre><code>(Request-Line)  POST /checkout/onepage/saveOrder/ HTTP/1.1
  Host    www.domainname.com
  User-Agent  Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0
  Accept  text/javascript, text/html, application/xml, text/xml, */*
  Accept-Language en-us,en;q=0.5
  Accept-Encoding gzip, deflate
  Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive  115
  Connection  keep-alive
  X-Requested-With    XMLHttpRequest
  X-Prototype-Version 1.6.0.3
  Content-Type    application/x-www-form-urlencoded; charset=UTF-8
  Referer https://www.domainname.com/checkout/onepage/
  Content-Length  178
  Cookie  frontend=cd60252d28cd115d4096cb2bb5b6a043
  Pragma  no-cache
  Cache-Control   no-cache
  </code></pre>
  
  <p>Post Data shows all of the required information:</p>
  
  <pre><code>payment[method] authorizenet
  payment[cc_type]    VI
  payment[cc_number]  4111111111111111
  payment[cc_exp_month]   5
  payment[cc_exp_year]    2012
  payment[cc_cid] 987
  </code></pre>
  
  <p>My problem seemed similar to this post:
  <a href="http://fishpig.co.uk/magento-tutorials/magento-checkout-error-undefined-javascript-alert" rel="nofollow">http://fishpig.co.uk/magento-tutorials/magento-checkout-error-undefined-javascript-alert</a></p>
  
  <p>but I'm not getting an "Undefined" alert, so I added the "else" statement below: </p>
  
  <pre><code>nextStep: function(transport){
      if (transport &amp;&amp; transport.responseText) {
              alert(transport.responseText);
          try{
              response = eval('(' + transport.responseText + ')');
          }
          catch (e) {
              response = {};
          }
          if (response.redirect) {
              location.href = response.redirect;
              return;
          }
          if (response.success) {
              this.isSuccess = true;
              window.location=this.successUrl;
          }
          else{
              var msg = response.error_messages;
              if (typeof(msg)=='object') {
                  msg = msg.join("\n");
              }
              alert(msg);
          }
  
          if (response.update_section) {
              $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
              response.update_section.html.evalScripts();
          }
  
          if (response.goto_section) {
              checkout.gotoSection(response.goto_section);
              checkout.reloadProgressBlock();
          }
      } else {
          alert('transport.responseText');
          }
  },
  </code></pre>
  
  <p>I am getting the JS alert with no text, so it looks like transport.reponseText is empty. The main references to empty response text I've found appear to be related to same-origin policy, which I don't think applies, because my AJAX post is to and from www.domainname.com.</p>
  
  <p>When I call the saveOrder function directly in the browser, I'm receiving a valid response:</p>
  
  <p><a href="https://www.domainname.com/checkout/onepage/saveOrder" rel="nofollow">https://www.domainname.com/checkout/onepage/saveOrder</a>
  {"success":false,"error":true,"error_messages":"Credit card number mismatch with credit card type"}</p>
  
  <p>and HTTPFox shows I'm getting a 200 response from the Ajax call, but the responsetext is simply empty. I find no PHP errors or errors in Magento's exceptions log. The only thing I'm finding that might be related is "Headers already sent' in Magento's system log:</p>
  
  <pre><code>&lt;/pre&gt;
  2011-09-03T12:14:21+00:00 DEBUG (7): HEADERS ALREADY SENT: &lt;pre&gt;[0] wwwroot/app/code/core/Mage/Core/Controller/Response/Http.php:50
  [1] wwwroot/lib/Zend/Controller/Response/Abstract.php:726
  [2] wwwroot/app/code/core/Mage/Core/Controller/Response/Http.php:82
  [3] wwwroot/app/code/core/Mage/Core/Controller/Varien/Front.php:169
  [4] wwwroot/app/Mage.php:459
  [5] wwwroot/index.php:67
  &lt;/pre&gt;
  </code></pre>
  
  <p>Does anyone have any suggestions why else the responseText is coming back empty?</p>