如何在 Magento 中获得“原始”类别名称,我已经为当前商店 View 翻译了类别名称。我想获得在所有商店 View 中输入的类别名称,因为我想将原始(英文)名称发送到 GA 进行跟踪 - 我在类别页面上时需要这个。
我可以通过这种方式获取本地化类别名称:
<?php
$currentCategory = Mage::registry('current_category');
$name = $currentCategory->getName();
?>
但无法在不额外调用数据库的情况下找到未翻译名称的方法。
最佳答案
如上所述,这将需要额外的数据库请求。以下应该有效:
$defaultStoreCategory = Mage::getModel('catalog/category');
$defaultStoreCategory->setStoreId(Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID);
$defaultStoreCategory->load($currentCategory->getId());
$name = $defaultStoreCategory->getName();
关于php - 如何在 Magento 中获取原始(所有商店 View )当前类别名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14559255/