Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8586655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:21:42+00:00 2026-06-11T22:21:42+00:00

I am simply trying to retrieve a products name as well as other basic

  • 0

I am simply trying to retrieve a products name as well as other basic information from a product collection in Magento but just get errors or null returned. This is with a view to creating my own featured product block.

I am trying to do this from within the home page (created specifically, rather than using the pre-built 1-column/2-column etc):

app\design\frontend\default\eyt2012\template\page\homepage.phtml

Within my home page, I am loading the collection like so

$category = new Mage_Catalog_Model_Category();
$category->load(236);
$_productCollection = $category->getProductCollection();

Then I am borrowing the code within <ul> from list.phtml, which I know works:

app\design\frontend\default\eyt2012\template\catalog\product\list.phtml

to output all the products in a collection in a nice grid format with images, titles and prices.

Altogether I have so far:

<div class="featured-products">
    Products of the week    

    <?php    
        $category = new Mage_Catalog_Model_Category();
        $category->load(236);
        $_productCollection = $category->getProductCollection();    
    ?>   

        <ul class="products-grid">    

            <?php $_collectionSize = $_productCollection->count() ?>
            <?php $_columnCount = 5 ?>
            <?php 
                $i=0; foreach ($_productCollection as $_product): 
                $i++;
            ?>

                    <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">

                        1

                        <a 
                        href="<?php echo $_product->getProductUrl() ?>" 
                        title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" 
                        class="product-image">
                            <span class="placeholder"></span>
                            <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(155); ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
                        </a>

                        2

                        <?php if ($_product->getbrands()):?>
                            <span class="brandname"><?php echo $_product->getAttributeText('brands') ?></span>
                        <?php endif;?>

                        3  ! Code currently gets to here before error occurs


                        <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>

                        4
                        <?php echo $this->getPriceHtml($_product, true) ?>

                        5

                        <div class="actions">

                            <?php if($_product->isSaleable()): ?>

                                <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

                            <?php else: ?>

                                <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>

                            <?php endif; ?>

                        </div>




                    </li>

                <?php endforeach ?>

            </ul>




</div>

which is essentially just the code from list.phtml, except my own product collection is used.

I have put numbers after each block of functionality in the above code to test what is causing the error. Currently it gets to 3 then stops.

Can anyone tell me why the $_product->getName() fails to work, along with the others in that block?

Any help would be appreciated. Thanks.

EDIT:

var_dump of $_productCollection

object(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection)[337]
  protected '_flatEnabled' => 
    array (size=1)
      1 => boolean false
  protected '_productWebsiteTable' => string 'catalog_product_website' (length=23)
  protected '_productCategoryTable' => string 'catalog_category_product' (length=24)
  protected '_addUrlRewrite' => boolean false
  protected '_urlRewriteCategory' => string '' (length=0)
  protected '_addMinimalPrice' => boolean false
  protected '_addFinalPrice' => boolean false
  protected '_allIdsCache' => null
  protected '_addTaxPercents' => boolean false
  protected '_productLimitationFilters' => 
    array (size=3)
      'category_id' => string '236' (length=3)
      'category_is_anchor' => int 1
      'store_id' => string '1' (length=1)
  protected '_productCountSelect' => null
  protected '_isWebsiteFilter' => boolean false
  protected '_priceDataFieldFilters' => 
    array (size=0)
      empty
  protected '_map' => 
    array (size=1)
      'fields' => 
        array (size=6)
          'price' => string 'price_index.price' (length=17)
          'final_price' => string 'price_index.final_price' (length=23)
          'min_price' => string 'price_index.min_price' (length=21)
          'max_price' => string 'price_index.max_price' (length=21)
          'tier_price' => string 'price_index.tier_price' (length=22)
          'special_price' => string 'price_index.special_price' (length=25)
  protected '_storeId' => string '1' (length=1)
  protected '_itemsById' => 
    array (size=0)
      empty
  protected '_staticFields' => 
    array (size=6)
      'entity_id' => string 'entity_id' (length=9)
      'entity_type_id' => string 'entity_type_id' (length=14)
      'attribute_set_id' => string 'attribute_set_id' (length=16)
      'type_id' => string 'type_id' (length=7)
      'created_at' => string 'created_at' (length=10)
      'updated_at' => string 'updated_at' (length=10)
  protected '_entity' => 
    object(Mage_Catalog_Model_Resource_Eav_Mysql4_Product)[165]
      protected '_productWebsiteTable' => string 'catalog_product_website' (length=23)
      protected '_productCategoryTable' => string 'catalog_category_product' (length=24)
      protected '_attributes' => 
        array (size=0)
          empty
      protected '_read' => 
        object(Varien_Db_Adapter_Pdo_Mysql)[90]
          protected '_transactionLevel' => int 0
          protected '_connectionFlagsSet' => boolean true
          protected '_ddlCache' => 
            array (size=1)
              ...
          protected '_bindParams' => 
            array (size=2)
              ...
          protected '_bindIncrement' => int 2
          protected '_debug' => boolean false
          protected '_logQueryTime' => float 0.05
          protected '_logAllQueries' => boolean false
          protected '_logCallStack' => boolean false
          protected '_debugFile' => string 'var/debug/sql.txt' (length=17)
          protected '_debugIoAdapter' => null
          protected '_debugTimer' => int 0
          protected '_cacheAdapter' => 
            object(Varien_Cache_Core)[13]
              ...
          protected '_isDdlCacheAllowed' => boolean true
          protected '_pdoType' => string 'mysql' (length=5)
          protected '_numericDataTypes' => 
            array (size=16)
              ...
          protected '_defaultStmtClass' => string 'Zend_Db_Statement_Pdo' (length=21)
          protected '_config' => 
            array (size=12)
              ...
          protected '_fetchMode' => int 2
          protected '_profiler' => 
            object(Zend_Db_Profiler)[20]
              ...
          protected '_defaultProfilerClass' => string 'Zend_Db_Profiler' (length=16)
          protected '_connection' => 
            object(PDO)[17]
              ...
          protected '_caseFolding' => int 0
          protected '_autoQuoteIdentifiers' => boolean true
          protected '_allowSerialization' => boolean true
          protected '_autoReconnectOnUnserialize' => boolean false
      protected '_write' => string 'catalog_write' (length=13)
      protected '_type' => 
        object(Mage_Eav_Model_Entity_Type)[123]
          protected '_attributes' => null
          protected '_attributesBySet' => 
            array (size=0)
              ...
          protected '_sets' => null
          protected '_eventPrefix' => string 'core_abstract' (length=13)
          protected '_eventObject' => string 'object' (length=6)
          protected '_resourceName' => string 'eav/entity_type' (length=15)
          protected '_resource' => null
          protected '_resourceCollectionName' => string 'eav/entity_type_collection' (length=26)
          protected '_cacheTag' => boolean false
          protected '_dataSaveAllowed' => boolean true
          protected '_isObjectNew' => null
          protected '_data' => 
            array (size=16)
              ...
          protected '_hasDataChanges' => boolean true
          protected '_origData' => null
          protected '_idFieldName' => string 'entity_type_id' (length=14)
          protected '_isDeleted' => boolean false
      protected '_attributesById' => 
        array (size=0)
          empty
      protected '_attributesByCode' => 
        array (size=0)
          empty
      protected '_attributesByTable' => 
        array (size=0)
          empty
      protected '_staticAttributes' => 
        array (size=0)
          empty
      protected '_entityTable' => string 'catalog_product_entity' (length=22)
      protected '_describeTable' => 
        array (size=0)
          empty
      protected '_entityIdField' => string 'entity_id' (length=9)
      protected '_valueEntityIdField' => null
      protected '_valueTablePrefix' => null
      protected '_isPartialLoad' => boolean false
      protected '_isPartialSave' => boolean false
      protected '_sortingSetId' => null
      protected '_attributeValuesToDelete' => 
        array (size=0)
          empty
      protected '_attributeValuesToSave' => 
        array (size=0)
          empty
  protected '_selectEntityTypes' => 
    array (size=0)
      empty
  protected '_selectAttributes' => 
    array (size=0)
      empty
  protected '_filterAttributes' => 
    array (size=0)
      empty
  protected '_joinEntities' => 
    array (size=0)
      empty
  protected '_joinAttributes' => 
    array (size=0)
      empty
  protected '_joinFields' => 
    array (size=0)
      empty
  protected '_conn' => 
    object(Varien_Db_Adapter_Pdo_Mysql)[90]
      protected '_transactionLevel' => int 0
      protected '_connectionFlagsSet' => boolean true
      protected '_ddlCache' => 
        array (size=1)
          1 => 
            array (size=1)
              ...
      protected '_bindParams' => 
        array (size=2)
          ':_mage_bind_var_1' => string '2012-09-26 14:11:06' (length=19)
          ':_mage_bind_var_2' => string '2012-09-26 14:11:06' (length=19)
      protected '_bindIncrement' => int 2
      protected '_debug' => boolean false
      protected '_logQueryTime' => float 0.05
      protected '_logAllQueries' => boolean false
      protected '_logCallStack' => boolean false
      protected '_debugFile' => string 'var/debug/sql.txt' (length=17)
      protected '_debugIoAdapter' => null
      protected '_debugTimer' => int 0
      protected '_cacheAdapter' => 
        object(Varien_Cache_Core)[13]
          protected '_backend' => 
            object(Zend_Cache_Backend_File)[10]
              ...
          protected '_options' => 
            array (size=9)
              ...
          protected '_specificOptions' => 
            array (size=0)
              ...
          private '_lastId' (Zend_Cache_Core) => string 'd11_DB_PDO_MYSQL_DDL_googleoptimizer_code_1' (length=43)
          protected '_extendedBackend' => boolean true
          protected '_backendCapabilities' => 
            array (size=6)
              ...
      protected '_isDdlCacheAllowed' => boolean true
      protected '_pdoType' => string 'mysql' (length=5)
      protected '_numericDataTypes' => 
        array (size=16)
          0 => int 0
          1 => int 1
          2 => int 2
          'INT' => int 0
          'INTEGER' => int 0
          'MEDIUMINT' => int 0
          'SMALLINT' => int 0
          'TINYINT' => int 0
          'BIGINT' => int 1
          'SERIAL' => int 1
          'DEC' => int 2
          'DECIMAL' => int 2
          'DOUBLE' => int 2
          'DOUBLE PRECISION' => int 2
          'FIXED' => int 2
          'FLOAT' => int 2
      protected '_defaultStmtClass' => string 'Zend_Db_Statement_Pdo' (length=21)
      protected '_config' => 
        array (size=12)
          'model' => string 'mysql4' (length=6)
          'initStatements' => string 'SET NAMES utf8' (length=14)
          'type' => string 'pdo_mysql' (length=9)
          'host' => string 'localhost' (length=9)
          'username' => string 'root' (length=4)
          'password' => 
            object(Mage_Core_Model_Config_Element)[34]
              ...
          'dbname' => string 'eyt' (length=3)
          'active' => string '1' (length=1)
          'charset' => null
          'persistent' => boolean false
          'options' => 
            array (size=3)
              ...
          'driver_options' => 
            array (size=0)
              ...
      protected '_fetchMode' => int 2
      protected '_profiler' => 
        object(Zend_Db_Profiler)[20]
          protected '_queryProfiles' => 
            array (size=0)
              ...
          protected '_enabled' => boolean false
          protected '_filterElapsedSecs' => null
          protected '_filterTypes' => null
      protected '_defaultProfilerClass' => string 'Zend_Db_Profiler' (length=16)
      protected '_connection' => 
        object(PDO)[17]
      protected '_caseFolding' => int 0
      protected '_autoQuoteIdentifiers' => boolean true
      protected '_allowSerialization' => boolean true
      protected '_autoReconnectOnUnserialize' => boolean false
  protected '_select' => 
    object(Varien_Db_Select)[324]
      protected '_bind' => 
        array (size=0)
          empty
      protected '_adapter' => 
        object(Varien_Db_Adapter_Pdo_Mysql)[90]
          protected '_transactionLevel' => int 0
          protected '_connectionFlagsSet' => boolean true
          protected '_ddlCache' => 
            array (size=1)
              ...
          protected '_bindParams' => 
            array (size=2)
              ...
          protected '_bindIncrement' => int 2
          protected '_debug' => boolean false
          protected '_logQueryTime' => float 0.05
          protected '_logAllQueries' => boolean false
          protected '_logCallStack' => boolean false
          protected '_debugFile' => string 'var/debug/sql.txt' (length=17)
          protected '_debugIoAdapter' => null
          protected '_debugTimer' => int 0
          protected '_cacheAdapter' => 
            object(Varien_Cache_Core)[13]
              ...
          protected '_isDdlCacheAllowed' => boolean true
          protected '_pdoType' => string 'mysql' (length=5)
          protected '_numericDataTypes' => 
            array (size=16)
              ...
          protected '_defaultStmtClass' => string 'Zend_Db_Statement_Pdo' (length=21)
          protected '_config' => 
            array (size=12)
              ...
          protected '_fetchMode' => int 2
          protected '_profiler' => 
            object(Zend_Db_Profiler)[20]
              ...
          protected '_defaultProfilerClass' => string 'Zend_Db_Profiler' (length=16)
          protected '_connection' => 
            object(PDO)[17]
              ...
          protected '_caseFolding' => int 0
          protected '_autoQuoteIdentifiers' => boolean true
          protected '_allowSerialization' => boolean true
          protected '_autoReconnectOnUnserialize' => boolean false
      protected '_parts' => 
        array (size=12)
          'straightjoin' => boolean false
          'distinct' => boolean false
          'columns' => 
            array (size=2)
              ...
          'union' => 
            array (size=0)
              ...
          'from' => 
            array (size=2)
              ...
          'where' => 
            array (size=0)
              ...
          'group' => 
            array (size=0)
              ...
          'having' => 
            array (size=0)
              ...
          'order' => 
            array (size=0)
              ...
          'limitcount' => null
          'limitoffset' => null
          'forupdate' => boolean false
      protected '_tableCols' => 
        array (size=0)
          empty
  protected '_cacheConf' => null
  protected '_idFieldName' => null
  protected '_bindParams' => 
    array (size=0)
      empty
  protected '_data' => null
  protected '_fetchStmt' => null
  protected '_items' => 
    array (size=0)
      empty
  protected '_itemObjectClass' => string 'Mage_Catalog_Model_Product' (length=26)
  protected '_orders' => 
    array (size=0)
      empty
  protected '_filters' => 
    array (size=0)
      empty
  protected '_isFiltersRendered' => boolean false
  protected '_curPage' => int 1
  protected '_pageSize' => boolean false
  protected '_totalRecords' => null
  protected '_isCollectionLoaded' => null
  protected '_cacheKey' => null
  protected '_cacheTags' => 
    array (size=0)
      empty
  protected '_cacheLifetime' => int 86400
  protected '_flags' => 
    array (size=0)
      empty
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:21:44+00:00Added an answer on June 11, 2026 at 10:21 pm

    To get the product name you need to add it to the select:

    $_productCollection = $category->getProductCollection()
        ->addAttributeToSelect('name');
    

    Also, if you have provided your code in its entirety then you have not initialised the $_helper variable which will be throwing an error:

    $_helper = Mage::helper('catalog/output');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to retrieve folders name from a zip file. I wrote this simple
I am simply trying to retrieve an attribute from XML into my Perl program.
I am trying to launch a background thread to retrieve XML data from a
I am trying to retrieve all cards from Mongoid that have request=preview I'm doing
I want to simply retrieve a single record from a database in a classic
I'm trying to do a simple Select Count(*) from PRODUCTS where date > xxx
I am simply trying to retrieve a pages' title with the script below. However,
I'm trying to make a Linq query that will retrieve a string value from
I'm trying to create configurable products programmatically in Magento 1.5.1. I understand I need
I am trying to use Regular Expressions to decode some HTML I retrieve from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.