我已经修改了层级定价的 magento 扩展,并在 app->design->adminhtml->default->default->catalog->product->edit->price->tier.phtml 文件中添加了三个文本字段。来自三个新字段的数据已成功插入表 catalog_product_entity_tier_price。数据在前端也是可见的。但问题是在层框价格中插入的数据和字段不匹配
<table>
<thead>
<tr class="headings">
<th>Website</th>
<th>Customer Group</th>
<th>Qty</th>
<th>Custom_field_1</th>
<th>Custom_field_2</th>
<th>Price</th>
<th>Custom_field_3</th>
<th>Action</th>
</thead>
</tr>
<tr>
<td>Showing Correct</td>
<td>Showing Correct</td>
<td>Showing Correct</td>
<td>Showing Custom_field_2</td>
<td>Showing Custom_field_3</td>
<td>Showing Correct</td>
<td>undefined</td>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
<b>And javascript code is</b>
<script type="text/javascript">
var tierPriceRowTemplate = '<tr>'
+ ' <small class="nobr"><?php echo Mage::helper("catalog")->__("and above")?></small></td>'
+ '<td><input class="<?php echo $_htmlClass ?> Custom_field_1" type="text" name="<?php echo $_htmlName ?>[{{index}}][Custom_field_1]" value="{{Custom_field_1}}"
id="tier_price_row_{{index}}_Custom_field_1" /></td>'
+ '<td><input class="<?php echo $_htmlClass ?> Custom_field_2" type="text" name="<?php echo $_htmlName ?>[{{index}}][Custom_field_2]" value="{{Custom_field_2}}" id="tier_price_row_{{index}}_Custom_field_2" /></td>'
+ '<td><input class="<?php echo $_htmlClass ?> required-entry <?php echo $_priceValueValidation ?>" type="text" name="<?php echo $_htmlName ?>[{{index}}][price]" value="{{price}}" id="tier_price_row_{{index}}_price" /></td>'
+ '<td><input class="<?php echo $_htmlClass ?> Custom_field_3" type="text" name="<?php echo $_htmlName ?>[{{index}}][Custom_field_3]" value="{{Custom_field_3}}" id="tier_price_row_{{index}}_Custom_field_3"/></td>';
var data = {
website_id: '<?php echo $this->getDefaultWebsite() ?>',
group: '<?php echo $this->getDefaultCustomerGroup() ?>',
qty: '',
Custom_field_1:'',
price: '',
Custom_field_2:'',
Custom_field_3:'',
readOnly: false,
index: this.itemsCount++
};
//alert(Custom_field_1);
if(arguments.length >= 4) {
data.Custom_field_1 = arguments[4]
data.readOnly = arguments[5];
data.Custom_field_2 = arguments[7];
data.Custom_field_3 = arguments[8];
}
if (arguments.length == 5) {
data.readOnly = arguments[4];
}
$('tier_price_row_' + data.index + '_Custom_field_1').value = data.Custom_field_1;
$('tier_price_row_' + data.index + '_Custom_field_2').value = data.Custom_field_2;
$('tier_price_row_' + data.index + '_Custom_field_3').value = data.Custom_field_3;
</script>