1

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"/>
</div>
</div>
</div>
</li>

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

Edit

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

1

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:

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

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:

<td>
    <span class="label qty" id="valueqty_<?php echo $assinproducts->getId(); ?>">
        <?php echo intval($assinproducts['qty']); ?>
    </span>
    <input type="text" id="qty_<?php echo $assinproducts->getId(); ?>"
           onkeydown="validateNumbers(event)"
           name="stock" value="<?php echo intval($assinproducts['qty']); ?>"
           style="display:none;"/>

    <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'); ?>"/>
    </span>

    <p id="updatedqty_<?php echo $assinproducts->getId(); ?>"
       style="display:none;color:red;">Updated</p><br/>

    <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;"
            style="display:none">
        <span>
            <span style="font-size:12px;"><?php echo $helper->__('Update') ?></span>
        </span>
    </button>

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

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. – Baby in Magento Apr 13 '16 at 10:10
  • hi , sorry again, when you are free can you please check my questions : link1 , link2 , link3 – Baby in Magento Apr 15 '16 at 10:56
1

You have load model using id.

so your code not working

$mpAssignProductModel->getQty();

Change it to:

$mpAssignProductModel->getData('qty');
  • sorry, it didt worked for me. – Baby in Magento Apr 12 '16 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"/> – Baby in Magento Apr 12 '16 at 13:05
  • var_dump($mpAssignProductModel->getData()); check qty field is in it or not? – Prashant Valanda Apr 12 '16 at 13:10
  • displaying array(0) { } – Baby in Magento Apr 12 '16 at 13:12
  • issue is here <?php $mpAssignProductModel=Mage::getModel("mpassignproduct/mpassignproduct")->load($id); ?> have no data for particular $id – Prashant Valanda Apr 12 '16 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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