0

I want to add a new page like the success or failure pages. In /app/design/frontend/default/[theme]/layout/checkout.xml I saw this:

<checkout_onepage_failure translate="label">
        <label>One Page Checkout Failure</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/onepage_failure" name="checkout.failure" template="checkout/onepage/failure.phtml"/>
        </reference>
    </checkout_onepage_failure>

So I added this:

<checkout_onepage_pay translate="label">
        <label>One Page Checkout Payment</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/onepage_pay" name="checkout.pay" template="checkout/onepage/pay.phtml"/>
        </reference>
    </checkout_onepage_pay>

And did the same in /app/design/frontend/base/default/layout/checkout.xml

And added my page to /app/design/frontend/base/default/template/checkout/onepage/ But I'm getting an 404 error, and dunno where else have to make reference to my page.

Thank you.

Edit: don't know if is important but this page it will show after the "Place Order" button is clicked.

Keep looking and I found this in Checkout/controllers/OnepageController.php

public function failureAction()
    {
        $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
        $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();

        if (!$lastQuoteId || !$lastOrderId) {
            $this->_redirect('checkout/cart');
            return;
        }

        **$this->loadLayout();
        $this->renderLayout();**
    }

So here is where load and render the failure template, right? Where is called this method? D:

  • Do you want to add a step in checkout, or want your magento to redirect to a new template after order is placed? – TBI Infotech Jun 12 '14 at 14:15
  • @TBIInfotech I want to redirect to a new template after the click in place order, and yes does the redirect but throws me and 404-error – Natalie Jun 12 '14 at 15:59
1

You are trying to define an invalid handler and block in checkout.xml.

You are using a handler that magento do not understand. i e.

<checkout_onepage_pay />

What you have done here is you are used an invalid handler instead of actual handler <checkout_onepage_failure />. Magento looks for this handler when onepage checkout fails. When magento enquires handler, its not present in your layout file. Hence it throws an error.

Also your block is also invalid (Most probly). i e

<block type="checkout/onepage_pay" name="checkout.pay" template="checkout/onepage/pay.phtml"/>

This block tells magento that, whenever a onepage checkout failure occurs (Assumes your handler is <checkout_onepage_failure />), you have to look for a block Mage_Checkout/Block/Onepage/Pay.php . Hence Magento fails to load this block type, since it is not defined. In default case the block that magento looking for will be Mage/Checkout/Block/Onepage/Failure.php and it DOES exist.

From your question, its difficult to understand what you are looking for. There may be two cases

  1. You are trying to create a custom checkout onepage failure template

If that is the case you have to do this handler.

 <checkout_onepage_failure translate="label">
       <label>One Page Checkout Failure</label>
       <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/onepage_failure" name="checkout.failure" template="path/to/your/custom/template.php"/>
        </reference>
   </checkout_onepage_failure>

You just need to alter the template part of default block.

  1. You may trying to set a payment method page

If that is the case, then you need to use this handler

<checkout_onepage_paymentmethod>
    <remove name="right"/>
    <remove name="left"/>

    <block type="checkout/onepage_payment_methods" name="root" output="toHtml" template="checkout/onepage/payment/methods.phtml">
        <action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
    </block>
</checkout_onepage_paymentmethod>

This code snippet is from app/design/frontend/base/default/layout/checkout.xml. Make changes to content of this handler.

Note: Whatever be the reason, it is not a good practice to change the the files that resides in the location app/design/frontend/base/default. Set a new package and theme and make changes to the directory app/design/frontend/<your_package>/<your_theme>/

  • so you need to add a payment method. then your template (may be you require a module for this.) must set inside this handler <checkout_onepage_paymentmethod />. I am also new in magento. So its not an issue :) – Rajeev K Tomy Jun 12 '14 at 16:24
  • I'm sorry I'm new in Magento and there's a lot of things that I don't understand. I'm trying to set a page/template (don't know which is the correct way to say it) where the payment method it will be loaded on an iframe. For example when your payment is successfull you're redirect to ../checkout/onepage/success so I want that when you click "place order" button redirects to ../checkout/onepage/payment About your note so if I edit "/app/design/frontend/default/[theme]/layout/checkout.xml " is enough, right? – Natalie Jun 12 '14 at 16:33
  • But I'm not gonna do the payment method. I have paypal and TNS for the credit card. I'm just gonna load it on this new page/template. That I figured it out, just need the new page. – Natalie Jun 12 '14 at 16:37
0

Well this is what I did and I'm getting closer and closer. Not sure if is the right way to do it. In checkout.xml (/app/design/frontend/default/perfect-choice/layout/) Add this lines

<checkout_onepage_pay translate="label">
        <label>One Page Checkout Payment</label>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/onepage_pay" name="checkout.pay" template="checkout/pay.phtml"/>
        </reference>
    </checkout_onepage_pay>

In info.phtml modified: (/app/design/frontend/default/perfect-choice/template/checkout/onepage/review/)

<script type="text/javascript">
    //<![CDATA[
        review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'),'<?php echo $this->getUrl('checkout/onepage/pay') ?>');
    //]]>
    </script>

In OnePageController.php (/app/code/core/Mage/Checkout/controllers/)

public function payAction()
    {

        $this->loadLayout();
        $this->renderLayout();
    }

Add a pay.phtml (/app/design/frontend/default/perfect-choice/template/checkout), Pay.php (/app/code/core/Mage/Checkout/Block/Onepage) and finally in opcheckout.js modified Review.prototype where does the redirection:

if (response.redirect) {
                this.isSuccess = true;
                location.href = this.nextPage+'?red='+response.redirect;
                return;
            }

And with that I have in another page within my site on an iframe the payment method. Now I'm trying that when does the redirection back to my site reload all the page because does the redirect but in the iframe so at the end I have my site within my site xD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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