Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento Category model not loading all data
    text
    copied!<p>I am building a custom navigation menu in Magento which displays the categories from a different store with a different root category from the current store. Some of the categories should be hidden as they have 'Include in Navigation Menu' set to No.</p> <p>It should be possible to read this attribute from the category model as in this question: <a href="https://stackoverflow.com/questions/5708266/how-do-i-detect-if-a-category-has-include-in-navigation-menu-set-to-no">How do I detect if a category has Include in Navigation Menu set to NO?</a></p> <p>However $category->getIncludeInMenu() is returning NULL for all categories on my Magento EE 1.11 installation.</p> <pre><code>// Load child categories for a specific root category $_uk_default_root_id = Mage::app()-&gt;getStore('uk_default')-&gt;getRootCategoryId(); $_uk_default_root_category = Mage::getModel('catalog/category')-&gt;load($_uk_default_root_id); $_sub_categories = $_uk_default_root_category-&gt;getChildrenCategories(); // Loop through the categories foreach ($_sub_categories as $_category) { if ($_category-&gt;getIsActive() &amp;&amp; $_category-&gt;getIncludeInMenu()) { &lt;echo navigation link&gt; } } </code></pre> <p>A var dump of one of the categories shows no 'include_in_menu' attribute, although the 'is_active' attribute works as expected. Is there an alternative way to determine if a category should be displayed in the navigation?</p> <p>Var dump of category object:</p> <pre><code>object(Mage_Catalog_Model_Category)[423] protected '_eventPrefix' =&gt; string 'catalog_category' (length=16) protected '_eventObject' =&gt; string 'category' (length=8) protected '_cacheTag' =&gt; string 'catalog_category' (length=16) protected '_useFlatResource' =&gt; boolean false private '_designAttributes' =&gt; array (size=6) 0 =&gt; string 'custom_design' (length=13) 1 =&gt; string 'custom_design_from' (length=18) 2 =&gt; string 'custom_design_to' (length=16) 3 =&gt; string 'page_layout' (length=11) 4 =&gt; string 'custom_layout_update' (length=20) 5 =&gt; string 'custom_apply_to_products' (length=24) protected '_treeModel' =&gt; null protected '_defaultValues' =&gt; array (size=0) empty protected '_storeValuesFlags' =&gt; array (size=0) empty protected '_lockedAttributes' =&gt; array (size=0) empty protected '_isDeleteable' =&gt; boolean true protected '_isReadonly' =&gt; boolean false protected '_resourceName' =&gt; string 'catalog/category' (length=16) protected '_resource' =&gt; null protected '_resourceCollectionName' =&gt; string 'catalog/category_collection' (length=27) protected '_dataSaveAllowed' =&gt; boolean true protected '_isObjectNew' =&gt; null protected '_data' =&gt; array (size=15) 'entity_id' =&gt; string '16' (length=2) 'entity_type_id' =&gt; string '3' (length=1) 'attribute_set_id' =&gt; string '3' (length=1) 'parent_id' =&gt; string '15' (length=2) 'created_at' =&gt; string '2011-11-16 12:16:27' (length=19) 'updated_at' =&gt; string '2011-12-19 16:19:08' (length=19) 'path' =&gt; string '1/15/16' (length=7) 'position' =&gt; string '1' (length=1) 'level' =&gt; string '2' (length=1) 'children_count' =&gt; string '8' (length=1) 'is_active' =&gt; string '1' (length=1) 'request_path' =&gt; null 'name' =&gt; string 'Vacuum Cleaners' (length=15) 'url_key' =&gt; string 'vacuum-cleaners' (length=15) 'is_anchor' =&gt; string '1' (length=1) protected '_hasDataChanges' =&gt; boolean true protected '_origData' =&gt; array (size=15) 'entity_id' =&gt; string '16' (length=2) 'entity_type_id' =&gt; string '3' (length=1) 'attribute_set_id' =&gt; string '3' (length=1) 'parent_id' =&gt; string '15' (length=2) 'created_at' =&gt; string '2011-11-16 12:16:27' (length=19) 'updated_at' =&gt; string '2011-12-19 16:19:08' (length=19) 'path' =&gt; string '1/15/16' (length=7) 'position' =&gt; string '1' (length=1) 'level' =&gt; string '2' (length=1) 'children_count' =&gt; string '8' (length=1) 'is_active' =&gt; string '1' (length=1) 'request_path' =&gt; null 'name' =&gt; string 'Vacuum Cleaners' (length=15) 'url_key' =&gt; string 'vacuum-cleaners' (length=15) 'is_anchor' =&gt; string '1' (length=1) protected '_idFieldName' =&gt; string 'entity_id' (length=9) protected '_isDeleted' =&gt; boolean false protected '_oldFieldsMap' =&gt; array (size=0) empty protected '_syncFieldsMap' =&gt; array (size=0) empty </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload