we are using following code for updating quantity in file2.phtml file :

enter image description here

<li class="fields">
<div class="customer-name">
<div class="field">
<div class="input-box">
<input type="text" name="qty" id="qty" value="<?php echo intval($mpAssignProductModel->getQty()) ?>" class="required-entry validate-zero-or-greater input-text"/>

i copied this code in file 1, now in file1.phtml page, its displaying like this :

enter image description here

means correct quantity value [20 ] showing in file2.phtml page , but in file1.phtml page, its showing "0" as quantity

full code for file1.phtml, file2.phtml


for debug, i used this code : <?php var_dump($id); ?> , its displaying NULL

2 Answers 2


Try to use the $assinproducts instead of the $mpAssignProductModel in the file1.phtml. You should add your input with qty after the condition:

<?php foreach($this->getCollection() as $assinproducts):  ?>

Complete code should looks like this:

<?php foreach ($this->getCollection() as $assinproducts): ?>
    <?php $products = Mage::getModel('catalog/product')->load($assinproducts->getProductId()); ?>
    <tr class="wk_row_view ">
            <input type="text" name="qty" id="qty" value="<?php echo intval($assinproducts->getQty()) ?>" class="required-entry validate-zero-or-greater input-text"/>

But beware because you can have more than one item in the table. At bottom of the code you can see the original qty input (with id increment in the name) and I strongly recommend you use the original input field:

    <span class="label qty" id="valueqty_<?php echo $assinproducts->getId(); ?>">
        <?php echo intval($assinproducts['qty']); ?>
    <input type="text" id="qty_<?php echo $assinproducts->getId(); ?>"
           name="stock" value="<?php echo intval($assinproducts['qty']); ?>"

    <span class="label wk_action" id="edit_link_<?php echo $assinproducts->getId(); ?>">
        <img onclick="showField('<?php echo $assinproducts->getId(); ?>'); return false;"
             src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>

    <p id="updatedqty_<?php echo $assinproducts->getId(); ?>"

    <button id="update_button_<?php echo $assinproducts->getId(); ?>"
            class="button wk_mp_btn1"
            onclick="updateField('<?php echo $assinproducts->getId(); ?>',<?php echo intval($assinproducts['qty']); ?>); return false;"
            <span style="font-size:12px;"><?php echo $helper->__('Update') ?></span>

    <button id="reset_button_<?php echo $assinproducts->getId(); ?>"
            type="reset" class="cancel"
            onclick="hideReset('<?php echo $assinproducts->getId(); ?>'); return false;"

PS: Please tell me if I have mixed files and I will update the answer

  • You are genius, for fixing the issue of file 1.phtml page , you updated file2 code. Thanks for your time & patience. Commented Apr 13, 2016 at 10:10
  • hi , sorry again, when you are free can you please check my questions : link1 , link2 , link3 Commented Apr 15, 2016 at 10:56

You have load model using id.

so your code not working


Change it to:

  • sorry, it didt worked for me. Commented Apr 12, 2016 at 13:04
  • i tried like this : <input type="text" name="qty" id="qty" value="<?php echo intval($mpAssignProductModel->getData('qty')) ?>" class="required-entry validate-zero-or-greater input-text"/> Commented Apr 12, 2016 at 13:05
  • var_dump($mpAssignProductModel->getData()); check qty field is in it or not? Commented Apr 12, 2016 at 13:10
  • displaying array(0) { } Commented Apr 12, 2016 at 13:12
  • issue is here <?php $mpAssignProductModel=Mage::getModel("mpassignproduct/mpassignproduct")->load($id); ?> have no data for particular $id Commented Apr 12, 2016 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.