Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is due to Magento lazy loading the category model. The <code>getChildrenCategories()</code> method on the <code>Mage_Catalog_Model_Category</code> model returns a collection of category models and Magento only loads the core model data rather than the additional EAV data for each model. The <code>include_in_menu</code> attribute is stored in the EAV data store and has not been loaded.</p> <p>Each category can be forced to load by calling <code>$_category-&gt;load();</code> which will force Magento to load the additional EAV data for each category.</p> <pre><code>// Loop through the categories foreach ($_sub_categories as $_category) { $_category-&gt;load(); if ($_category-&gt;getIsActive() &amp;&amp; $_category-&gt;getIncludeInMenu()) { &lt;echo navigation link&gt; } } </code></pre> <p>This changes the <code>_data</code> array from this:</p> <pre><code>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) </code></pre> <p>To this:</p> <pre><code>array (size=33) '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) 'meta_title' =&gt; null 'display_mode' =&gt; string 'PRODUCTS' (length=8) 'custom_design' =&gt; null 'page_layout' =&gt; null 'url_path' =&gt; string 'vacuum-cleaners' (length=15) 'image' =&gt; string 'heading_vacuums_1.png' (length=21) 'include_in_menu' =&gt; string '1' (length=1) 'landing_page' =&gt; null 'custom_use_parent_settings' =&gt; string '0' (length=1) 'custom_apply_to_products' =&gt; string '0' (length=1) 'filter_price_range' =&gt; null 'description' =&gt; null 'meta_keywords' =&gt; null 'meta_description' =&gt; null 'custom_layout_update' =&gt; null 'available_sort_by' =&gt; null 'custom_design_from' =&gt; null 'custom_design_to' =&gt; null </code></pre> <p>Which includes the <code>include_in_menu</code> attribute.</p>
 

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