News:

Support the VirtueMart project and become a member

Main Menu

Total discount value

Started by neo314, December 21, 2012, 07:03:51 AM

Previous topic - Next topic

neo314

In the invoice template, I would like to hide the discount column if there are no discounts on the order. Is $this->order_discount the total discount applied to the order and if not, is there a single value that I could test against for whether or not any discount has been applied to the order (coupon, quantity, etc.)?

bytelord

Hi,

You could create a template override for the the components\com_virtuemart\views\invoice\tmpl\invoice_items.php and just comment out the code you are don't need to displayed on invoices.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

neo314

Quote from: bytelord on December 22, 2012, 00:32:15 AM
Hi,

You could create a template override for the the components\com_virtuemart\views\invoice\tmpl\invoice_items.php and just comment out the code you are don't need to displayed on invoices.

Regards

Hi bytelord,

I'm already there. What I am trying to do in my override is test for whether any discounts exist. I assume that the discount column would show any quantity discounts, coupon discounts, shopper group discounts, etc. Correct?

If that is the case, instead of having to code a test for all the potential discount values before the output, I'm looking to see if a value already exists in the object that sums all the discounts to be applied. If there is a single value that is the sum of all the potential discounts, than I can simply test against that and hide the discount column if that value is zero.

Is order_discount a sum of all the discounts in the cart, or is there some other value that is the sum of all the discounts in the cart?

Thanks.

bytelord

Hello,

You have options in there, like per item

$item->product_subtotal_discount
$this->orderDetails['details']['BT']->order_discountAmount
$this->orderDetails['details']['BT']->coupon_discount
$this->orderDetails['details']['BT']->order_billDiscountAmount

use some if's over there to designed it as you wish
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

neo314

Quote from: bytelord on December 22, 2012, 13:15:43 PM
Hello,

You have options in there, like per item

$item->product_subtotal_discount
$this->orderDetails['details']['BT']->order_discountAmount
$this->orderDetails['details']['BT']->coupon_discount
$this->orderDetails['details']['BT']->order_billDiscountAmount

use some if's over there to designed it as you wish

Do any of these values contain the sum of all discounts applied to the order? I know $this->order_discount is used and I do not see that in your list.

bytelord

$this->orderDetails['details']['BT']->order_billDiscountAmount)
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

neo314

Quote from: bytelord on December 22, 2012, 20:09:56 PM
$this->orderDetails['details']['BT']->order_billDiscountAmount)

Perfect. Thanks.