I'm modifying getCountryHtmlSelect() through a custom class that extends another core class that extends Mage_Checkout_Block_Onepage_Abstract. Here's the class with the customized code:
local/Mycompany/Checkout/Block/Onepage/Billing.php:
class Mycompany_Checkout_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing{
// customizing from Mage_Checkout_Block_Onepage_Abstract
public function getCountryHtmlSelect($type){
[INSERT CUSTOM CODE]
}
}
For your reference, here is class Mage_Checkout_Block_Onepage_Billing:
core/Mage/Checkout/Block/Onepage/Billing.php:
class Mage_Checkout_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Abstract{
...
}
For completeness sake, here's Mage_Checkout_Block_Onepage_Abstract:
core/Mage/Checkout/Block/Onepage/Abstract.php:
abstract class Mage_Checkout_Block_Onepage_Abstract extends Mage_Core_Block_Template{
public function getCountryHtmlSelect($type)
{
[CORE CODE]
}
}
Unfortunately, Magento isn't picking up the customized version of getCountryHtmlSelect(); it's still using getCountryHtmlSelect() in class Mage_Checkout_Block_Onepage_Abstract.
Here's my config.xml:
app/code/local/Mycompany/Checkout/etc/config.xml:
<?xml version="1.0" ?>
<config>
<modules>
<Mycompany_Checkout>
<version>0.0.1</version>
</Mycompany_Checkout>
</modules>
<global>
<blocks>
<checkout>
<rewrite>
<onepage>Mycompany_Checkout_Block_Onepage</onepage>
<onepage_shipping>Mycompany_Checkout_Block_Onepage_Shipping</onepage_shipping>
</rewrite>
</checkout>
</blocks>
</global>
<frontend>
<routers>
<checkout>
<args>
<modules>
<Mycompany_Checkout before="Mage_Checkout">Mycompany_Checkout</Mycompany_Checkout>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
Questions:
What do I need to do to get Magento to use getCountryHtmlSelect() in the custom class?
Rather than approaching the problem by inserting getCountryHtmlSelect() in the custom class, is it better to do this:
local/Mycompany/Checkout/Block/Onepage/Abstract.php:
abstract class Mage_Checkout_Block_Onepage_Abstract extends Mage_Checkout_Block_Onepage_Abstract{
public function getCountryHtmlSelect($type)
{
[INSERT CUSTOM CODE]
}
}