私の要件では、カテゴリページのタイトル属性をカテゴリページのタイトルとして設定する必要がありますが、不幸なことに、期待どおりに設定されていません。magentowikiを確認しました...
現在のカテゴリ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があります
[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] =>)[_hasDataChanges:protected] => [_origData:protected] => Array([entity_id] => 261 [entity_type_id] => 3 [ attribute_set_id] => 3 [parent_id] => 259 [created_at] => 2012-12-11 13:00:28 [updated_at] => 2013-02-26 12:08:33 [path] => 1/13 / 520/259/261[位置]=>248[レベル]=>2 [children_count] =>0[名前]=>HPインクジェット[display_mode]=> 製品[meta_title]=>HPインクジェット[url_key]=>hp-inkjets [url_path] => printer-consumables / hp / hp-inkjets [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:protected] => Array()[_syncFieldsMap:protected ] =>配列())printer-consumables / hp / hp-inkjets [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:protected] => Array()[_syncFieldsMap:protected ] =>配列())printer-consumables / hp / hp-inkjets [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:protected] => Array()[_syncFieldsMap:protected ] =>配列())[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:protected] => Array()[_syncFieldsMap:protected ] =>配列())[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:protected] => Array()[_syncFieldsMap:protected ] =>配列())
試してみました
echo $catobj->meta_title;
しかし、これも同じカテゴリ名を与えます:-(これを手伝ってください。
カテゴリobjをデバッグしました
print_r($catobj->debug());
しかし、これはmeta_titleが名前と同じであることを示していますが、そうではなく、異なっています..本当に迷惑です
配列([entity_id] => 261 [entity_type_id] => 3 [attribute_set_id] => 3 [parent_id] => 259 [created_at] => 2012-12-11 13:00:28 [updated_at] => 2013-02- 2612:08:33[パス]=>1/13/520/259/261[位置]=>248[レベル]=>2 [children_count] =>0[名前]=>HPインクジェット[display_mode]=>製品[meta_title]=>HPインクジェット[url_key]=>hp-inkjets [url_path] => printer-consumables / hp / hp-inkjets [is_active] => 1 [is_anchor] => 0 [include_in_menu] => 1 [custom_use_parent_settings ] => 0 [custom_apply_to_products] => 0 [meta_keywords] =>HPインクジェットプリンターカートリッジ[meta_description]=>高品質のHPプリンターインクとカートリッジを非常に低価格で提供します。)HPインクジェット