Magento1 createBlock method returns “bool(false)” in livehost
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(){
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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.
config.xml
<?xml version="1.0">
<config>
<modules>
<AndersonGustavo_SlideProducts>
<version>1.0</version>
</AndersonGustavo_SlideProducts>
</modules>
<frontend>
<routers>
<andersongustavo_slideproducts>
<use>standard</use>
<args>
<module>AndersonGustavo_SlideProducts</module>
<frontName>teste</frontName>
</args>
</andersongustavo_slideproducts>
</routers>
<layout>
<updates>
<AndersonGustavo_SlideProducts>
<file>slideproducts.xml</file>
</AndersonGustavo_SlideProducts>
</updates>
</layout>
</frontend>
<global>
<models>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Model_System_Config_Source</class>
</slideproducts>
</models>
<blocks>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Block</class>
</slideproducts>
</blocks>
<helpers>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Helper</class>
</slideproducts>
</helpers>
</global>
SlideProducts.php
class AndersonGustavo_SlideProducts_Block_SlideProducts extends Mage_Core_Block_Template {
public function __construct(array $args)
{
$this->setTemplate('slideproducts/slideproducts.phtml');
}
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')
->load($enabledCategoryId)
->getProductCollection()
->addAttributeToSelect("*")
->addAttributeToFilter('status',1);
return $categoryProducts;
}
public function getProductImage($id){
$product = Mage::getModel('catalog/product')->load($id);
foreach ($product->getMediaGalleryImages() as $image){
return $image->getUrl();
}
}
}
exception.log
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
magento-1.9 fatal-error custom-block
add a comment |
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(){
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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.
config.xml
<?xml version="1.0">
<config>
<modules>
<AndersonGustavo_SlideProducts>
<version>1.0</version>
</AndersonGustavo_SlideProducts>
</modules>
<frontend>
<routers>
<andersongustavo_slideproducts>
<use>standard</use>
<args>
<module>AndersonGustavo_SlideProducts</module>
<frontName>teste</frontName>
</args>
</andersongustavo_slideproducts>
</routers>
<layout>
<updates>
<AndersonGustavo_SlideProducts>
<file>slideproducts.xml</file>
</AndersonGustavo_SlideProducts>
</updates>
</layout>
</frontend>
<global>
<models>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Model_System_Config_Source</class>
</slideproducts>
</models>
<blocks>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Block</class>
</slideproducts>
</blocks>
<helpers>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Helper</class>
</slideproducts>
</helpers>
</global>
SlideProducts.php
class AndersonGustavo_SlideProducts_Block_SlideProducts extends Mage_Core_Block_Template {
public function __construct(array $args)
{
$this->setTemplate('slideproducts/slideproducts.phtml');
}
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')
->load($enabledCategoryId)
->getProductCollection()
->addAttributeToSelect("*")
->addAttributeToFilter('status',1);
return $categoryProducts;
}
public function getProductImage($id){
$product = Mage::getModel('catalog/product')->load($id);
foreach ($product->getMediaGalleryImages() as $image){
return $image->getUrl();
}
}
}
exception.log
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
magento-1.9 fatal-error custom-block
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
add a comment |
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(){
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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.
config.xml
<?xml version="1.0">
<config>
<modules>
<AndersonGustavo_SlideProducts>
<version>1.0</version>
</AndersonGustavo_SlideProducts>
</modules>
<frontend>
<routers>
<andersongustavo_slideproducts>
<use>standard</use>
<args>
<module>AndersonGustavo_SlideProducts</module>
<frontName>teste</frontName>
</args>
</andersongustavo_slideproducts>
</routers>
<layout>
<updates>
<AndersonGustavo_SlideProducts>
<file>slideproducts.xml</file>
</AndersonGustavo_SlideProducts>
</updates>
</layout>
</frontend>
<global>
<models>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Model_System_Config_Source</class>
</slideproducts>
</models>
<blocks>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Block</class>
</slideproducts>
</blocks>
<helpers>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Helper</class>
</slideproducts>
</helpers>
</global>
SlideProducts.php
class AndersonGustavo_SlideProducts_Block_SlideProducts extends Mage_Core_Block_Template {
public function __construct(array $args)
{
$this->setTemplate('slideproducts/slideproducts.phtml');
}
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')
->load($enabledCategoryId)
->getProductCollection()
->addAttributeToSelect("*")
->addAttributeToFilter('status',1);
return $categoryProducts;
}
public function getProductImage($id){
$product = Mage::getModel('catalog/product')->load($id);
foreach ($product->getMediaGalleryImages() as $image){
return $image->getUrl();
}
}
}
exception.log
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
magento-1.9 fatal-error custom-block
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(){
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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.
config.xml
<?xml version="1.0">
<config>
<modules>
<AndersonGustavo_SlideProducts>
<version>1.0</version>
</AndersonGustavo_SlideProducts>
</modules>
<frontend>
<routers>
<andersongustavo_slideproducts>
<use>standard</use>
<args>
<module>AndersonGustavo_SlideProducts</module>
<frontName>teste</frontName>
</args>
</andersongustavo_slideproducts>
</routers>
<layout>
<updates>
<AndersonGustavo_SlideProducts>
<file>slideproducts.xml</file>
</AndersonGustavo_SlideProducts>
</updates>
</layout>
</frontend>
<global>
<models>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Model_System_Config_Source</class>
</slideproducts>
</models>
<blocks>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Block</class>
</slideproducts>
</blocks>
<helpers>
<slideproducts>
<class>AndersonGustavo_SlideProducts_Helper</class>
</slideproducts>
</helpers>
</global>
SlideProducts.php
class AndersonGustavo_SlideProducts_Block_SlideProducts extends Mage_Core_Block_Template {
public function __construct(array $args)
{
$this->setTemplate('slideproducts/slideproducts.phtml');
}
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')
->load($enabledCategoryId)
->getProductCollection()
->addAttributeToSelect("*")
->addAttributeToFilter('status',1);
return $categoryProducts;
}
public function getProductImage($id){
$product = Mage::getModel('catalog/product')->load($id);
foreach ($product->getMediaGalleryImages() as $image){
return $image->getUrl();
}
}
}
exception.log
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
magento-1.9 fatal-error custom-block
magento-1.9 fatal-error custom-block
edited 19 mins ago
Teja Bhagavan Kollepara
3,00641949
3,00641949
asked May 27 '17 at 9:58
Anderson GustavoAnderson Gustavo
286
286
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
add a comment |
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
can you please paste your block class as well?
– Shyam
May 27 '17 at 10:11
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
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
add a comment |
2 Answers
2
active
oldest
votes
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 1.9.3.1 and the livehost is 1.9.2.2. 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 fromSystem -> 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
add a comment |
Your action code should be
public function minhaactionAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f176317%2fmagento1-createblock-method-returns-boolfalse-in-livehost%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 1.9.3.1 and the livehost is 1.9.2.2. 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 fromSystem -> 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
add a comment |
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 1.9.3.1 and the livehost is 1.9.2.2. 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 fromSystem -> 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
add a comment |
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.
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.
answered May 27 '17 at 11:04
Mohit Kumar AroraMohit Kumar Arora
6,66151632
6,66151632
Yes, the versions are different.. but, my localhost is 1.9.3.1 and the livehost is 1.9.2.2. 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 fromSystem -> 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
add a comment |
Yes, the versions are different.. but, my localhost is 1.9.3.1 and the livehost is 1.9.2.2. 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 fromSystem -> 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
Yes, the versions are different.. but, my localhost is 1.9.3.1 and the livehost is 1.9.2.2. Unfortunately the problem continues.
– Anderson Gustavo
May 27 '17 at 11:13
Yes, the versions are different.. but, my localhost is 1.9.3.1 and the livehost is 1.9.2.2. 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
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
Yep.. I'll edit the post and paste the log
– Anderson Gustavo
May 27 '17 at 12:35
1
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
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
add a comment |
Your action code should be
public function minhaactionAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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
add a comment |
Your action code should be
public function minhaactionAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
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
add a comment |
Your action code should be
public function minhaactionAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
Your action code should be
public function minhaactionAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('slideproducts/slideproducts');
var_dump($block);
$block->setTemplate('slideproducts/slideproducts.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
answered May 27 '17 at 10:59
Sohel RanaSohel Rana
22.7k34460
22.7k34460
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
add a comment |
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
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
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
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
Yes, I clear all caches and disabled them.
– Anderson Gustavo
May 27 '17 at 11:30
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f176317%2fmagento1-createblock-method-returns-boolfalse-in-livehost%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
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