I'm building my first custom module and I think i'm almost there except there seems te be a small error in my code. I tried to overwrite two files from Magento Core.
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Price.php
and
app/code/core/Mage/Core/Model/Store.php
I created the module folder in app/etc/modules/ With: Vendor_Module.xml
<config>
<modules>
<Vendor_Module>
<active>true</active>
<codePool>local</codePool>
</Vendor_Module>
</modules>
</config>
I created a directory in app/code/local/Vendor/Module With:
Block/Price.php
<?php
require_once(Mage::getModuleDir('Block','Mage_Adminhtml').DS.'/Catalog/Product/Helper/Form/Price.php');
class Vendor_Module_Block_Price extends Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price {
/**
* Override the required function here,
* e.g. createAction
*/
public function getEscapedValue($index=null)
{
$value = $this->getValue();
if (!is_numeric($value)) {
return null;
}
return number_format($value, 4, null, '');
}
}
etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Vendor_Module>
<version>0.0.1</version>
</Vendor_Module>
</modules>
<global>
<blocks>
<Module>
<class>Atvise_RoundPrices_Block</class>
</Module>
</blocks>
<models>
<Module>
<class>Atvise_RoundPrices_Model</class>
</Module>
</models>
</global>
</config>
Model/Store.php
<?php
require_once(Mage::getModuleDir('Model','Mage_Core').DS.'Store.php');
class Vendor_Module_Model_Store extends Mage_Core_Model_Store
{
/**
* Override the required function here,
* e.g. createAction
*/
public function roundPrice($price)
{
return round($price, 4);
}
}
Can you guys help me out for the last bit of code or corrections?
Thanks