Created
June 12, 2012 05:48
-
-
Save bangonkali/2915429 to your computer and use it in GitHub Desktop.
Magento Modules Development: Overriding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<config> | |
<!-- | |
<global> | |
<modules> | |
<catalog> | |
<class></class> | |
<rewrite></rewrite> | |
--> | |
<global> | |
<blocks> | |
<catalog> | |
<rewrite> | |
<product_view>My_Module_Block_Product_View</product_view> | |
</rewrite> | |
</catalog> | |
</blocks> | |
<helpers> | |
<sales> | |
<rewrite> | |
<data>My_Module_Helper_Data</data> | |
</rewrite> | |
</sales> | |
<customer> | |
<rewrite> | |
<address>My_Module_Helper_Address</address> | |
</rewrite> | |
</customer> | |
</helpers> | |
<models> | |
<catalog> | |
<rewrite> | |
<product>My_Module_Model_Product</product> | |
</rewrite> | |
</catalog> | |
<catalog_resource> | |
<rewrite> | |
<product>My_Module_Model_Product_Resource_Model</product> | |
</rewrite> | |
</catalog_resource> | |
</models> | |
</global> | |
</config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'app/Mage.php'; | |
Mage::app(); | |
// $obj = Mage::getModel('catalog/product')->load(1); | |
// var_dump( $obj->getName() ); | |
// $obj = Mage::app() | |
// ->getLayout() | |
// ->createBlock('catalog/product_view'); | |
// $obj = Mage::getResourceModel('catalog/product'); | |
// $obj = Mage::helper('sales'); | |
$obj = Mage::helper('customer/address'); | |
echo get_class( $obj ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Module_Block_Product_View | |
extends Mage_Catalog_Block_Product_View { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<config> | |
<default> | |
<some> | |
<random> | |
<xpath>This is a value.</xpath> | |
</random> | |
</some> | |
</default> | |
</config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Module_Helper_Address extends Mage_Customer_Helper_Address { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Module_Helper_Data extends Mage_Sales_Helper_Data { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
/** | |
* Description of Product | |
* | |
* @author Bangonkali | |
*/ | |
class My_Module_Model_Product extends Mage_Catalog_Model_Product { | |
public function getName() { | |
$name = parent::getName(); | |
return strtoupper($name); | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Module_Model_Product_Resource_Model | |
extends Mage_Catalog_Model_Resource_Product { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment