I am using magento 1.9 version. I need to display customer groups in dropdown option.

I used this code.

It brings the data as dropdown.

My issue is When i use this code some css issues occurs.

By commenting the collection data (ie., line# 4 to line #6) it's working fine.

what is the issue here.


try below code

<select class=" input-text custgroup required-entry" name="product[tier_price][<?php echo $i; ?>][cust_group]" id="tier_price_row_<?php echo $i;?>_cust_group">
        <option value=''>Select Customer Group</option>
        <option <?php if($tierPrice['cust_group']=='32000') echo 'selected = "selected"';?> value='32000'>ALL GROUPS</option>

         $customer = Mage::getModel('customer/group')->getCollection();
        foreach($customer as $type) :?>
        <option <?php if($tierPrice['cust_group'] == $type['customer_group_id']) {echo 'selected = selected"';}?> value="<?php echo $type->getCustomerGroupId();?>">
        <?php echo $type['customer_group_code']; ?>
        <?php endforeach; ?>

  • No luck. Same result. I think the issue in foreach only. – Saravanan DS May 19 '17 at 7:55

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.