因为magento的表单的一般都是动态生成的,所以改起来很麻烦,我们需要做的一般就只能截断循环体中加判断

,比如我修改了一个文本框的js就必须要截取循环.代码如下.

<?php $_option = $this->getOption(); ?><dt  <?php  if(in_array($_option->getTitle(),array('Bust','Hips','Waist','Height','Hollow to Floor'))){echo 'style= "padding: 0;width: 200px;" ';}?>><label<?php if ($_option->getIsRequire()) echo ' class="required"' ?><?php if($_option->getTitle()=='Add remark'){echo '  style="margin-top: 20px;"';echo 'value="aaaa"';}?>><?php if ($_option->getIsRequire()) echo '<em>*</em>' ?><?php echo  $this->htmlEscape($_option->getTitle()) ;if(in_array($_option->getTitle(),array('Bust','Hips','Waist','Height','Hollow to Floor'))){echo "  (Inch) ";}?> :</label>    <?php echo $this->getFormatedPrice() ?></dt><dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>    <div class="input-box">    <?php if ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD): ?>        <input type="text" onchange="opConfig.reloadPrice()" id="options_<?php echo $_option->getId() ?>_text" class="input-text<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" value="<?php echo $this->escapeHtml($this->getDefaultValue()) ?>" />    <?php elseif ($_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA): ?>        <textarea  id="options_<?php echo $_option->getId() ?>_text" onchange="opConfig.reloadPrice()" class="<?php echo $_option->getIsRequire() ? ' required-entry' : '' ?> <?php echo $_option->getMaxCharacters() ? ' validate-length maximum-length-'.$_option->getMaxCharacters() : '' ?> product-custom-option" name="options[<?php echo $_option->getId() ?>]" rows="5" cols="25" <?php if($_option->getTitle()=='Add remark'){echo " onfocus=\"this.value=='Please feel free to leave us a message about your special request on this item, e.g: Color for the accent part, Modification of Style, and so on.'?this.value='':this.value\" onblur=\"this.value.replace(' ')==''?this.value='Please feel free to leave us a message about your special request on this item, e.g: Color for the accent part, Modification of Style, and so on.':''\"";}?>><?php echo $this->escapeHtml($this->getDefaultValue()) ?><?php if($_option->getTitle()=='Add remark'){echo 'Please feel free to leave us a message about your special request on this item, e.g: Color for the accent part, Modification of Style, and so on.';}?></textarea>    <?php endif; ?>    <?php if ($_option->getMaxCharacters()): ?>        <p class="note"><?php echo Mage::helper('catalog')->__('Maximum number of characters:')?> <strong><?php echo $_option->getMaxCharacters() ?></strong></p>    <?php endif; ?>    </div></dd>

其他的类似,一般这些模板文件在/iption/type 目录下 对应,搞定完工.