I'm having a problem with picture module and loading of lists. So my structure is content type with some fields one of them is image set to display picture.
On another page I wan't to display 2 objects of that content type. So I select it from the database and preprocess fields. With normal fields it's ok since i only need theirs value, but with picture I need all other data like breakpoints, theme.
Basicly for image I get that:
array (size=1)
'und' =>
array (size=1)
0 =>
array (size=18)
'fid' => string '3023' (length=4)
'uid' => string '1' (length=1)
'filename' => string 'profile_picture.jpg' (length=19)
'uri' => string 'public://profile_picture.jpg' (length=28)
'filemime' => string 'image/jpeg' (length=10)
'filesize' => string '325835' (length=6)
'status' => string '1' (length=1)
'timestamp' => string '1421745203' (length=10)
'type' => string 'image' (length=5)
'uuid' => string '59484070-9a95-42fb-8b2a-594e5d3a7483' (length=36)
'field_file_image_alt_text' =>
array (size=0)
empty
'field_file_image_title_text' =>
array (size=0)
empty
'rdf_mapping' =>
array (size=0)
empty
'metadata' =>
array (size=2)
'height' => int 500
'width' => int 400
'alt' => string '' (length=0)
'title' => string '' (length=0)
'width' => string '400' (length=3)
'height' => string '500' (length=3)
And I need that:
'#theme' => string 'picture_formatter' (length=17)
'#attached' =>
array (size=1)
'library' =>
array (size=3)
0 =>
array (size=2)
0 => string 'picture' (length=7)
1 => string 'picturefill_head' (length=16)
1 =>
array (size=2)
0 => string 'picture' (length=7)
1 => string 'picturefill' (length=11)
2 =>
array (size=2)
0 => string 'picture' (length=7)
1 => string 'picture.ajax' (length=12)
'#item' =>
array (size=18)
'fid' => string '3023' (length=4)
'uid' => string '1' (length=1)
'filename' => string 'profile_picture.jpg' (length=19)
'uri' => string 'public://profile_picture.jpg' (length=28)
'filemime' => string 'image/jpeg' (length=10)
'filesize' => string '325835' (length=6)
'status' => string '1' (length=1)
'timestamp' => string '1421745203' (length=10)
'type' => string 'image' (length=5)
'uuid' => string '59484070-9a95-42fb-8b2a-594e5d3a7483' (length=36)
'field_file_image_alt_text' =>
array (size=0)
empty
'field_file_image_title_text' =>
array (size=0)
empty
'rdf_mapping' =>
array (size=0)
empty
'metadata' =>
array (size=2)
'height' => int 500
'width' => int 400
'alt' => string '' (length=0)
'title' => string '' (length=0)
'width' => string '400' (length=3)
'height' => string '500' (length=3)
'#image_style' => string 'large_custom_user_mobile_1x' (length=27)
'#breakpoints' =>
array (size=5)
'custom.user.ultra_wide' =>
array (size=1)
'1x' =>
array (size=2)
'mapping_type' => string 'image_style' (length=11)
'image_style' => string 'large_custom_user_ultra_wide_1x' (length=31)
'custom.user.wide' =>
array (size=1)
'1x' =>
array (size=2)
'mapping_type' => string 'image_style' (length=11)
'image_style' => string 'large_custom_user_wide_1x' (length=25)
'custom.user.normal' =>
array (size=1)
'1x' =>
array (size=2)
'mapping_type' => string 'image_style' (length=11)
'image_style' => string 'large_custom_user_normal_1x' (length=27)
'custom.user.narrow' =>
array (size=1)
'1x' =>
array (size=2)
'mapping_type' => string 'image_style' (length=11)
'image_style' => string 'large_custom_user_narrow_1x' (length=27)
'custom.user.mobile' =>
array (size=1)
'1x' =>
array (size=2)
'mapping_type' => string 'image_style' (length=11)
'image_style' => string 'large_custom_user_mobile_1x' (length=27)
'#path' => string '' (length=0)
'#colorbox_group' =>
array (size=0)
empty
'#colorbox_image_style' => string '' (length=0)
So the question is how to prepare field.
Thanks!
I think what you are searching for is field_view_field(). This function will invoke internally hook_field_formatter_view(). The picture module implements this hook, and depending on the $display parameter it will internally call one of the provided display functions.
Based on the desired output you requested, you should pass picture as display parameter, in order to invoke picture_field_formatter_picture_view() which seems to return the appropriate renderable array.
Related
i'm newbie so I hope you can help me.
I have yii2 and i need to implement elasticSearch(ES).
All set up.
I made standart model and standart CRUD. Just a few changes to implement ES like
use yii\elasticsearch\ActiveRecord;
But I have a problem with getting _id in my view/index.php
to get _id in view.php i made
$model->_id = $model->primaryKey;
But how I can fix it with DataProvider in index.php?
my attributes
public function attributes()
{
return [
'_id',
'first_name',
'last_name',
'email',
'created',
'brand',
'product',
'qty',
'sum'
];
}
My rules
public function rules()
{
return [
[['first_name', 'last_name', 'email', 'created',
'brand', 'product', 'qty', 'sum'
],
'safe'],
[['qty'], 'integer'],
[['sum'], 'double'],
['email', 'email'],
];
}
I think it should work like with MongoDB, but it doesn't.
if I want to delete or view or update the data being on index.php I can se only such links w/o id
http://yii2.dev/index.php?r=elastic%2Fdelete&id=
Pls help
P.S.
Here is a var_dump
array (size=5)
0 =>
object(frontend\models\Elastic)[67]
private '_id' (yii\elasticsearch\ActiveRecord) => string 'AVreA6SUvBgWLKxTzUZn' (length=20)
private '_score' (yii\elasticsearch\ActiveRecord) => float 1
private '_version' (yii\elasticsearch\ActiveRecord) => null
private '_highlight' (yii\elasticsearch\ActiveRecord) => null
private '_attributes' (yii\db\BaseActiveRecord) =>
array (size=8)
'created' => string '2017-03-12' (length=10)
'first_name' => string 'Luka' (length=4)
'last_name' => string 'Signori' (length=7)
'email' => string 'l.signori#gmail.com' (length=19)
'brand' => string 'Apple' (length=5)
'product' => string 'iPad' (length=4)
'qty' => string '35' (length=2)
'sum' => string '600.00' (length=6)
private '_oldAttributes' (yii\db\BaseActiveRecord) =>
array (size=8)
'created' => string '2017-03-12' (length=10)
'first_name' => string 'Luka' (length=4)
'last_name' => string 'Signori' (length=7)
'email' => string 'l.signori#gmail.com' (length=19)
'brand' => string 'Apple' (length=5)
'product' => string 'iPad' (length=4)
'qty' => string '35' (length=2)
'sum' => string '600.00' (length=6)
private '_related' (yii\db\BaseActiveRecord) =>
array (size=0)
empty
private '_errors' (yii\base\Model) => null
private '_validators' (yii\base\Model) => null
private '_scenario' (yii\base\Model) => string 'default' (length=7)
private '_events' (yii\base\Component) =>
array (size=0)
empty
private '_behaviors' (yii\base\Component) =>
array (size=0)
empty
you can set.good luck
$dataProvider = new ActiveDataProvider([
'query' => $query,
'key' => ['your primaryKey']
'sort' => [
'defaultOrder' => ['datetime'=>SORT_DESC]
],
]);
My code:
Generating data data provider
$result = Yii::$app->db->createCommand($sql)->queryAll();
$data_provider = new \yii\data\ArrayDataProvider([
'allModels' => $result,
'key' => 'part_id',
'pagination' => [
'pageSize' => 15,
],
]);
View:
ListView::widget([
'dataProvider' => $data_provider,
'layout' => '{items}',
'options' => [
'class' => 'list-view',
'id' => 'search_results'
],
'itemView' => '_result',
]);
And _result :
DetailView::widget([
'model' => $model,
'attributes' => [
'part_id',
],
])
Result:
Part Id 1
Part Id 1
Part Id 1
[...]
Why???
If I do var_dump($data_provider) in View I get:
object(yii\data\ArrayDataProvider)[105]
public 'key' => string 'part_id' (length=7)
public 'allModels' =>
array (size=100)
0 =>
array (size=7)
'part_id' => string '1' (length=1)
[...]
1 =>
array (size=7)
'part_id' => string '2' (length=1)
[...]
2 =>
array (size=7)
'part_id' => string '3' (length=1)
[...]
[...]
What am I doing wrong?
Hey guys I'm trying to grab a relation from the Friend model (pivot for user friends). When I try to dump the relation of the Friend object I should be getting a User model, instead it dumps only the ID of the User.
Here is the Friend Model:
class Friend extends Eloquent
{
public function requester()
{
return $this->belongsTo('Acme\Users\User', 'requester');
}
}
Here is friend repo:
public function getFriendRequests($id, $onlyAccepted = false)
{
return Friend::where('acceptor', $id)->with('requester')->get();
}
Here is FriendsController:
$friendAccepts = $this->friendRepo->getFriendAccepts(Auth::id(), true);
dd($friendAccepts[0]->acceptor);
It should be dumping a User object but I'm only getting the ID of the user when I do:
int 101
Here is output when I dd($friendAccepts[0]);
(It correctly shows the relation eager loaded as a User object
object(Acme\Friends\Friend)[513]
protected 'fillable' =>
array (size=5)
0 => string 'requester' (length=9)
1 => string 'acceptor' (length=8)
2 => string 'status' (length=6)
3 => string 'created_at' (length=10)
4 => string 'updated_at' (length=10)
protected 'table' => string 'friends' (length=7)
protected 'connection' => null
protected 'primaryKey' => string 'id' (length=2)
protected 'perPage' => int 15
public 'incrementing' => boolean true
public 'timestamps' => boolean true
protected 'attributes' =>
array (size=7)
'id' => int 1
'requester' => int 101
'acceptor' => int 1
'status' => int 2
'created_at' => string '2014-05-02 22:53:35' (length=19)
'updated_at' => string '2014-07-31 12:56:53' (length=19)
'deleted_at' => null
protected 'original' =>
array (size=7)
'id' => int 1
'requester' => int 101
'acceptor' => int 1
'status' => int 2
'created_at' => string '2014-05-02 22:53:35' (length=19)
'updated_at' => string '2014-07-31 12:56:53' (length=19)
'deleted_at' => null
protected 'relations' =>
array (size=1)
'acceptor' =>
object(Acme\Users\User)[318]
protected 'fillable' =>
array (size=10)
...
protected 'table' => string 'users' (length=5)
protected 'hidden' =>
array (size=2)
...
protected 'connection' => null
protected 'primaryKey' => string 'id' (length=2)
protected 'perPage' => int 15
public 'incrementing' => boolean true
public 'timestamps' => boolean true
protected 'attributes' =>
array (size=16)
...
protected 'original' =>
array (size=16)
...
protected 'relations' =>
array (size=0)
...
protected 'visible' =>
array (size=0)
...
protected 'appends' =>
array (size=0)
...
protected 'guarded' =>
array (size=1)
...
protected 'dates' =>
array (size=0)
...
protected 'touches' =>
array (size=0)
...
protected 'observables' =>
array (size=0)
...
protected 'with' =>
array (size=0)
...
protected 'morphClass' => null
public 'exists' => boolean true
protected 'pendingEvents' =>
array (size=0)
...
protected 'hidden' =>
array (size=0)
empty
protected 'visible' =>
array (size=0)
empty
protected 'appends' =>
array (size=0)
empty
protected 'guarded' =>
array (size=1)
0 => string '*' (length=1)
protected 'dates' =>
array (size=0)
empty
protected 'touches' =>
array (size=0)
empty
protected 'observables' =>
array (size=0)
empty
protected 'with' =>
array (size=0)
empty
protected 'morphClass' => null
public 'exists' => boolean true
protected 'pendingEvents' =>
array (size=0)
empty
UPDATE:
When I use toArray() and access acceptor as a keyed array element it dumps the user object's properties.
dd(Friend::where('requester', Auth::id())->with('acceptor')->first()->toArray()['acceptor'])
Output:
array (size=7)
'id' => int 1
'requester' => int 101
'acceptor' =>
array (size=14)
'id' => int 1
'email' => string 'nader.verla#johnston.com435' (length=27)
'fname' => string 'April' (length=5)
'lname' => string 'Macejkovic' (length=10)
'username' => string 'AprilMacejkovic40466' (length=20)
'birthday' => string '2006-12-02' (length=10)
'gender' => string 'Male' (length=4)
'location' => string 'Port Noelside' (length=13)
'website' => string 'pagacvandervort.net' (length=19)
'bio' => string 'Ut ut quia vitae vero. Sit eligendi voluptate quia. Voluptas ea accusamus fuga officiis sunt. Sed est fugiat et et voluptas. Distinctio vero error aliquid. Ipsam et tempora asperiores temporibus in autem.' (length=204)
'profile_picture' => string '' (length=0)
'created_at' => string '2013-10-18 09:49:31' (length=19)
'updated_at' => string '2014-03-05 04:17:24' (length=19)
'deleted_at' => null
'status' => int 2
'created_at' => string '2014-05-02 22:53:35' (length=19)
'updated_at' => string '2014-07-31 12:56:53' (length=19)
'deleted_at' => null
You may not want to have relationship methods named the same as table "attributes"(fields) if you plan on using dynamic properties to access those methods.
There is already a mechanism in place to resolve the dynamic properties and inaccesible properties using __get($key) which calls getAttribute($key). The first thing it checks for is if the key exists in the $attributes of the model instance and returns it if it does. This will stop it from continuing to check if there is a relation loaded with that name or if there is a method to call with a camel case version of that key.
"This allows every attribute to dynamically accessed through the _get method without accessors."
Ref
Eloquent Model API
Eloquent Model #__get
Eloquent Model #getAttribute
I'm struggling to get the number of articles from a specific category from my custom module? Would anyone mind pointing me in the correct direction as to what function I should use?
I've been using the following:
$model = JModelLegacy::getInstance('Articles', 'ContentModel');
$model->setState('filter_fields.catid', 16);
$articles = $model->getItems();
But I only get the following returned:
object(ContentModelArticles)[134]
protected 'cache' =>
array
empty
protected 'context' => string 'com_content.articles' (length=20)
protected 'filter_fields' =>
array
0 => string 'id' (length=2)
1 => string 'a.id' (length=4)
2 => string 'title' (length=5)
3 => string 'a.title' (length=7)
4 => string 'alias' (length=5)
5 => string 'a.alias' (length=7)
6 => string 'checked_out' (length=11)
7 => string 'a.checked_out' (length=13)
8 => string 'checked_out_time' (length=16)
9 => string 'a.checked_out_time' (length=18)
10 => string 'catid' (length=5)
11 => string 'a.catid' (length=7)
12 => string 'category_title' (length=14)
13 => string 'state' (length=5)
14 => string 'a.state' (length=7)
15 => string 'access' (length=6)
16 => string 'a.access' (length=8)
17 => string 'access_level' (length=12)
18 => string 'created' (length=7)
19 => string 'a.created' (length=9)
20 => string 'created_by' (length=10)
21 => string 'a.created_by' (length=12)
22 => string 'ordering' (length=8)
23 => string 'a.ordering' (length=10)
24 => string 'featured' (length=8)
25 => string 'a.featured' (length=10)
26 => string 'language' (length=8)
27 => string 'a.language' (length=10)
28 => string 'hits' (length=4)
29 => string 'a.hits' (length=6)
30 => string 'publish_up' (length=10)
31 => string 'a.publish_up' (length=12)
32 => string 'publish_down' (length=12)
33 => string 'a.publish_down' (length=14)
34 => string 'images' (length=6)
35 => string 'a.images' (length=8)
36 => string 'urls' (length=4)
37 => string 'a.urls' (length=6)
protected 'query' =>
array
empty
protected '__state_set' => null
protected '_db' =>
object(JDatabaseMySQLi)[15]
public 'name' => string 'mysqli' (length=6)
protected 'nameQuote' => string '`' (length=1)
protected 'nullDate' => string '0000-00-00 00:00:00' (length=19)
protected 'dbMinimum' => string '5.0.4' (length=5)
private '_database' (JDatabase) => string 'xxxx' (length=25)
protected 'connection' =>
object(mysqli)[16]
public 'affected_rows' => null
public 'client_info' => null
public 'client_version' => null
public 'connect_errno' => null
public 'connect_error' => null
public 'errno' => null
public 'error' => null
public 'field_count' => null
public 'host_info' => null
public 'info' => null
public 'insert_id' => null
public 'server_info' => null
public 'server_version' => null
public 'sqlstate' => null
public 'protocol_version' => null
public 'thread_id' => null
public 'warning_count' => null
protected 'count' => int 0
protected 'cursor' =>
object(mysqli_result)[202]
public 'current_field' => null
public 'field_count' => null
public 'lengths' => null
public 'num_rows' => null
public 'type' => null
protected 'debug' => boolean false
protected 'limit' => int 0
protected 'log' =>
array
empty
protected 'offset' => int 0
protected 'sql' =>
object(JDatabaseQueryMySQLi)[258]
protected 'db' =>
&object(JDatabaseMySQLi)[15]
protected 'type' => string 'select' (length=6)
protected 'element' => null
protected 'select' =>
object(JDatabaseQueryElement)[257]
protected 'name' => string 'SELECT' (length=6)
protected 'elements' =>
array
0 => string 'm.id, m.title, m.module, m.position, m.content, m.showtitle, m.params, mm.menuid' (length=80)
protected 'glue' => string ',' (length=1)
protected 'delete' => null
protected 'update' => null
protected 'insert' => null
protected 'from' =>
object(JDatabaseQueryElement)[259]
protected 'name' => string 'FROM' (length=4)
protected 'elements' =>
array
0 => string '#__modules AS m' (length=15)
protected 'glue' => string ',' (length=1)
protected 'join' =>
array
0 =>
object(JDatabaseQueryElement)[260]
protected 'name' => string 'LEFT JOIN' (length=9)
protected 'elements' =>
array
0 => string '#__modules_menu AS mm ON mm.moduleid = m.id' (length=43)
protected 'glue' => string ',' (length=1)
1 =>
object(JDatabaseQueryElement)[262]
protected 'name' => string 'LEFT JOIN' (length=9)
protected 'elements' =>
array
0 => string '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id' (length=72)
protected 'glue' => string ',' (length=1)
protected 'set' => null
protected 'where' =>
object(JDatabaseQueryElement)[261]
protected 'name' => string 'WHERE' (length=5)
protected 'elements' =>
array
0 => string 'm.published = 1' (length=15)
1 => string 'e.enabled = 1' (length=13)
2 => string '(m.publish_up = '0000-00-00 00:00:00' OR m.publish_up <= '2013-10-07 14:10:50')' (length=79)
3 => string '(m.publish_down = '0000-00-00 00:00:00' OR m.publish_down >= '2013-10-07 14:10:50')' (length=83)
4 => string 'm.access IN (1,1)' (length=17)
5 => string 'm.client_id = 0' (length=15)
6 => string '(mm.menuid = 113 OR mm.menuid <= 0)' (length=35)
protected 'glue' => string ' AND ' (length=5)
protected 'group' => null
protected 'having' => null
protected 'columns' => null
protected 'values' => null
protected 'order' =>
object(JDatabaseQueryElement)[264]
protected 'name' => string 'ORDER BY' (length=8)
protected 'elements' =>
array
0 => string 'm.position, m.ordering' (length=22)
protected 'glue' => string ',' (length=1)
protected 'union' => null
protected 'autoIncrementField' => null
protected 'tablePrefix' => string 'joomla_' (length=7)
protected 'utf' => boolean true
protected 'errorNum' => int 0
protected 'errorMsg' => string '' (length=0)
protected 'hasQuoted' => boolean false
protected 'quoted' =>
array
empty
protected 'name' => string 'articles' (length=8)
protected 'option' => string 'com_content' (length=11)
protected 'state' =>
object(JObject)[279]
protected '_errors' =>
array
empty
public 'filter_fields.catid' => int 16
protected 'event_clean_cache' => string 'onContentCleanCache' (length=19)
protected '_errors' =>
array
empty
I changed my code to the following:
$model = JModelLegacy::getInstance('Articles', 'ContentModel');
$model->setState('filter.category_id', 16);
$articles = $model->getItems();
$num_articles = count($articles);
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.
It should be possible to read this attribute from the category model as in this question: How do I detect if a category has Include in Navigation Menu set to NO?
However $category->getIncludeInMenu() is returning NULL for all categories on my Magento EE 1.11 installation.
// Load child categories for a specific root category
$_uk_default_root_id = Mage::app()->getStore('uk_default')->getRootCategoryId();
$_uk_default_root_category = Mage::getModel('catalog/category')->load($_uk_default_root_id);
$_sub_categories = $_uk_default_root_category->getChildrenCategories();
// Loop through the categories
foreach ($_sub_categories as $_category)
{
if ($_category->getIsActive() && $_category->getIncludeInMenu())
{
<echo navigation link>
}
}
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?
Var dump of category object:
object(Mage_Catalog_Model_Category)[423]
protected '_eventPrefix' => string 'catalog_category' (length=16)
protected '_eventObject' => string 'category' (length=8)
protected '_cacheTag' => string 'catalog_category' (length=16)
protected '_useFlatResource' => boolean false
private '_designAttributes' =>
array (size=6)
0 => string 'custom_design' (length=13)
1 => string 'custom_design_from' (length=18)
2 => string 'custom_design_to' (length=16)
3 => string 'page_layout' (length=11)
4 => string 'custom_layout_update' (length=20)
5 => string 'custom_apply_to_products' (length=24)
protected '_treeModel' => null
protected '_defaultValues' =>
array (size=0)
empty
protected '_storeValuesFlags' =>
array (size=0)
empty
protected '_lockedAttributes' =>
array (size=0)
empty
protected '_isDeleteable' => boolean true
protected '_isReadonly' => boolean false
protected '_resourceName' => string 'catalog/category' (length=16)
protected '_resource' => null
protected '_resourceCollectionName' => string 'catalog/category_collection' (length=27)
protected '_dataSaveAllowed' => boolean true
protected '_isObjectNew' => null
protected '_data' =>
array (size=15)
'entity_id' => string '16' (length=2)
'entity_type_id' => string '3' (length=1)
'attribute_set_id' => string '3' (length=1)
'parent_id' => string '15' (length=2)
'created_at' => string '2011-11-16 12:16:27' (length=19)
'updated_at' => string '2011-12-19 16:19:08' (length=19)
'path' => string '1/15/16' (length=7)
'position' => string '1' (length=1)
'level' => string '2' (length=1)
'children_count' => string '8' (length=1)
'is_active' => string '1' (length=1)
'request_path' => null
'name' => string 'Vacuum Cleaners' (length=15)
'url_key' => string 'vacuum-cleaners' (length=15)
'is_anchor' => string '1' (length=1)
protected '_hasDataChanges' => boolean true
protected '_origData' =>
array (size=15)
'entity_id' => string '16' (length=2)
'entity_type_id' => string '3' (length=1)
'attribute_set_id' => string '3' (length=1)
'parent_id' => string '15' (length=2)
'created_at' => string '2011-11-16 12:16:27' (length=19)
'updated_at' => string '2011-12-19 16:19:08' (length=19)
'path' => string '1/15/16' (length=7)
'position' => string '1' (length=1)
'level' => string '2' (length=1)
'children_count' => string '8' (length=1)
'is_active' => string '1' (length=1)
'request_path' => null
'name' => string 'Vacuum Cleaners' (length=15)
'url_key' => string 'vacuum-cleaners' (length=15)
'is_anchor' => string '1' (length=1)
protected '_idFieldName' => string 'entity_id' (length=9)
protected '_isDeleted' => boolean false
protected '_oldFieldsMap' =>
array (size=0)
empty
protected '_syncFieldsMap' =>
array (size=0)
empty
This is due to Magento lazy loading the category model. The getChildrenCategories() method on the Mage_Catalog_Model_Category 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 include_in_menu attribute is stored in the EAV data store and has not been loaded.
Each category can be forced to load by calling $_category->load(); which will force Magento to load the additional EAV data for each category.
// Loop through the categories
foreach ($_sub_categories as $_category)
{
$_category->load();
if ($_category->getIsActive() && $_category->getIncludeInMenu())
{
<echo navigation link>
}
}
This changes the _data array from this:
array (size=15)
'entity_id' => string '16' (length=2)
'entity_type_id' => string '3' (length=1)
'attribute_set_id' => string '3' (length=1)
'parent_id' => string '15' (length=2)
'created_at' => string '2011-11-16 12:16:27' (length=19)
'updated_at' => string '2011-12-19 16:19:08' (length=19)
'path' => string '1/15/16' (length=7)
'position' => string '1' (length=1)
'level' => string '2' (length=1)
'children_count' => string '8' (length=1)
'is_active' => string '1' (length=1)
'request_path' => null
'name' => string 'Vacuum Cleaners' (length=15)
'url_key' => string 'vacuum-cleaners' (length=15)
'is_anchor' => string '1' (length=1)
To this:
array (size=33)
'entity_id' => string '16' (length=2)
'entity_type_id' => string '3' (length=1)
'attribute_set_id' => string '3' (length=1)
'parent_id' => string '15' (length=2)
'created_at' => string '2011-11-16 12:16:27' (length=19)
'updated_at' => string '2011-12-19 16:19:08' (length=19)
'path' => string '1/15/16' (length=7)
'position' => string '1' (length=1)
'level' => string '2' (length=1)
'children_count' => string '8' (length=1)
'is_active' => string '1' (length=1)
'request_path' => null
'name' => string 'Vacuum Cleaners' (length=15)
'url_key' => string 'vacuum-cleaners' (length=15)
'is_anchor' => string '1' (length=1)
'meta_title' => null
'display_mode' => string 'PRODUCTS' (length=8)
'custom_design' => null
'page_layout' => null
'url_path' => string 'vacuum-cleaners' (length=15)
'image' => string 'heading_vacuums_1.png' (length=21)
'include_in_menu' => string '1' (length=1)
'landing_page' => null
'custom_use_parent_settings' => string '0' (length=1)
'custom_apply_to_products' => string '0' (length=1)
'filter_price_range' => null
'description' => null
'meta_keywords' => null
'meta_description' => null
'custom_layout_update' => null
'available_sort_by' => null
'custom_design_from' => null
'custom_design_to' => null
Which includes the include_in_menu attribute.
You have to use:
$_category->load($_category->getId());
worked for me ;)