我可以在结帐页面的哪些国家/地区使用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
代码?
答案 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)
}