1

Magento カテゴリ ページにAsosスタイルのヘッダーを作成しようとしています。

このボックスでは、カテゴリのタイトルとカテゴリの説明を取り込みました。階層化されたナビゲーションから特定の属性をカテゴリの view.phtml ページに取り込む必要もあります。

現時点で私が持っている

<?php $prod = Mage::getModel('catalog/product')->load($productId); $att = $prod->getResource()->getAttribute('product')->getFrontend()->getValue($prod); echo $att; ?>

ただしNo、この特定のカテゴリの階層化されたナビゲーションに表示されている属性ではなく、単語を引き込んでいるだけです。

4

3 に答える 3

0

これを試して:

Mage::getResourceModel('catalog/product')->getAttributeRawValue($productId, 'attribute_code', $storeId);

ここで元の回答を提供してくれた@Daniel Kochergaに感謝します。

于 2012-08-22T14:35:02.030 に答える
0

code/core/mage/catalog/block/product/view/attributes.php より

   public function getAdditionalData(array $excludeAttr = array())
    {
        $data = array();
        $product = $this->getProduct();
        $attributes = $product->getAttributes();
        foreach ($attributes as $attribute) {
//            if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
            if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), $excludeAttr)) {
                $value = $attribute->getFrontend()->getValue($product);

                if (!$product->hasData($attribute->getAttributeCode())) {
                    $value = Mage::helper('catalog')->__('N/A');
                } elseif ((string)$value == '') {
                    $value = Mage::helper('catalog')->__('No');
                } elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
                    $value = Mage::app()->getStore()->convertPrice($value, true);
                }

                if (is_string($value) && strlen($value)) {
                    $data[$attribute->getAttributeCode()] = array(
                        'label' => $attribute->getStoreLabel(),
                        'value' => $value,
                        'code'  => $attribute->getAttributeCode()
                    );
                }
            }
        }
        return $data;
    }
}

これが、属性とともに「いいえ」または「N/A」を表示する責任のあるセクションであることを確認してください。

于 2014-10-28T20:16:39.450 に答える
-1

よくわかりませんが、以下のURLを参照してください。お手伝いいっぱいだと思います。

カテゴリの製品グリッドに属性を追加する方法

http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/add-attributes-to-product-grid

Magento 属性: カテゴリごとに異なるフィルター可能な属性を使用する

http://www.human-element.com/Blog/ArticleDetailsPage/tabid/91/ArticleID/68/Magento-Attributes-Using-Different-Filterable-Attributes-Per-Category.aspx

製品ページの Magento カテゴリ属性のデータを取得する

http://spenserbaldwin.com/magento/get-data-for-new-magento-category-attribute

于 2012-08-28T05:48:23.293 に答える