I have added new field to the admin form which manages the taxes but I did this by editing the core files themselves.
I would like to adapt this to a separate module so the changes remain after I would update Magento.
I found some tutorials online about how to create a module but it doesn't say how to make the config file of the module to add just one field at a particular spot.
Now I added
<displaytax>0</displaytax>
to the app/code/core/Mage/Tax/etc/config.xml file in the tag.
And added this to the app/code/core/Mage/Tax/etc/system.xml
<displaytax translate="label">
<label>Display Tax</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>45</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</displaytax>
Below the
I also made some adjustments to the Block and Model files, where I added the function to call this variable.
app/code/core/Mage/Tax/Block/Checkout
class Mage_Tax_Block_Checkout_Tax extends Mage_Checkout_Block_Total_Default
{
protected $_template = 'tax/checkout/tax.phtml';
/**
* Check if we have include tax
*
* @return bool
*/
public function displayTax()
{
return Mage::getSingleton('tax/config')->displayCartTax($this->getStore());
}
}
Added to app/code/core/Mage/Tax/Model/Config.php
const XML_PATH_DISPLAY_CART_DISPLAYTAX = 'tax/cart_display/displaytax';
public function displayCartTax($store = null)
{
return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_DISPLAYTAX, $store);
}
Of course I made them HTML changes in /app/design/frontend/default/{mytemplate}/template/tax/checkout/tax.phtml
How should I convert this to a module?
How should you add a yes/no field to the admin form in the correct manner? Because this method works but will be overwritten in case of an update. I'd like a more sustainable solution.