Magento meta keywords field name inconsistent

I don’t know whether Magento did this on purpose. Both of category page and product page have a meta keywords attribute. Because meta keywords attribute of category or product belongs to EAV system, it has two entries in eav_attribute table, one for catalog_category (entity_type_id = 3) and one for catalog_product (entity_type_id = 4). However, if you look closely at attribute_code, you will find –

  • for category, the code is meta_keywords
  • for product, the code is meta_keyword

The cms_page also has meta keywords, but it does not belongs to EAV system. The field name is meta_keywords.

In summary, you won’t retrieve any meta keywords of a product if you write code like this:

Mage::getModel('catalog/product')->load($productId)->getData('meta_keywords');

Leave a comment

Your email address will not be published. Required fields are marked *