2

I am having an issue with rewriting the Mage_Checkout_Block_Onepage block.

The issue is that after enabling this rewrite in the config, the one page checkout page doesn't load with any content. I have found that the Mage_Checkout_Block_Onepage block is never loaded.

I have the following in my config.xml

<blocks>
 <checkout>
  <rewrite>
   <onepage>Name_Module_Checkout_Block_Onepage</onepage>
  </rewrite>
 </checkout>
</blocks>

I then have the following class created in

app\code\local\Name\Module\Block\Checkout\Onepage.php

class Name_Module_Checkout_Block_Onepage extends Mage_Checkout_Block_Onepage {

I then override the getSteps method to see if its getting called, but it never gets called.

public function getSteps()
{
        Mage::Log("HERE!~");
}

I also created a new template file in the following location. Which is just a copy of the original onepage.phtml for now.

app\design\frontend\base\default\template\[module]\checkout\onepage.phtml

What is odd is that I can put a random name in the config.xml for the rewrite class and it never throws an error saying it can't find the class.

The same issue as described here Override Mage_Checkout_Block_Onepage with an extension

I looked through this question, but it didn't really have a solution. I tried everything that it said.

Any ideas would be very helpful. I must be missing something somewhere.

1 Answer 1

1

Your path is not correct

app\code\local\Name\Module\Block\Checkout\Onepage.php

class Name_Module_Checkout_Block_Onepage extends Mage_Checkout_Block_Onepage {

Should be (same as the class name)

  <rewrite>
   <onepage>Name_Module_Block_Checkout_Onepage</onepage>
  </rewrite>

app\code\local\Name\Module\Block\Checkout\Onepage.php

class Name_Module_Block_Checkout_Onepage extends Mage_Checkout_Block_Onepage {
1
  • 2
    Oh wow, I feel stupid now. It works now! Thanks!
    – Chris M
    Commented Feb 14, 2015 at 22:09

Your Answer

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

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