Overriding the view.phtml with a custom module doesn't give us much to go off, however, if you're looking to just override what a certain function or add a function to the product page, you can look to extend the core View.php file in the following path:
app/code/core/Mage/Catalog/Block/Product/View.php
to do this using a custom module (Sounds like this is what your trying to do) create a config.xml file for your module and rewrite the View Block like so:
<?xml version="1.0"?>
<config>
<modules>
<Some_Module>
<version>0.0.1</version>
</Some_Module>
</modules>
<global>
<blocks>
<catalog>
<rewrite>
<product_view>Some_Module_Block_Product_View</product_view>
</rewrite>
</catalog>
</blocks>
</global>
</config>
Thats the config out the way, it is pretty self explanatory, declare your module name / version, and then inside the Global node declare the Block(s) you wish to overwrite, in our case its Mage_Catalog_Block_Product_View, notice how our class uses the same Class name just with out Namespace_Module replacing the core.
So you now want to create your block file which will be in:
app/code/local/Some/Module/Block/Product/View.php
Here you will extend the core class, therefore inheriting the functionality, now we can add/change functions declared in the core file. To change a function in the core file, for example if you wanted to rewrite the function for getProductDefaultQty() you would do the following:
<?php
class Some_Module_Block_Product_View extends Mage_Catalog_Block_Product_View
{
public function getProductDefaultQty($product = null)
{
some code to do what you want
}
public function customFunction()
{
look this is my own function which i can now call inside view.phtml!
}
}
As you can see above its pretty easy to over write a core file and either rewrite a core function or even add your own.
Couple of last things your module requires to work, you will need to create a module file within app/etc/modules
which will be named Some_Module.xml
and will contain the following:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Some_Module>
<active>true</active>
<codePool>local</codePool>
</Some_Module>
</modules>
</config>
This is telling magento that your module is active and inside the codePool
node its telling Magento our module is at app/code/local
it can also be set to community, simply telling magento to look in app/code/community
.
There is a whole lot more you can do when overriding and i have only touched on it, you could add your own layout file to declare a new template file for View.phtml if you really wanted to, this is all very easy and can be achieved by adding a couple more line to your modules config.xml
file.
There is plenty out there for further reading, Alan Storm is a great help to any Magento developer starting out, we all know it can be a steep learning curve, check his articles out on his site:
Alan Storm
Another top site for tutorials and further reading on Magento is Inchoo:
Inchoo
Hope this has helped you on conquering the beast which is Magento, if you need any help just comment, i'll be glad to help,
Josh