Magento有一個產品和類別的字段來創建定製的SEO友好的URL密鑰。 但是,如果您有多個商店,則通常不會爲不同的商店使用不同的網址鍵 ,因爲字段url_key默認爲'GLOBAL'。對於產品, ,您可以將url_key屬性的is_default字段更新爲屬性 管理中的「存儲視圖」。但對於該類別的url_key字段,您在Magento中沒有該選項。 但字段不存在具有相同屬性的代碼數據庫,但具有不同 backend_model所以你需要直接進入數據庫,1比0。Magento 1.7 SEO友好的URL和多商店視圖
參考更改「is_global」字段:http://www.devraju.com/magento/different-category-url-keys-for-different-store-views-in-magento/ 看評論上頁面的底部。
這一戰略似乎在舊版本的工作,但在7.1我有麻煩。當我轉到目錄>>屬性>>管理屬性時,url_key屬性已經設置爲存儲視圖。見下圖。
此外屬性表看起來正確配置。請參閱下面的SQL。
的交換代碼如下所示:
<?php if(count($this->getStores())>1): ?>
<div class="form-language">
<label for="select-language"><?php echo $this->__('Your Language:') ?></label>
<select id="select-language" title="<?php echo $this->__('Your Language') ?>" onchange="window.location.href=this.value">
<?php foreach ($this->getStores() as $_lang): ?>
<?php $_selected = ($_lang->getId() == $this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
<option value="<?php echo $_lang->getCurrentUrl() ?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($_lang->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>
SQLS
SELECT * FROM eav_attribute WHERE attribute_code LIKE '%url_key%';
attribute_id Attribute Id entity_type_id Entity Type Id attribute_code Attribute
Edit Delete 43 3 url_key catalog/category_attribute_backend_urlkey
Edit Delete 97 4 url_key catalog/product_attribute_backend_urlkey
SELECT attribute_id, is_global FROM catalog_eav_attribute WHERE attribute_id=43;
SELECT attribute_id, is_global FROM catalog_eav_attribute WHERE attribute_id=97;
Full Texts attribute_id Attribute ID is_global Is Global
Edit Delete 43 0
Full Texts attribute_id Attribute ID is_global Is Global
Edit Delete 97 0
我也嘗試使用重寫規則來解決這個問題,但經過重新編寫規則似乎並不涵蓋語言切換。 ref:http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index
我正在尋找適當的代碼修改解決方案。
作品以及在香草Magento的1.7.0.2 ...所以它就在你結束的東西...你改變url_key存儲視圖級別後運行重新索引? – FlorinelChis