在Magento 1.8的结帐页面上找到国家/地区的选择html标记的位置

时间:2014-05-12 22:33:12

标签: magento magento-1.8

我可以在结帐页面的哪些国家/地区使用html 选择标记?

<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>

使用此$this->getCountryHtmlSelect('billing'),它会返回下面的html选择标记,

<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>
...

但我需要select标记中添加一个类名

class="form-control validate-select"

但我在哪里可以找到此select代码?

1 个答案:

答案 0 :(得分:2)

要在select中添加新类,您需要在以下步骤中进行操作:

步骤:复制app\code\core\Mage\Checkout\Block\Onepage\Abstract.php      到app\code\local\Mage\Checkout\Block\Onepage\Abstract.php

您可以在这里找到函数getCountryHtmlSelect($type)

    $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)

更改为,我添加了新课程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)
}