单击“编辑”按钮后应可见更新按钮
-
13-12-2019 - |
题
我们使用的是这个“image 1”的follwing代码显示: http://prntscr.com/8w7f5v :
<td>
<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?>
<input type = "text" id = "qty_<?php echo $products->getId(); ?>" name = "qty" value = "<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?>" style = "display:none"/>
<span class = "label wk_action">
<img onclick = "updateField('<?php echo $products->getId(); ?>'); "
src = "<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
</span>
<br/>
<button class="button wk_mp_btn1" title="<?php echo $helper->__('Save') ?>" type="submit" id="save_butn">
<span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
</button>
<button type="reset" class="button wk_mp_btn1" onclick="updateField('<?php echo $products->getId(); ?>');return false;">
<span><span><?php echo $helper->__('Cancel') ?></span></span>
</button>
</td>
.
如果我们单击“编辑”按钮,它就像这样“映像2”: http://prntscr.com/8w7fdp
解决方案
尝试类似的东西,我不确定这是否有效或不是
<span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
<img onclick="updateField('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
</span>
<br/>
<button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" title="<?php echo $helper->__('Save') ?>" type="submit" id="save_butn">
<span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
</button>
<button id="reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideReset('<?php echo $products->getId(); ?>'); return false;">
<span><span><?php echo $helper->__('Cancel') ?></span></span>
</button>
.
并按
更改脚本<script type = "text/javascript" >
var $wk_jq = jQuery.noConflict();
function hideReset(product_id) {
var editLink = "#edit_link_"+ product_id;
var updateButton = "#update_button_"+ product_id;
var resetButton = "#reset_button"+ product_id;
$wk_jq(editLink).show();
$wk_jq(updateButton).hide();
$wk_jq(resetButton).hide();
}
function updateField(product_id)
{
var qtyId = '#qty_'+ product_id;
var editLink = "#edit_link_"+ product_id;
var updateButton = "#update_button_"+ product_id;
var resetButton = "#reset_button"+ product_id;
$wk_jq(qtyId).toggle()
$wk_jq(editLink).hide();
$wk_jq(updateButton).show();
$wk_jq(resetButton).show();
$qty = $wk_jq(qtyId).val();
new Ajax.Request('<?php echo $url ?>', {
method: 'post',
parameters: {id: product_id, qty: $qty}
});
}
</script>
.