我在 Magento 的一家商店下拥有某些产品的批发属性。我想设置它,以便那些特定属性仅在客户登录并且他们在 Wholesale 客户组中时出现在产品页面上。
这可能吗?
我在 Magento 的一家商店下拥有某些产品的批发属性。我想设置它,以便那些特定属性仅在客户登录并且他们在 Wholesale 客户组中时出现在产品页面上。
这可能吗?
像这样的东西应该可以工作,尽管我没有一起测试过。假设您的批发 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 提供了正确方向的初始指针!
我有相同的用例,我使用了GroupsCatalog扩展,它是免费的,非常适合我。