Magento の 1 つのストアの下に、特定の製品の卸売属性があります。顧客がログインしていて、卸売顧客グループに属している場合にのみ、これらの特定の属性が製品ページに表示されるように設定したいと思います。
これは可能ですか?
Magento の 1 つのストアの下に、特定の製品の卸売属性があります。顧客がログインしていて、卸売顧客グループに属している場合にのみ、これらの特定の属性が製品ページに表示されるように設定したいと思います。
これは可能ですか?
私はこれを一緒にテストしていませんが、このようなものはうまくいくはずです。卸売 groupid = 2 で、商品属性「productvideos」を表示したいとします。
アプリ/デザイン/フロントエンド/デフォルト//テンプレート/カタログ/製品/view.phtml
if($_isLoggedIn === true){
$_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
if($_myGroupId == 2){
print $_helper->productAttribute($_product, $_product->getProductvideos(), 'productvideos');
}
}
クレジット: http://www.magentocommerce.com/boards/viewthread/22597/#t74992
さて、これが解決策です。
template/catalog/product/view> attributes.phtml で、次を使用します。
<?php
$_isLoggedIn = $this->helper('customer')->isLoggedIn();
if($_isLoggedIn == true){
$_myGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
if($_myGroupId == 2){
echo '<td class="label">Attribute Name/Label</td>';
echo '<td class="label">';
if ($_product->getResource()->getAttribute('attribute_id')->getFrontend()->getValue($_product)):
echo $_product->getResource()->getAttribute('attribute_id')->getFrontend()->getValue($_product);
endif;
echo '</td>';
}
}
?>
正しい方向への最初のポインターを提供してくれた @nvoyageur に感謝します。