i’m trying to create custom filed, which i did. It is not position where i want to, but that is another story. I was wondering is it possible to take the value of that custom filed and use it in calculation for total. For example i want to add discount filed enter the percent of discount and based on that to calculate total.
All custom fields are stored in the
$custom_fields array which is available for quotes and invoices.
Example for quotes:
/application/modules/quotes/views/view.php - Line 238
<?php $this->layout->load_view('quotes/partial_item_table'); ?>
This loads the template that displays items with all prices etc. So if you want to use a custom field for discounts you have to pass
$custom_fields to the template:
<?php $this->layout->load_view('quotes/partial_item_table', $custom_fields); ?>
Now you can access all custom fields and all values stored in them in the item table.
As I don’t know what your custom field is called you could take a look at the custom field array with placing
<?php var_dump($custom_fields) ?> anywhere in your template (at the bottom would be the best).
Kovah thank you for your replay. Tried that way, then i added custom filed into mdl_invoice calculation and when pressing submit nothing happens. So my final formula will be something like this:
$total = $total - ($total*($item_invoice_custom_discount/100)). I tried to add $discount as item_invoice_custom_discount into mdl_items.php but no luck.
Do i need to edit anything else in order to use custom filed in mdl_item_amount.php for calculation of $total?
The fastest way around this would be to create another field like Tax Rate and to be able to select percent of discount from there if is it possible.
Well in this case I would suggest adding a new article with a negative amount as a discount and wait for an official release of a discount module.
I wanted to ask similar question.
I need field between Tax and Total and make discounts in percentages for desired items.
Amount in percentage need to subtract from price amount.
Is there anyone who make that thing to work?