基于客户组(Magento)显示自定义产品属性
我在Magento的一家商店中拥有某些产品的批发属性。我想将其设置为仅当客户已登录且处于批发客户组中时,这些特定属性才会显示在产品页面上基于客户组(Magento)显示自定义产品属性,magento,store,custom-attributes,Magento,Store,Custom Attributes,我在Magento的一家商店中拥有某些产品的批发属性。我想将其设置为仅当客户已登录且处于批发客户组中时,这些特定属性才会显示在产品页面上 这可能吗?类似的东西应该可以工作,尽管我没有一起测试过。假设批发组ID=2,并且您希望显示产品属性“productvideos” app/design/frontend/default//template/catalog/product/view.phtml 学分: 好的,这是解决方案 在template/catalog/product/view>attrib
这可能吗?类似的东西应该可以工作,尽管我没有一起测试过。假设批发组ID=2,并且您希望显示产品属性“productvideos” app/design/frontend/default//template/catalog/product/view.phtml 学分:
好的,这是解决方案 在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为我们提供了正确方向的初始指针 我有相同的用例,我使用了扩展,它是免费的,非常适合我。不幸的是,这似乎不起作用。这是我得到的最新代码:我还编辑了Mage>Catalog>Model>Product.php以包含一个函数,但它返回了一个错误。很高兴为您服务。。。感谢您发布一个真正有效的最终解决方案。链接重定向到Magento Commerce主页。我明白了!要么是延期已经中止,要么是延期。
<?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>';
}
}
?>