Can't Get Custom Module/Block To WorkCan't get my module layout to workBlock creation in magentoMagento new custom block moduleCalling $this->getChildHtml on a new block outside template fileHow to connect my custom block to the layoutCan't show custom text in block over product descriptionContent block not showingTemplate file isn't inheriting from my block extending Mage_Core_Block_Template?Add JS to head in CartUnable to call module output on product listing
Does bootstrapped regression allow for inference?
Does a dangling wire really electrocute me if I'm standing in water?
What is the command to reset a PC without deleting any files
How could a lack of term limits lead to a "dictatorship?"
Is there a familial term for apples and pears?
How to make payment on the internet without leaving a money trail?
Landing in very high winds
What do the Banks children have against barley water?
Does the average primeness of natural numbers tend to zero?
How can I fix this gap between bookcases I made?
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
aging parents with no investments
Why is the design of haulage companies so “special”?
Prime joint compound before latex paint?
Typesetting a double Over Dot on top of a symbol
What is the meaning of "of trouble" in the following sentence?
Was there ever an axiom rendered a theorem?
How do I create uniquely male characters?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
Crop image to path created in TikZ?
I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine
Can I legally use front facing blue light in the UK?
extract characters between two commas?
Re-submission of rejected manuscript without informing co-authors
Can't Get Custom Module/Block To Work
Can't get my module layout to workBlock creation in magentoMagento new custom block moduleCalling $this->getChildHtml on a new block outside template fileHow to connect my custom block to the layoutCan't show custom text in block over product descriptionContent block not showingTemplate file isn't inheriting from my block extending Mage_Core_Block_Template?Add JS to head in CartUnable to call module output on product listing
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am very close probably just an XML mistake somewhere. Please assist.
I'm making a custom module.
The directory structure:
In /var/www/html/magento/app/code/mine/MINE
-etc
--config.xml
-Catalog
--Block
---List.php
My config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mine>
<version>0.1.0</version>
</Mine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_Block</class>
</mine>
</blocks>
</global>
</config>
My List.php
class Mine_Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
My module registry in /var/www/html/magento/app/etc/modules
<?xml version="1.0"?>
<!--Mine-->
<config>
<modules>
<Mine_Catalog>
<active>true</active>
<codePool>mine</codePool>
</Mine_Catalog>
</modules>
</config>
It is titled Mine.xml
And finally, my template (slider/shoes.phtml
):
<?php
$_productCollection=$this->zetLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else:
foreach ($_productCollection as $product)
echo $product->getName();
echo "<br />";
?>
<?php endif; ?>
And my local.xml`:
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
</block>
So what am I doing wrong? I don't even get a "There are no products matching the selection." from the getProductCollection()
attempt, so I know there is a configuration error rather than a collection error.
I just get an empty div
.
magento-1.9 module blocks
|
show 1 more comment
I am very close probably just an XML mistake somewhere. Please assist.
I'm making a custom module.
The directory structure:
In /var/www/html/magento/app/code/mine/MINE
-etc
--config.xml
-Catalog
--Block
---List.php
My config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mine>
<version>0.1.0</version>
</Mine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_Block</class>
</mine>
</blocks>
</global>
</config>
My List.php
class Mine_Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
My module registry in /var/www/html/magento/app/etc/modules
<?xml version="1.0"?>
<!--Mine-->
<config>
<modules>
<Mine_Catalog>
<active>true</active>
<codePool>mine</codePool>
</Mine_Catalog>
</modules>
</config>
It is titled Mine.xml
And finally, my template (slider/shoes.phtml
):
<?php
$_productCollection=$this->zetLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else:
foreach ($_productCollection as $product)
echo $product->getName();
echo "<br />";
?>
<?php endif; ?>
And my local.xml`:
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
</block>
So what am I doing wrong? I don't even get a "There are no products matching the selection." from the getProductCollection()
attempt, so I know there is a configuration error rather than a collection error.
I just get an empty div
.
magento-1.9 module blocks
Are you really sure you run this function and not any other getLoadedProductCollection()?
– Stefan
Jan 15 '17 at 23:02
@Phil Pretty sure, that file is the only php file in my module as set in the block.
– Summer Developer
Jan 16 '17 at 0:10
Well, I comment out thegetLoadedProductCollection()
and I get the same result? How can I debug the module code to see an error like, function not found?
– Summer Developer
Jan 16 '17 at 1:20
Please provide your config.xml file and layout update xml file if any along with the file path. Without this, we can't direct you in the right way.
– Rajeev K Tomy
Jan 16 '17 at 5:08
@RajeevKTomy Please see updated question...
– Summer Developer
Jan 18 '17 at 19:43
|
show 1 more comment
I am very close probably just an XML mistake somewhere. Please assist.
I'm making a custom module.
The directory structure:
In /var/www/html/magento/app/code/mine/MINE
-etc
--config.xml
-Catalog
--Block
---List.php
My config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mine>
<version>0.1.0</version>
</Mine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_Block</class>
</mine>
</blocks>
</global>
</config>
My List.php
class Mine_Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
My module registry in /var/www/html/magento/app/etc/modules
<?xml version="1.0"?>
<!--Mine-->
<config>
<modules>
<Mine_Catalog>
<active>true</active>
<codePool>mine</codePool>
</Mine_Catalog>
</modules>
</config>
It is titled Mine.xml
And finally, my template (slider/shoes.phtml
):
<?php
$_productCollection=$this->zetLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else:
foreach ($_productCollection as $product)
echo $product->getName();
echo "<br />";
?>
<?php endif; ?>
And my local.xml`:
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
</block>
So what am I doing wrong? I don't even get a "There are no products matching the selection." from the getProductCollection()
attempt, so I know there is a configuration error rather than a collection error.
I just get an empty div
.
magento-1.9 module blocks
I am very close probably just an XML mistake somewhere. Please assist.
I'm making a custom module.
The directory structure:
In /var/www/html/magento/app/code/mine/MINE
-etc
--config.xml
-Catalog
--Block
---List.php
My config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mine>
<version>0.1.0</version>
</Mine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_Block</class>
</mine>
</blocks>
</global>
</config>
My List.php
class Mine_Mage_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
My module registry in /var/www/html/magento/app/etc/modules
<?xml version="1.0"?>
<!--Mine-->
<config>
<modules>
<Mine_Catalog>
<active>true</active>
<codePool>mine</codePool>
</Mine_Catalog>
</modules>
</config>
It is titled Mine.xml
And finally, my template (slider/shoes.phtml
):
<?php
$_productCollection=$this->zetLoadedProductCollection();
$_helper = $this->helper('catalog/output');
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else:
foreach ($_productCollection as $product)
echo $product->getName();
echo "<br />";
?>
<?php endif; ?>
And my local.xml`:
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
</block>
So what am I doing wrong? I don't even get a "There are no products matching the selection." from the getProductCollection()
attempt, so I know there is a configuration error rather than a collection error.
I just get an empty div
.
magento-1.9 module blocks
magento-1.9 module blocks
edited Jan 18 '17 at 21:56
Summer Developer
asked Jan 15 '17 at 13:13
Summer DeveloperSummer Developer
1496
1496
Are you really sure you run this function and not any other getLoadedProductCollection()?
– Stefan
Jan 15 '17 at 23:02
@Phil Pretty sure, that file is the only php file in my module as set in the block.
– Summer Developer
Jan 16 '17 at 0:10
Well, I comment out thegetLoadedProductCollection()
and I get the same result? How can I debug the module code to see an error like, function not found?
– Summer Developer
Jan 16 '17 at 1:20
Please provide your config.xml file and layout update xml file if any along with the file path. Without this, we can't direct you in the right way.
– Rajeev K Tomy
Jan 16 '17 at 5:08
@RajeevKTomy Please see updated question...
– Summer Developer
Jan 18 '17 at 19:43
|
show 1 more comment
Are you really sure you run this function and not any other getLoadedProductCollection()?
– Stefan
Jan 15 '17 at 23:02
@Phil Pretty sure, that file is the only php file in my module as set in the block.
– Summer Developer
Jan 16 '17 at 0:10
Well, I comment out thegetLoadedProductCollection()
and I get the same result? How can I debug the module code to see an error like, function not found?
– Summer Developer
Jan 16 '17 at 1:20
Please provide your config.xml file and layout update xml file if any along with the file path. Without this, we can't direct you in the right way.
– Rajeev K Tomy
Jan 16 '17 at 5:08
@RajeevKTomy Please see updated question...
– Summer Developer
Jan 18 '17 at 19:43
Are you really sure you run this function and not any other getLoadedProductCollection()?
– Stefan
Jan 15 '17 at 23:02
Are you really sure you run this function and not any other getLoadedProductCollection()?
– Stefan
Jan 15 '17 at 23:02
@Phil Pretty sure, that file is the only php file in my module as set in the block.
– Summer Developer
Jan 16 '17 at 0:10
@Phil Pretty sure, that file is the only php file in my module as set in the block.
– Summer Developer
Jan 16 '17 at 0:10
Well, I comment out the
getLoadedProductCollection()
and I get the same result? How can I debug the module code to see an error like, function not found?– Summer Developer
Jan 16 '17 at 1:20
Well, I comment out the
getLoadedProductCollection()
and I get the same result? How can I debug the module code to see an error like, function not found?– Summer Developer
Jan 16 '17 at 1:20
Please provide your config.xml file and layout update xml file if any along with the file path. Without this, we can't direct you in the right way.
– Rajeev K Tomy
Jan 16 '17 at 5:08
Please provide your config.xml file and layout update xml file if any along with the file path. Without this, we can't direct you in the right way.
– Rajeev K Tomy
Jan 16 '17 at 5:08
@RajeevKTomy Please see updated question...
– Summer Developer
Jan 18 '17 at 19:43
@RajeevKTomy Please see updated question...
– Summer Developer
Jan 18 '17 at 19:43
|
show 1 more comment
2 Answers
2
active
oldest
votes
I think you are fetching category in your custom page then your declartion should be as below
<block type="catalog/product_list" name="itemsShoes" category_id="4" module="Mine" template="slider/shoes.phtml"></block>
here 4 is your category Id
and yes you have to change your block type as yours this catalog/product_list
will point Mage_Catalog_Block_Product_List
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
add a comment |
There are lot of mistakes.
First of all I will start with naming the module.
Change this /var/www/html/magento/app/code/mine/MINE
to /var/www/html/magento/app/code/community/Mine/MyMine
. Remember, we are placing your extension in app/code/community
folder. You can usually place in community or local.
Now, your folder/file structure:
Mine/MyMine/etc/config.xml
Mine/MyMine/Block/List.php
Your config.xml
should be like this:
<?xml version="1.0"?>
<config>
<modules>
<Mine_MyMine>
<version>0.1.0</version>
</Mine_MyMine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_MyMine_Block</class>
</mine>
</blocks>
</global>
</config>
Your List.php
(You shouldn't use Mage
in naming your module, Mage
should be reserved for core.) And it should reside this way app/code/community/Mine/MyMine/Block/Product/List.php
class Mine_MyMine_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
Most importantly your module activation in /var/www/html/magento/app/etc/modules
true
community
Finally, your local.xml
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/product_list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/product_list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/product_list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
You haven't fully included your local.xml
here, so there should be more logic in it to get it work, since you are not overwriting Mage_Catalog_Block_Product_List
block.
This should help.
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%2f154781%2fcant-get-custom-module-block-to-work%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 think you are fetching category in your custom page then your declartion should be as below
<block type="catalog/product_list" name="itemsShoes" category_id="4" module="Mine" template="slider/shoes.phtml"></block>
here 4 is your category Id
and yes you have to change your block type as yours this catalog/product_list
will point Mage_Catalog_Block_Product_List
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
add a comment |
I think you are fetching category in your custom page then your declartion should be as below
<block type="catalog/product_list" name="itemsShoes" category_id="4" module="Mine" template="slider/shoes.phtml"></block>
here 4 is your category Id
and yes you have to change your block type as yours this catalog/product_list
will point Mage_Catalog_Block_Product_List
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
add a comment |
I think you are fetching category in your custom page then your declartion should be as below
<block type="catalog/product_list" name="itemsShoes" category_id="4" module="Mine" template="slider/shoes.phtml"></block>
here 4 is your category Id
and yes you have to change your block type as yours this catalog/product_list
will point Mage_Catalog_Block_Product_List
I think you are fetching category in your custom page then your declartion should be as below
<block type="catalog/product_list" name="itemsShoes" category_id="4" module="Mine" template="slider/shoes.phtml"></block>
here 4 is your category Id
and yes you have to change your block type as yours this catalog/product_list
will point Mage_Catalog_Block_Product_List
answered Jan 16 '17 at 11:52
Murtuza ZabuawalaMurtuza Zabuawala
12.7k73362
12.7k73362
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
add a comment |
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
How do I overrite that class so I can still point to that type? Also I want the category id to be assigned based on the nane attribute.
– Summer Developer
Jan 16 '17 at 15:29
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
Please see updated question.
– Summer Developer
Jan 18 '17 at 18:56
add a comment |
There are lot of mistakes.
First of all I will start with naming the module.
Change this /var/www/html/magento/app/code/mine/MINE
to /var/www/html/magento/app/code/community/Mine/MyMine
. Remember, we are placing your extension in app/code/community
folder. You can usually place in community or local.
Now, your folder/file structure:
Mine/MyMine/etc/config.xml
Mine/MyMine/Block/List.php
Your config.xml
should be like this:
<?xml version="1.0"?>
<config>
<modules>
<Mine_MyMine>
<version>0.1.0</version>
</Mine_MyMine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_MyMine_Block</class>
</mine>
</blocks>
</global>
</config>
Your List.php
(You shouldn't use Mage
in naming your module, Mage
should be reserved for core.) And it should reside this way app/code/community/Mine/MyMine/Block/Product/List.php
class Mine_MyMine_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
Most importantly your module activation in /var/www/html/magento/app/etc/modules
true
community
Finally, your local.xml
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/product_list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/product_list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/product_list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
You haven't fully included your local.xml
here, so there should be more logic in it to get it work, since you are not overwriting Mage_Catalog_Block_Product_List
block.
This should help.
add a comment |
There are lot of mistakes.
First of all I will start with naming the module.
Change this /var/www/html/magento/app/code/mine/MINE
to /var/www/html/magento/app/code/community/Mine/MyMine
. Remember, we are placing your extension in app/code/community
folder. You can usually place in community or local.
Now, your folder/file structure:
Mine/MyMine/etc/config.xml
Mine/MyMine/Block/List.php
Your config.xml
should be like this:
<?xml version="1.0"?>
<config>
<modules>
<Mine_MyMine>
<version>0.1.0</version>
</Mine_MyMine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_MyMine_Block</class>
</mine>
</blocks>
</global>
</config>
Your List.php
(You shouldn't use Mage
in naming your module, Mage
should be reserved for core.) And it should reside this way app/code/community/Mine/MyMine/Block/Product/List.php
class Mine_MyMine_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
Most importantly your module activation in /var/www/html/magento/app/etc/modules
true
community
Finally, your local.xml
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/product_list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/product_list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/product_list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
You haven't fully included your local.xml
here, so there should be more logic in it to get it work, since you are not overwriting Mage_Catalog_Block_Product_List
block.
This should help.
add a comment |
There are lot of mistakes.
First of all I will start with naming the module.
Change this /var/www/html/magento/app/code/mine/MINE
to /var/www/html/magento/app/code/community/Mine/MyMine
. Remember, we are placing your extension in app/code/community
folder. You can usually place in community or local.
Now, your folder/file structure:
Mine/MyMine/etc/config.xml
Mine/MyMine/Block/List.php
Your config.xml
should be like this:
<?xml version="1.0"?>
<config>
<modules>
<Mine_MyMine>
<version>0.1.0</version>
</Mine_MyMine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_MyMine_Block</class>
</mine>
</blocks>
</global>
</config>
Your List.php
(You shouldn't use Mage
in naming your module, Mage
should be reserved for core.) And it should reside this way app/code/community/Mine/MyMine/Block/Product/List.php
class Mine_MyMine_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
Most importantly your module activation in /var/www/html/magento/app/etc/modules
true
community
Finally, your local.xml
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/product_list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/product_list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/product_list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
You haven't fully included your local.xml
here, so there should be more logic in it to get it work, since you are not overwriting Mage_Catalog_Block_Product_List
block.
This should help.
There are lot of mistakes.
First of all I will start with naming the module.
Change this /var/www/html/magento/app/code/mine/MINE
to /var/www/html/magento/app/code/community/Mine/MyMine
. Remember, we are placing your extension in app/code/community
folder. You can usually place in community or local.
Now, your folder/file structure:
Mine/MyMine/etc/config.xml
Mine/MyMine/Block/List.php
Your config.xml
should be like this:
<?xml version="1.0"?>
<config>
<modules>
<Mine_MyMine>
<version>0.1.0</version>
</Mine_MyMine>
</modules>
<global>
<blocks>
<mine>
<class>Mine_MyMine_Block</class>
</mine>
</blocks>
</global>
</config>
Your List.php
(You shouldn't use Mage
in naming your module, Mage
should be reserved for core.) And it should reside this way app/code/community/Mine/MyMine/Block/Product/List.php
class Mine_MyMine_Block_Product_List extends Mage_Catalog_Block_Product_List
protected function _getProductCollection()
$category_id = 3;
$category2B = $this->getNameInLayout;
if($category2B =="itemsShoes")
$category_id = 3; //important
collection = Mage::getSingleton('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*');
return collection;
public function zetLoadedProductCollection()
return $this->_getProductCollection();
Most importantly your module activation in /var/www/html/magento/app/etc/modules
true
community
Finally, your local.xml
<block type="page/html" name="shoeFinder2" module="mine" template="slider/shoefinder2.phtml">
<block type="mine/product_list" name="itemsShoes" module="mine" template="slider/shoes.phtml"></block>
<block type="mine/product_list" name="itemsClothes" module="mine" template="slider/clothes.phtml"></block>
<block type="mine/product_list" name="itemsTennis" module="mine" template="slider/tennis.phtml"></block>
You haven't fully included your local.xml
here, so there should be more logic in it to get it work, since you are not overwriting Mage_Catalog_Block_Product_List
block.
This should help.
answered Jan 18 '17 at 22:27
Adarsh KhatriAdarsh Khatri
6,78511644
6,78511644
add a comment |
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%2f154781%2fcant-get-custom-module-block-to-work%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
Are you really sure you run this function and not any other getLoadedProductCollection()?
– Stefan
Jan 15 '17 at 23:02
@Phil Pretty sure, that file is the only php file in my module as set in the block.
– Summer Developer
Jan 16 '17 at 0:10
Well, I comment out the
getLoadedProductCollection()
and I get the same result? How can I debug the module code to see an error like, function not found?– Summer Developer
Jan 16 '17 at 1:20
Please provide your config.xml file and layout update xml file if any along with the file path. Without this, we can't direct you in the right way.
– Rajeev K Tomy
Jan 16 '17 at 5:08
@RajeevKTomy Please see updated question...
– Summer Developer
Jan 18 '17 at 19:43