I've made a module that, in my localhost works fine.. The block shows up and ok, but in "livehost" the block don't appear, so I created a controller to make some tests and see what is the problem.

public function minhaactionAction(){
    $block = $this->getLayout()->createBlock('slideproducts/slideproducts');

In my localhost the block continue, but in site var_dump($block); returns bool(false). I search for a light by days and nothing yet, I hope so someone can help me to solve this problem.

If I use the $block->setTemplate('...'); it gives an error:

"Fatal error: Call to a member function setTemplate() on boolean in /home/httpd/htdocs/..."

Obviously, its because the createBlock function returns false.


<?xml version="1.0">


class AndersonGustavo_SlideProducts_Block_SlideProducts extends Mage_Core_Block_Template {

public function __construct(array $args)

public function isEnabled(){
    return Mage::getStoreConfig('andersongustavo/category/enabled');

private function getCategories(){
    return Mage::getStoreConfig('andersongustavo/category/category_groups');

public function getHeader(){
    return Mage::getStoreConfig('andersongustavo/category/header');

public function getCategoriesId(){
    $enabledCategories = explode(',',$this->getCategories());
    return $enabledCategories;

public function getCategoryProducts($enabledCategoryId){
    $categoryProducts = Mage::getModel('catalog/category')
    return $categoryProducts;

public function getProductImage($id){
    $product = Mage::getModel('catalog/product')->load($id);

    foreach ($product->getMediaGalleryImages() as $image){
        return $image->getUrl();


exception 'Mage_Core_Exception' with message 'Tipo de bloco inválido: AndersonGustavo_SlideProducts_Block_Slideproducts' in /home/httpd/htdocs/ovaralbr/public/app/Mage.php:595
Stack trace:
#0 /home/httpd/htdocs/ovaralbr/public/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Tipo de bloco i...')
#1 /home/httpd/htdocs/ovaralbr/public/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('slideproducts/s...', Array)
#2 /home/httpd/htdocs/ovaralbr/public/app/code/local/AndersonGustavo/SlideProducts/controllers/IndexController.php(24): Mage_Core_Model_Layout->createBlock('slideproducts/s...')
#3 /home/httpd/htdocs/ovaralbr/public/app/code/core/Mage/Core/Controller/Varien/Action.php(418): AndersonGustavo_SlideProducts_IndexController->minhaactionAction()
#4 /home/httpd/htdocs/ovaralbr/public/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('minhaaction')
#5 /home/httpd/htdocs/ovaralbr/public/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#6 /home/httpd/htdocs/ovaralbr/public/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#7 /home/httpd/htdocs/ovaralbr/public/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#8 /home/httpd/htdocs/ovaralbr/public/index.php(93): Mage::run('', 'store')
#9 {main}

(Tipo de bloco inválido:) is, Invalid block type

  • can you please paste your block class as well? – Shyam May 27 '17 at 10:11
  • Ok! I paste the block class. Do you think, it's necessary to paste my template .phtml file too? – Anderson Gustavo May 27 '17 at 10:57

I suspect that versions of your Magento in localhost and live versions are different.

After Magento version 1.9.1, Magento introduced a new feature of block permissions.

Now if you are introducing a new block class in Magento system, you need to allow it from:

System -> Permissions -> Blocks

Click add new block where block name slideproducts/slideproducts and isAllowed -> Yes

Now save. Clear cache. Hope this will solve your problem.

  • Yes, the versions are different.. but, my localhost is and the livehost is Unfortunately the problem continues. – Anderson Gustavo May 27 '17 at 11:13
  • Have you done what I have written in my answer? Please enable Magento's log from System -> Configuration -> Advanced (Developer) -> Log Settings and then check /var/log folder after reloading page. – Mohit Kumar Arora May 27 '17 at 12:15
  • Yep.. I'll edit the post and paste the log – Anderson Gustavo May 27 '17 at 12:35
  • 1
    In the exception.log I could see that the magento is searching for a Slideproducts.php, but the file's name is SlideProducts.php.. Do you know why, and how can I make magento search for the file in camel case.. by the way, you solve my problem!!! I'm very grateful, you save the day.. or bette..r the week =P Thank you! – Anderson Gustavo May 27 '17 at 12:57

Your action code should be

public function minhaactionAction()
    $block = $this->getLayout()->createBlock('slideproducts/slideproducts');
  • Sorry, my bad!!!! I forgot to paste this code line, have a lot of comment lines here.. I'll edit my question post and thank you. – Anderson Gustavo May 27 '17 at 11:05
  • Did you clear cache? It works fine here. – Sohel Rana May 27 '17 at 11:25
  • Yes, I clear all caches and disabled them. – Anderson Gustavo May 27 '17 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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