Magento:如何获得类别页面标题属性(元标题)作为html页面标题


Magento : How to get category page title attribute (meta title) as html page title

在我的需求中,我需要将类别页面标题属性设置为我的类别页面标题,但不幸的是,它没有按预期设置。。。

我尝试获取当前类别ID,然后将其加载到头文件中,以获取meta_title属性

$current_id=  Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
$catobj = Mage::getModel('catalog/category')->load($current_id);
print_r($catobj);
echo $catobj->getMetaTitle();

但是$catobj->getMetaTitle((给出的是类别名称,而不是类别页面标题:-(

我还尝试打印类别obj,并看到类别meta_title在那里

Mage_Catalog_Model_Category对象([_eventPrefix:protect]=>Catalog_Category[_eventObject:protect]]=>Category[_cacheTag:protect]=>Catalog_cotegory[_useFlatResource:protect]]=>[designAttributes:Mage_Catalog_Model_CateCategory:private]=>数组([0]=>custom_design[1]=>custom_sign_from[2]=>custom_ign_to[3]=>page_layout[4]=>custom_layout_update[5]=>custom_apply_to_products([_treeModel:protect]=>[_defaultValues:protected]=>阵列([meta_title]=>HP喷墨打印机墨盒|Trendsetter[name]=>HP墨盒[url_key]=>HP喷墨[url_path]=>打印机耗材/HP/HP喷墨[is_active]=>1[available_sort_by]=>([_storeValuesFlags:protected]=>阵列([meta_title]=>1[name]=>1[url_key]=>1[url_path]=>1[is_active]=>1[available_sort_by]=>1([_lockedAttributes:protected]=>Array[entity_type_id]=>3[attribute_set_id]=>3[pparent_id]=>259[created_at]=>2012-12-11 13:00:28[updated_at]=>2013-02-26 12:08:33[path]=>1/13/520/259/261[position]=>248[level]=>2[children_count]=>0[name]=>HP喷墨打印机[display_mode]=>产品[meta_title]=>惠普喷墨打印机[url_key]=>HP喷墨打印机[url路径]=>打印机耗材/HP/HP喷墨打印机[custom_design]=>[page_l布局]=>[is_active]=>1[is_anchor]=>0[include_in_menu]=>1[landing_page]=>[custom_use_parent_settings]=>0[custom_apply_to_products]=>0[available_sort_by]=>[description]=>[meta_keywords]=>HP喷墨打印机墨盒[metaDescription]=>价格极低的高品质HP打印机墨水和墨盒。[custom_layout_update]=>[custom_design_from]=>[custom_design_to]=>[filter_price_range]=>([_hasDataChanges:protected]=>[_origData:pprotected]>>数组([entity_id]=>261[entity_type_id]=>3[attribute_set_id]=>3[pparent_id]=>259[created_at]=>2012-12-11 13:00:28[updated_at]>>2013-02-26 12:08:33[path]=>1/13/520/259/261[position]=>248[level=>2[children _count]=>0[name]=>HP喷墨[display_mode]=>产品[meta_title]=>HP喷墨[url_key]=>HP墨水[url_path]=>打印机耗材/HP/HP喷墨[custom_design]=>[page_layout]=>[is_active]=>1[is_anchor]=>0[include_in_menu]=>1[landing_page]=>[custom_use_parent_settings]=>0[custom_apply_to_PRODUCTS]=>0[available_sort_by]=>[description]=>[meta_keywords]=>HP喷绘打印机墨盒[meta_description]=>价格极低的高品质HP打印机墨水和墨盒。[custom_layout_update]=>[custom_design_from]=>[custom_design_to]=>[filter_price_range]=>([idFieldName:protected]=>entity_id[_isDeleted:protected]=>[_oldFieldsMap:pprotected]==>Array(([_syncFieldsMap:protected]=]Array(((


并尝试

echo $catobj->meta_title;


但这也给出了相同的类别名称:-(请帮忙。

我已经调试类别obj

print_r($catobj->debug());

但这表明meta_title和name是一样的,但它不是,它不同。。真烦人的

数组([entity_id]=>261[entity_type_id]=>3[attribute_set_id]=>3[pparent_id]=>259[created_at]=>2012-12-11 13:00:28[updated_at]=]2013-02-26 12:08:33[path]=>1/13/520/259/261[position]=>248[level]=>2[children_count]=>0[name]=>HP喷墨[display_mode]=>PRODUCTS[meta_title]=>HP喷墨[url_key]=>HP墨水[url_path]=>打印机耗材/hp/hp喷墨[is_active]=>1[is_anchor]=>0[include_in_menu]=>1[custom_use_parent_settings]=>0[custom_apply_to_products]=>0[meta_keywords]=>hp喷墨打印机墨盒[metadescription]=>价格极低的高质量hp打印机墨盒。(HP喷墨

$catgId=类别ID

$catSel = Mage::getModel('catalog/category')->load($catgId); 
            $catDesc = array(
            'id' => $catgId,
            'desc' => $catSel->getDescription(),
            'url-key' => $catSel->getUrl_key(),
            'title' => $catSel->getMetaTitle()
        );

在互联网上搜索后,我找到了解决我的问题的方法,商店组错了。感谢