我在哪里可以看到 magento 的 template-path?

Where do I see the template-path of magento?

我想在 magento 中回应产品的描述/简短描述。

所以我的出发点是:

<h5><?php echo   $this->htmlEscape($_option->getTitle()) ?></h5>

标题与我相呼应,但如果我将 getTitle 编辑为 getDescription,它就完全没有与我相呼应。我需要做什么而不是?我在哪里可以获得可用 magento-functions 的列表,例如 short-description、long-description 等?

大多数 Magento 模型确实扩展了 Varien_Object

所以在你的情况下:

Zend_Debug::dump($_option->getData());

你会得到一个类似

的数组
array(2) {
  ["key"] => string(5) "value"
  ["other_key"] => string(11) "other_value"
}

从那里,很容易得到你想要的东西:如果键是 key 那么做 $_option->getKey() 如果键是 some_key 然后做 $_option->getSomeKey()

事实上,您只需在密钥前添加 get,然后删除下划线并将所有 "words" 大写。

array(1) {
  ["this_is_a_really_long_key_with_too_much_words_in_it"] => string(5) "value"
}
// this will be accessed by
$_option->getThisIsAReallyLongKeyWithTooMuchWordsInIt()

如果您对它的工作原理感到好奇,我建议您打开文件 lib/Varien/Object.php 并查看他们对函数的使用 __call