Remove Quantity from invoice


#1

I know it was asked 2 years ago but I was wondering if there is a way to get rid of the quantity when I create an invoice. Thanks


#2

The easiest way would be just to remove that field from your templates :blush:

Obviously it would still appear in the back end, but it would not be visible to clients.


#3

Hi,
if possible, would you be able to advise, where the templates can be edited so that the field can be removed?
Kindest regards


#4

Look at application/modules/invoices/views/partial_item_table.php

     <?php foreach ($items as $item) { ?>
                ....
                    <td class="td-amount td-quantity">
                        <div class="input-group">
                            <span class="input-group-addon"><?php _trans('quantity'); ?></span>
                            <input type="text" name="item_quantity" class="input-sm form-control amount"
                                   value="<?php echo format_amount($item->item_quantity); ?>"
                                <?php if ($invoice->is_read_only == 1) {
                                    echo 'disabled="disabled"';
                                } ?>>
                        </div>
                    </td>
               ....

    <?php } ?> 

You should also look at the invoice controller and force the quantity to 1 for each item.


Quantity column removal
#6

Thank you very much.
I’ve found the controller, but am not sure which item you mean to force to 1. Would you be able to advise on this?
Best regards


#7

You said in the initial post that you do not want a quantity field on the invoice setting as the item is a fixed price item.

You have to ensure then that the quantity is 1 and not zero.

If you force the quantity to 1, you would have achieved this.

If you don’t want to do this in the controller, consider using a hidden fields in the form,

<input type="hidden" name="item_quantity" value="1"

#8

I’m not sure we talk about the same thing… I said that I would like a quantity (Qty) not to appear at all on the invoice.
Ideally, I would only like these columns to show up on the invoice: Item, Description, Price
Do you think this is feasible?
Kindest regards


#9

I understand that you said that the quantity should not appear on the invoice. My first post pointed to the code that must be removed.

However. any invoice iten MUST HAVE A QUANTITY In your case your quantity will be forced to ‘1’. My last code segment shows the quantity field as a hidden value with a forced value of 1. It will not appear on the form, but will be required in calculations for the invoice total.


#10

I understand, thanks a lot.
Do I understand well that the code you shared (<input type=“hidden” name=“item_quantity” value=“1”) should be put to the file \application\modules\invoices\controllers\Invoices.php? Would you be able to advise to which area of the file this should be added?
Kindest regards


#11

Add it to the form application/modules/invoices/views/partial_item_table.php

In fact, replace the code that you removed for the quantity by the hidden field.

Therefore, you would have

  1. Removed the visible field and its label
  2. Added a new hidden.

Now, when you Save the invoice form, the quantity will be sent as before, but now with a value of 1. And your item total will be
item_total = item_price * quantity
= item_price * 1