enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here

I could not call resource model function display records in block/dotnet.php

  • The class name Department_DotNet_Model_dotnetmodel should be Department_DotNet_Model_Dotnet. The class name Department_DotNet_Model_Resource_dotnetmodel should be Department_DotNet_Model_Resource_Dotnet. Capital letters matter here, it might not hurt on your local PC when you trying to run on a linux server it will break. Blocks do not have a method called _redirect, that section of code should be called from a controller instead. It is bad practice to use any resource model from a block, keep that stuff to the regular model only. Oct 7, 2013 at 10:57
  • @clockworkgeek thanks for suggestion, I will follow the same Oct 16, 2013 at 14:24

1 Answer 1


Instead of Mage::getModel('dotnet/dotnet')->displayrecods() use:


Or better yet in your model (dotnet/dotnet) create a method named displayrecords so you will be able to use your original code. That method can look like this:

public function displayrecods(){
    return $this->_getResource()->displayrecods();

So this method will act like a wrapper for the method in the resource model.
I think the problem is with your resource model declaration in config.xml


Should be


Next time post code, not screenshots of it

  • thanks for reply marius, either of the options are not helpful Oct 7, 2013 at 7:14
  • @prasadmaganti. Actually they are (or will be after you fix the error), but I've re-read the error message, more careful this time. Can you post your config.xml file in the question. I see that actually Mage::getModel('dotnet/dotnet') returns null. Also does the file Department_DotNet_Model_DotNet exist?
    – Marius
    Oct 7, 2013 at 7:18
  • @prasadmaganti. I've also edited my answer. Try again with the first option.
    – Marius
    Oct 7, 2013 at 7:19
  • i could not call model/resource function and model based function in my block/.php or phtml file. please help me. i have struck on this Oct 7, 2013 at 7:21
  • 1
    @prasadmaganti.Then post your entire module in the question. So we can reproduce it.
    – Marius
    Oct 7, 2013 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.