2012-02-11 75 views
2

我想更新產生在Magento 1.5的谷歌地圖的模板。Magento - 我在哪裏編輯輸出站點地圖的文件?

原因是,Magento使用的是URLKey(例如/my-jacket.html),而不是完整的URL與類別(例如/outerwear/jackets/my-jacket.html)。

我在網站上的其他地方這樣做(一個.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()