2012-02-11 1 views
2

Magento 1.5でGoogleサイトマップを生成するテンプレートを更新したいと思います。Magento - サイトマップを出力するファイルを編集する場所はどこですか?

MagentoはURLKey(例:/my-jacket.html)を使用していますが、カテゴリ(例:/outerwear/jackets/my-jacket.html)の完全なURLは使用していません。

私はサイトの別の場所(.htmlサイトマップ)でこれをやっていますし、うまくいきます。カテゴリ内の製品をループするとき...

// get the categories for this product 
$_categories = Mage::getModel('catalog/product')->load($product_id)->getCategoryIds();                    
$_category = Mage::getModel('catalog/category')->load($_categories[0]); 

// build the URL path 
$url = Mage::getUrl($_category->getUrlPath()).basename($_product->getUrlKey());  

// only problem is this will be /category/category2.html/my-jacket.html 
// so strip the .html and put it on the end 
$url = str_replace(".html","" ,$url) . '.html'; 

醜いですが動作します。とにかく、私は生成されるGoogleのサイトマップに同じをしたいが、それがどこで生成された多くの検索後、私はそれを見つけることができません。誰でも正しい方向に向いていますか?

答えて

4

私はかなり簡単に編集するためのテンプレートがないと確信しています。 XML生成は、モデル内で行われます。具体的には、Mage_Sitemap_Model_Sitemap::generateXml()です。

関連する問題