Magento产品详细信息 - 用户登录+客户组限制?

问题描述:

在我的Magento产品页面上,我有一个选项卡式系统来显示描述,功能和另一个选项卡,称为下载 - 这需要在特定组中登录客户时可见。Magento产品详细信息 - 用户登录+客户组限制?

在我的布局XML来的catalog.xml我有这样的:

​​3210

但是 - 即使我登录的任何组中的客户框没有显示,因此从那里取出<customer_logged_in>显示标签+框。

所以我需要知道:

  1. 为什么这个不显示时,即时通讯登录?
  2. 我可以在登录时进行此演出 - 但仅限于特定的客户群组吗?

我想也许你可以使用<customer_logged_in setCustomerGroupId="2">或类似的东西!

谢谢。

别担心,我现在已经通过一个.phtml模板文件排序,下面的代码为别人:

$_allowed_group_ids = array(1); // Stick in Allowed Customer Group ID's 
$_product_collateral = array(); // We will store the tabbed content in our own array 
$_restricted_tabs = array('downloads'); 

foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html) { 

    $_product_collateral[$alias] = $html; 

    if(in_array($alias, $_restricted_tabs)):    

     if(Mage::getSingleton('customer/session')->isLoggedIn()): 

      $_group_id = Mage::getSingleton('customer/session')->getCustomerGroupId(); 

      if(!in_array($_group_id, $_allowed_group_ids)):       
       unset($_product_collateral[$alias]); 
       continue; 
      endif; 
     else: 
      unset($_product_collateral[$alias]); 
      continue;       
     endif;  

    endif;                  
} 

实例应用:

<ul> 
    <?php foreach($_product_collateral as $alias => $html): ?> 
    <li><a href="#tab-<?php echo strtolower($alias); ?>"><?php echo ucfirst($alias); ?></a></li> 
    <?php endforeach; ?>  
</ul> 

使用示例对包装内容:

<?php foreach($_product_collateral as $alias => $html): ?>    
<div class="box-collateral <?php echo "box-{$alias}"?>" id="tab-<?php echo strtolower($alias); ?>"> 
    <?php echo $html; ?> 
</div> 
<?php endforeach;?> 

您可以使用客户登录重定向magento扩展。它会解决你的问题。

+0

你真的看过我的问题吗?我不想要任何重定向....只是想隐藏一个标签,如果用户没有登录,而不是正确的客户群。 – 2012-07-25 11:29:56

+0

如果客户登录,则可以在产品的view.phtml文件中使用登录条件,否则显示这些内容 – Mufaddal 2012-07-25 11:31:35