Have different invoice and order numbers

  • Posts: 104
  • Thank you received: 0
11 years 5 months ago #103647

Hi, two questions about invoices.

1) I want to have an order number and a different invoice number.

I read the documentation and in hikashop> Configuration> Main> Order I set order number as {automatic_code} and invoice number as {date format="Y"}{id size="5"} but when I see the pre-print invoice the invoice number is the same as order number.

How can I have different numbers?

2) I want to print the order number in the invoice, just above the invoice number, between the date and the invoice number. How?

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 5 months ago #103684

Hi,

What do you call "pre-print invoice" ?
The invoice id/number are generated when the order is confirmed for the first time. If the order never been confirmed, it does not have an invoice number so it can't display it: It will display the order number instead.

You can override the "invoice" views (in the front-end and in the back-end) in order to print the order number AND the invoice number.
HikaShop display the invoice number if found, otherwise it display the order number.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 5 months ago by Jerome.

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

  • Posts: 104
  • Thank you received: 0
11 years 5 months ago #103697

Ok sorry it was my fault the order was created not confirmed.

Can you tell me exactly how to add the order number?

I konw where is it the file but I don't know which should be the code.

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 5 months ago #103706

Hi,

You have to change the way the "invoice number" is displayed.
So replace this block:

if(!empty($this->element->order_invoice_number)) {
	 echo JText::_('INVOICE').': '.$this->element->order_invoice_number;
} else {
	 echo JText::_('INVOICE').': '.@$this->element->order_number;
}

By something else like:
if(!empty($this->element->order_invoice_number)) {
	 echo JText::_('INVOICE').': '.$this->element->order_invoice_number.'<br/>;
}
 echo JText::_('ORDER_NUMBER').': '.@$this->element->order_number;

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: dyvymtvar

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

  • Posts: 104
  • Thank you received: 0
11 years 5 months ago #103723

Ok order numbre included.

Thanks

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132662

Hello,

I, too, want to show both order number and invoice number on the invoice to avoid confusion in emails being sent out.

I have tried to do this in the file invoice in the back end, but it doesn't have the coding you mentioned in this topic that I need to replace in order to include the order number and the invoice number.

I could not find an invoice file for the front end.

Please can you advise exactly which files I need to change both at the back end and the front end and I will try again.

Thanks

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132668

Hi,

I have now found an invoice file for the front end, but still don't know where to change the coding. coding is as follows:

ord

<?php
/**
 * @package    HikaShop for Joomla!
 * @version    1.6.0
 * @author    hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license    GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>

<!--
Rest of the content removed by a moderator.
Please do not post full file like that.
Please use the tag "code" when pasting (small) code blocks.
-->

Last edit: 10 years 11 months ago by Jerome.

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
10 years 11 months ago #132674

Hi,

HikaShop 1.6.0 does not have such "order number / invoice number" feature.
Please update first.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132724

I have Hikashop Business 2.2 not 1.6 - I upgraded last month.

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
10 years 11 months ago #132733

Hi,

So you have to remove your override of the view which come from HikaShop 1.6.0
Restoring the original content, you will have same code that I wrote previously. And you will be able to make the modification.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132765

How do I do that. I have removed the overrides to do with the invoices, but the view is still from Hikashoop 1.6.0.

Please advise,

Many thanks.

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132771

Hello,

I am very confused. Looking up the files via the back end, the order/invoice.php file for bluestork (backend template I am using is still Hikashop v 1.6, but the Hathor order/invoice.php is v2.2.2.

Looking at the order/show.php file for the template I am using is Hikashop v 1.6, but for the other front end templates it is 2.2.2

Why has updating Hikashop not updated the two templates I am using but has updated the files in the templates I am not using? This is weird. I presume this applies to other files in my Hikashop system.

It may be because the joomla template I am using is for Joomla 1.6, so I am updating that to 2.5.16 and will check thereafter. This is taking a while as I am in Africa on rather slow broadband. Will come back to you when I have done this and advise if Hikashop files updated when I re-install the Hikashop update after I have updated the template.

Many thanks for your patience so far.

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132772

Another thought is why hasn't it updated the Bluestork back end template files, as that is part and parcel of the Joomla update anyway. The Hikashop update updates everything but the two default templates I am using.

Any thoughts, please let me know.

Thanks,

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132778

OK, I have reuploaded an updated template for the front end and it has the correct Hikashop 2.2.2 order/show.php file - see following. I still am unsure which coding to change as there is nothing exactly like you suggested above.

Please advise.

Please also advise - if you can - why the backend Bluestork template is still not updating Hikashop files.

Coding in order/show.php:

Code removed by a moderator.
1 - Without the "code" tag, it is unreadable
2 - Without the "code" tag, it is nearly ugly
3 - We already have the code of the view, don't worry about that !
4 - It makes big forum pages for nothing
5 - It won't help anybody else to read the file content which is already include in HikaShop
...

Last edit: 10 years 11 months ago by Jerome.

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132784

I have changed backend template to VTEMtemplate instead of Bluestork. The Hikashop v2.2.2 is contained now in the files. Phew.

However, I must still be doing something wrong.

In order/invoice.php I find this text:

if(!empty($this->element->order_invoice_number)) {
echo JText::_('INVOICE').': '.$this->element->order_invoice_number;
} else {
echo JText::_('INVOICE').': '.@$this->element->order_number;
}

However, if I do what you suggested and change the above to the following, it still only takes the order number as the invoice number and doesn't show both. Just INVOICE followed by the order number.

Please advise what else I should be doing.


if(!empty($this->element->order_invoice_number)) {
echo JText::_('INVOICE').': '.$this->element->order_invoice_number;
} else {
echo JText::_('ORDER_NUMBER').': '.@$this->element->order_number;
}


Or: Please advise what I am doing wrong.

Many thanks,

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

  • Posts: 82728
  • Thank you received: 13343
  • MODERATOR
10 years 11 months ago #132831

HI,

If you want both, you should use that code:

if(!empty($this->element->order_invoice_number)) {
echo JText::_('INVOICE').': '.$this->element->order_invoice_number;
}
echo JText::_('ORDER_NUMBER').': '.@$this->element->order_number;

Regarding the view file edition, once you edited a file once and saved it, a copy of your modified file is saved in your template's override folder. When HikaShop updates, all the core files of HikaShop are replaced, but not template overrides. So it's nice because you keep your modifications when you update. But if you want to remove them to use the new version of a file, simply click on the "remove customization" icon of the Display>views listing and it will basically delete the override file from the template and use the core version of the file. Thus no need to change your template.

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132839

Hi,

First of all, sorry about pasting the whole coded file in early submission.

I have tried again with the coding you gave me, but still get the same thing the title invoice with the order number following it.

I changed the order/show.php file for front end template. I couldn't find the exact text to change in the order/invoice.php file., but I changed something very similar. It didn't work so I changed it back. I still only got the wording Invoice followed by the Order number on the actual invoice, so I have changed it back again. See attached Invoice_49 pdf. It only shows Invoice followed by the order number itself. It saves itself as the order number by calling the pdf file Invoice_49.pdf. It should be called Invoice_44.pdf, as 49 is the order number and 44 the invoice number according to the actual order page itself.See attached result. I have removed items for security purposes.

The same thing happens if I change the order/invoice.php or the order/show at the back end. - see attached invoice 50, which is actually invoice 45 with the order number TEST-00050-11/2013 not the invoice number 45. in this instance, as seen in the Orders page for that order. Again it is saved using the order number not the invoice number. The file should be Invoice_45.pdf not Invoice_49.pdf

Therefore:

  • Please tell me precisely which file needs to be changed.
  • How to include both Order number and the Invoice Number (they are different)
  • How to make sure the invoice is saved as a pdf using the invoice number not the order number.

  • Because by doing what you have asked me to do already, does not seem to work.
Many thanks,

Last edit: 10 years 11 months ago by Hodgebw. Reason: resending sample files with clearer explanations

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #132840

To help you further, I have edited the pdf files and I have attached the files showing with red ink what I would like the two invoices to be saying. It might make it clearer for you.

Thanks,

Attachments:

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

  • Posts: 82728
  • Thank you received: 13343
  • MODERATOR
10 years 11 months ago #133423

Hi,

The PDF that you provided come from the invoice PDF plugin. So it's not a view of HikaShop that you need to edit but the file plugins/hikashop/attachinvoice/attachinvoice/invoice.php of the plugin.
That's why you didn't see any difference. I'm sorry but if you don't provide all the necessary information for us to understand your situation, it's hard to tell you precisely what to do...

So you need to replace the code:

<?php if(!isset($order->order_invoice_number)) $order->order_invoice_number = $order->order_number; ?>
	<div class="invoicetitle"><?php echo JText::_('INVOICE').' '.$order->order_invoice_number; ?></div>
by:
<div class="invoicetitle"><?php 
if(!empty($this->element->order_invoice_number)) {
echo JText::_('INVOICE').': '.$this->element->order_invoice_number;
}
echo JText::_('ORDER_NUMBER').': '.@$this->element->order_number;
?></div>
in that file and you will see the modification.


Regarding the file name, you can change the line:
$invoiceFile = JText::_('INVOICE').'-'.$orderid.'_'.time().'.pdf';

to:
$invoiceFile = JText::_('INVOICE').'-'.$data->data->order_invoice_id.'_'.time().'.pdf';

in the file plugins/hikashop/attachinvoice/attachinvoice.php

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

  • Posts: 105
  • Thank you received: 0
10 years 11 months ago #133438

:cheer:

Thank you so much. I will now try that.
I am so grateful for your patience and in future I will try and be much clearer on what I am trying to do.

Many thanks,

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

Time to create page: 0.113 seconds
Powered by Kunena Forum