Magento Remove Edit Button And Make It Editable Once We Click On Textfield
we are using following code for Price. we provided auto update the price text field using following code. Phtml <input type = "text" id = "qty_echo $products->getId(); " onkeydown="validateNumbers(event)" name = "stock" value = "echo (int) $SellerQty; " />
<p id="updatedqty_echo $products->getId(); " style = "display:none;color:red;">Updated</p>
<br/>
<button id="update_button_echo $products->getId(); " class="button wk_mp_btn1" onclick="updateField('echo $products->getId(); ',echo $assignqty; ); return false;" >
<span><span style="font-size:12px;">echo $helper->__('Update') </span></span>
</button>
<button id="reset_button_echo $products->getId(); " type="reset" class="cancel" onclick="hideReset('echo $products->getId(); '); return false;" >
<span><span>echo $helper->__('Cancel') </span></span>
</button>pan><span style="font-size:12px;">echo $helper->__('Update') </span></span>
</button>
js
function hideReset(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(editLink).show();
}
function showField(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).show();
$wk_jq(editLink).hide();
$wk_jq(updateButton).show();
$wk_jq(updateButton).prop('disabled', false);//just in case
$wk_jq(resetButton).show();
return false;
}
function updateField(product_id,assignqty)
{
var qtyId = '#qty_'+ product_id;
var valueId = '#valueqty_'+ product_id;
var updatedqty = '#updatedqty_'+ product_id;
var editLink = "#edit_link_"+ product_id;
var updateButton = "#update_button_"+ product_id;
var resetButton = "#reset_button"+ product_id;
var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';
$wk_jq(editLink).hide();
$wk_jq(updateButton).show();
$wk_jq(resetButton).show();
$qty = $wk_jq(qtyId).val();
jQuery(valueId).html($qty);
hideReset(product_id);
var tmpQty=assignqty+ parseInt($qty) ;
new Ajax.Request(url, {
method: 'post',
parameters: {id: product_id, qty: tmpQty},
onComplete: function (transport) {
//alert(transport.responseText);
jQuery(priceId).val($price);
// $wk_jq(priceId).setValue($price);
jQuery(updatedqty).show().delay(2000).fadeOut();
$updateButton.prop('disabled', false);
// $wk_jq(qtyId).setValue($qty);
}
});
}
Post a Comment for "Magento Remove Edit Button And Make It Editable Once We Click On Textfield"