attach invoice plugin: questions

  • Posts: 224
  • Thank you received: 8
5 years 3 months ago #302083

Hello,
questions for the attach invoice plugin:

- I want to use the plugin only for downloading pdf invoices in bulk from backend, but i DO NOT want to send pdf invoices to customers, thus I in the plugin configuration > Statuses for email attachment I have inserted "nostatus".
Is that a good solution?

- I DO NOT want the payment method info inserted in the invoices (for offline payments that's a lot of info that is usually showed to the customers when they choose that kind of method)

Could you guide me in how to override the pdf invoice template, I guess is this file /plugins/hikashop/attachinvoice/attachinvoice/invoice.php,
where do I have to copy it exactly in my joomla template folder for the override to work?

Thank you

Last edit: 5 years 3 months ago by oloccina.

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
5 years 3 months ago #302089

ok, I customized the original file, I am not sure it can be overriden, but it's not a problem to reupload it when I update the plugin

I have another issue though:
in the generated invoices the product price is showed + taxes, while it should be showed minus taxes. Only the grand total at the bottom should be showed plus taxes.
The hikashop default invoices show this correctly, but those generated by the plugin don't


see:

hika attach invoices plugin: www.screencast.com/t/a5yCtDKMMr
hika default invoices: www.screencast.com/t/ktvH6GL1N

in hika main configs > taxes I have:
Show taxed prices: with taxes
Floating tax prices: yes

I am not sure if the default hika invoices template has been customized, I don't find in display > views, maybe it's a different template (cart, product ?) that gets used also for the invoices...

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 3 months ago #302085

Hi,

1. Yes, that's a good solution.

2. You can remove the code:

$paymentClass = hikashop_get('class.payment');
		$payment = $paymentClass->get($order->order_payment_id);
		if(!empty($payment->payment_params->information))
			echo $payment->payment_params->information;
from the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php to remove the payment information.

You don't really need to do an override as the file would only be replaced if you install the plugin over it in the future but we don't publish new versions of the plugin and we don't plan on changing much in the future as it's pretty much stable by this point and does what it is supposed to do. Now if you still want to do an override, you can copy that file to media/com_hikashop/plugins/invoice.php

3. That's strange. Both invoices should display the prices with tax in your case as both rely on the "Show taxed prices" setting of the HikaShop configuration. So I suppose that you've made a view override of the invoice view file to force the prices to not display with tax and that a similar change will have to be added to the invoice.php file of the plugin at its beginning like that:
$this->config->set('price_with_tax', 1);

Last edit: 5 years 3 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
5 years 3 months ago #302104

So I suppose that you've made a view override of the invoice view file to force the prices to not display with tax

Where is this view file exactly (I am talking about the default hikashop invoices) ? I can't find it to check it

a similar change will have to be added to the invoice.php file of the plugin at its beginning like that:
$this->config->set('price_with_tax', 1);


How do I insert this line of code exactly?
I am editing this file: /plugins/hikashop/attachinvoice/attachinvoice/invoice.php

I tried surround it with php tags and inserting it right after
<?php
/**
 * @copyright	Copyright (C) 2009-2015 Adrien Baborier - All rights reserved.
 * @license		http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 */
defined('_JEXEC') or die('Restricted access');
?>

but I get this error upon generating any invoice
0 Call to a member function set() on null

I tried to insert it without php tags but the generated invoices just show the line of code and nothing else

Thank you


UPDATE:
Ok, I solved by editing the following lines

202
if($config->get('price_with_tax')){
					//echo $currencyHelper->format($product->order_product_price+$product->order_product_tax,$order->order_currency_id);
					echo $currencyHelper->format($product->order_product_price,$order->order_currency_id

215
if($config->get('price_with_tax')){
						//echo $currencyHelper->format($product->order_product_total_price,$order->order_currency_id);
						echo $currencyHelper->format($product->order_product_total_price_no_vat,$order->order_currency_id);

234
if($config->get('price_with_tax')){
					//echo $currencyHelper->format($order->order_subtotal,$order->order_currency_id);
					echo $currencyHelper->format($order->order_subtotal_no_vat,$order->order_currency_id);

it does the job, but if there's a more elegant solution please advice :)

Last edit: 5 years 3 months ago by oloccina.

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
5 years 3 months ago #302106

Hi,

1. You can edit all the view files of HikaShop via the menu Display>Views. There, if you search for "invoice" you'll find it easily.
www.hikashop.com/support/documentation/1...-display.html#layout

2. Sorry, I was a bit fast. The code should be:

$config->set('price_with_tax', 1);
$this->config would be in the invoice view file for the default invoice of HikaShop.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum