Where to find the select html tag for countries on the checkout page in Magento 1.8

StackOverflow https://stackoverflow.com/questions/23620021

  •  21-07-2023
  •  | 
  •  

문제

Where can I the html select tag for countries on the checkout page?

<div class="field form-group">
       <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
       <div class="input-box">
          <?php echo $this->getCountryHtmlSelect('billing') ?>
       </div>
</div>

with this $this->getCountryHtmlSelect('billing'), it returns the html select tag below,

<select name="billing[country_id]" id="billing:country_id" class="validate-select" title="Country" >
<option value="" > </option>
<option value="AF" >Afghanistan</option><option value="AL" >Albania</option>
<option value="DZ" >Algeria</option>
...

But I need to add a class name to the select tag,

class="form-control validate-select"

But where can I find this select tag?

도움이 되었습니까?

해결책

For add new class in select ...you need to flow below steps:

Step:copy app\code\core\Mage\Checkout\Block\Onepage\Abstract.php to app\code\local\Mage\Checkout\Block\Onepage\Abstract.php

Here you have find the function getCountryHtmlSelect($type)

COde

    $select = $this->getLayout()->createBlock('core/html_select')
                ->setName($type.'[country_id]')
                ->setId($type.':country_id')
                ->setTitle(Mage::helper('checkout')->__('Country'))
                ->setClass('validate-select')
        ->setValue($countryId)

Change to and i have added a new class mynewclass..

if($type=='billing')
{
$select = $this->getLayout()->createBlock('core/html_select')
            ->setName($type.'[country_id]')
            ->setId($type.':country_id')
            ->setTitle(Mage::helper('checkout')->__('Country'))
            ->setClass('validate-select mynewclass')
            ->setValue($countryId)
}else{
$select = $this->getLayout()->createBlock('core/html_select')
            ->setName($type.'[country_id]')
            ->setId($type.':country_id')
            ->setTitle(Mage::helper('checkout')->__('Country'))
            ->setClass('validate-select')
            ->setValue($countryId)
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top