2

In Magento Admin System->Configuration->General->Countries options default country is --Please Select-- but In frontend it's null. Check the attached image. In billing.phtml templates echo $this->getCountryHtmlSelect('billing'); is showing list of all countries fine from admin but when by default it's showing blank if '--Please Select--' is selected.

Why it is showing blank tab instead of '--Please Select--' ? How I can show all counties with '--Please Select--' selected by default?

enter image description here

1 Answer 1

1

I've got it working using following code in billing.phtml

<?php $_countries = Mage::getResourceModel('directory/country_collection')
                                    ->loadData()
                                    ->toOptionArray(false) ?>
<?php if (count($_countries) > 0): ?>
    <select name="country" id="country">
        <option value="">-- Please Select --</option>
        <?php foreach($_countries as $_country): ?>
            <option value="<?php echo $_country['value'] ?>">
                <?php echo $_country['label'] ?>
            </option>
        <?php endforeach; ?>
    </select>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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