I found that sku
is not being displayed in product listing nor product view page. I checked and found that the template is checking whether to display the attribute by using:
$_product->getResource()->getAttribute('sku')->getUsedInProductListing()
Which results with null
for sku
but not for, lets say, description
. I found out that more attributes have very short list of options (name
also has this problem).
I have dumped the $_data
in Varien_Object
and for sku
it is suprisingly short:
array (
'attribute_id' => '68',
'entity_type_id' => '4',
'attribute_code' => 'sku',
'attribute_model' => 'catalog/resource_eav_attribute',
'backend_model' => 'catalog/product_attribute_backend_sku',
'backend_type' => 'static',
'backend_table' => NULL,
'frontend_model' => NULL,
'frontend_input' => 'text',
'frontend_label' => 'SKU',
'frontend_class' => NULL,
'source_model' => NULL,
'is_required' => '1',
'is_user_defined' => '0',
'default_value' => NULL,
'is_unique' => '1',
'note' => NULL,
'store_label' => 'Product code',
)
However, the same dump for description
attribute has much more options:
array (
'attribute_id' => '66',
'entity_type_id' => '4',
'attribute_code' => 'description',
'attribute_model' => 'catalog/resource_eav_attribute',
'backend_model' => NULL,
'backend_type' => 'text',
'backend_table' => NULL,
'frontend_model' => NULL,
'frontend_input' => 'textarea',
'frontend_label' => 'Description',
'frontend_class' => NULL,
'source_model' => NULL,
'is_required' => '0',
'is_user_defined' => '0',
'default_value' => NULL,
'is_unique' => '0',
'note' => NULL,
'frontend_input_renderer' => NULL,
'is_global' => '0',
'is_visible' => '1',
'is_searchable' => '1',
'is_filterable' => '0',
'is_comparable' => '1',
'is_visible_on_front' => '0',
'is_html_allowed_on_front' => '1',
'is_used_for_price_rules' => '0',
'is_filterable_in_search' => '0',
'used_in_product_listing' => '0',
'used_for_sort_by' => '0',
'is_configurable' => '1',
'apply_to' => NULL,
'is_visible_in_advanced_search' => '0',
'position' => '0',
'is_wysiwyg_enabled' => '1',
'is_used_for_promo_rules' => '0',
'entity_type' =>
Mage_Eav_Model_Entity_Type::__set_state(array(
'_attributes' => NULL,
'_attributesBySet' =>
array (
),
'_sets' => NULL,
'_eventPrefix' => 'core_abstract',
'_eventObject' => 'object',
'_resourceName' => 'eav/entity_type',
'_resource' => NULL,
'_resourceCollectionName' => 'eav/entity_type_collection',
'_cacheTag' => false,
'_dataSaveAllowed' => true,
'_isObjectNew' => NULL,
'_data' =>
array (
'entity_type_id' => '4',
'entity_type_code' => 'catalog_product',
'entity_model' => 'catalog/product',
'attribute_model' => 'catalog/resource_eav_attribute',
'entity_table' => 'catalog/product',
'value_table_prefix' => NULL,
'entity_id_field' => NULL,
'is_data_sharing' => '1',
'data_sharing_key' => 'default',
'default_attribute_set_id' => '4',
'increment_model' => NULL,
'increment_per_store' => '0',
'increment_pad_length' => '8',
'increment_pad_char' => '0',
'additional_attribute_table' => 'catalog/eav_attribute',
'entity_attribute_collection' => 'catalog/product_attribute_collection',
),
'_hasDataChanges' => true,
'_origData' => NULL,
'_idFieldName' => 'entity_type_id',
'_isDeleted' => false,
'_oldFieldsMap' =>
array (
),
'_syncFieldsMap' =>
array (
),
)),
)
Any ideas why this happens? I am using Magento 1.9.1.0
getUsedInProductListing()
returnsnull
because such option of attributesku
doesn't even exist in$_data
for some reason. But yes, everything is set to 'YES' insku
attribute and the list of options in$_data
is still shorter than in any other attribute.null
. Take a closer look at the variable dumps in my post - it clearly means thatsku
is missing some options that other attributes normally have.