0

How can I add additional customer group IDs in the code below? For example, add 8 and 9.

<?php if (Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getSingleton('customer/session')->getCustomerGroupId() == "6") :?>
   <style>
      .wpu {display:none}
   </style>
<?php endif;?>

Thank you

3

Add them to an array, and use the PHP function in_array:

<?php

$customerSession = Mage::getSingleton('customer/session');
$hideGroupIds = array(6, 8, 9);

if ($customerSession->isLoggedIn() && in_array($customerSession->getCustomerGroupId(), $hideGroupIds)) : ?>
<style>
.wpu {display:none}
</style>
<?php endif;?>
1
<?php $ids = array(generalGroup=>'6', specialGroup=>'8', customGroup=>'9'); ?>

<?php if (array_search(Mage::getSingleton('customer/session')->getCustomerGroupId(), $ids)) : ?>
      <style>.wpu {display:none}</style>
<?php endif;?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.