0

I'm stucked on the 4th step on one page checkout, I can't continue to next step on shipping to payment.

The button reacts, ajax call is fine, returned content seems perfect, but it doesn't execute or fill on HTML.

I was read about that issue on more topics like the following:

But no success. I also read and try another posts, but the same result.

The problem is that when I click continue on shipping information, the payment is not loaded but ajax request do.

JSON returns the following:

"goto_section": "payment",
"update_section": {
    "name": "payment_method",
    "html": '<dt id="dt_method_cashondelivery">            <input id="p_method_cashondelivery" value="cashondelivery" type="radio" name="payment[method]" title="Contrarreembolso" onclick="payment.switchMethod('cashondelivery')" class="radio" />            <label for="p_method_cashondelivery">Contrarreembolso </label>    </dt>        <dt id="dt_method_purchaseorder">            <input id="p_method_purchaseorder" value="purchaseorder" type="radio" name="payment[method]" title="Purchase Order" onclick="payment.switchMethod('purchaseorder')" class="radio" />            <label for="p_method_purchaseorder">Purchase Order </label>    </dt>        <dd id="dd_method_purchaseorder">        <ul class="form-list" id="payment_form_purchaseorder" style="display:none;">    <li>        <label for="po_number" class="required"><em>*</em>Número de la orden de compra</label>        <div class="input-box">            <input type="text" id="po_number" name="payment[po_number]" title="Número de la orden de compra" class="input-text required-entry" value="" />        </div>    </li></ul>    </dd>    <script type="text/javascript">    //<![CDATA[        payment.init();        //]]></script>'
}

Seems that payment.init() doesn't execute never because it doesn't enter on debugger on that function, but if I execute payment.init() manually on console the result is the same even entering on the javascript function successfully.

Doesn't matter if I change checkout.xml, info.phtml, methods.phtml, and more files, the problem is the same (all seems correct, no errors, good information retrieving but not success on step change).

If I change to the default template, the error persists, but the right column with the order resume updates correctly, when if I configure my custom template it doesn't, but the step to request payment information is always unaccessible.

Please, can you put some light on this?

Thank you.

EDIT

I can add more information. On /var/log/exceptions.log I can see:

exception 'Mage_Core_Exception' with message 'El tipo de bloque es inválido: ' in /home/marcosprog/httpd/foruzz/web/app/Mage.php:595
Stack trace:
#0 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('El tipo de bloq...')
#1 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'root')
#3 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'root')
#4 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#6 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#7 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Checkout/controllers/OnepageController.php(212): Mage_Core_Controller_Varien_Action->loadLayout()
#8 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->indexAction()
#9 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#10 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /home/marcosprog/httpd/foruzz/web/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#12 /home/marcosprog/httpd/foruzz/web/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#13 /home/marcosprog/httpd/foruzz/web/index.php(83): Mage::run('', 'store')
#14 {main}

But I don't know what and why the block is invalid, so shipping loads fine and also payment json.

Note

Note that the payment information loads fine, if I remove display: none from <div id="checkout-step-payment"> I can see all options and fine, so I guess there is a problem on the javascript that show this part of the page.

Solved

I add an answer and will be accepted today, but if someone has a better solution I will accept it as the correct answer.

1 Answer 1

2

Ok, I solve the problem. It was a javascript problem, not a php or block problem.

On the file opcheckout.js we can found this piece of code (line 650 aprox)

    if (response.update_section) {
        $('checkout-'+response.update_section.name+'-load').update(response.update_section.html);
    }

But the problem is that $('checkout-'+response.update_section.name+'-load') element doesn't exists, because response.update_section.name = "payment_method" where needs to be response.update_section.name = "payment-method" (semicolon).

I don't know why PHP returns payment_method instead of payment-method that is the correct element, or maybe is a problem on the Meigee Theme that I am using.

However, to avoid problems on php, I solve it on the javascript changing the above code for this piece:

    if (response.update_section) {
        var sect = (response.update_section.name === "payment_method") ? "payment-method" : response.update_section.name;
        $('checkout-'+sect+'-load').update(response.update_section.html);
    }

Only for payment-method and all is OK right now, I can complete the checkout process with no problem.

If you know another method to solve this problem, please, add an answer and it will be accepted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.