Author Topic: Invoice name change issue.  (Read 87 times)

mailblade

  • Jr. Member
  • **
  • Posts: 56
  • A beginner
Invoice name change issue.
« on: November 14, 2017, 10:12:21 am »
Latest VM ; Joomla 3.6

Hello.

I'm having some trouble with changing the invoice name which the user receives attached to the email which is sent to them.

I found these 2 lines in "mytemplate\components\com_virtuemart\controllers\invoice.php":

Code: [Select]
//$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_', 'vm'.$layout.'_'.$invoiceNumber.'.pdf');
$path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout).'.pdf';

If I enable the top line and comment out the bottom one, the user is not able to download the PDF anymore from the "Order Details" page. They can only print it. They still receive it in the email though.

Now, currently the name of the invoice is: "vminvoice_invoicenumber.pdf" (invoiceumber is the automatically generated random letters)

Example: "vminvoice_171114185H0115"

How do I change the name of "$layout"?

I've been struggling a lot with this.

I've found no way to do this. If I use this:

Code: [Select]
$path .= preg_replace('/[^A-Za-z0-9_\-\.]/', '_',.$layout.'_'.$invoiceNumber.'.pdf');
it changes the name to just "invoice_171114185H0115". However the PDF is not able to be downloaded anymore, even though the user receives it in their mail.

I would like the download option to still be available if they want to download it at another time.





AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2625
  • VirtueMart Version: 3.2.5
Re: Invoice name change issue.
« Reply #1 on: November 14, 2017, 11:11:37 am »
What are you trying to change the name to ??


You are trying to change a function that requires the variables $invoiceNumber and $layout

You should continue to use this function:-

$path .= shopFunctionsF::getInvoiceName($invoiceNumber, $layout).'.pdf';


The creation of an invoice name is done in shopFunctionsF


regards
A

Joomla 3.8.2
php 5.6 + php 7

mailblade

  • Jr. Member
  • **
  • Posts: 56
  • A beginner
Re: Invoice name change issue.
« Reply #2 on: November 14, 2017, 13:09:53 pm »
Thanks for the reply AH.

I'm trying to change the name to: "IKEA_ORDER_" and then the random invoice number after it.

I'll have a look in shopfunctions.

Yes I want to use the one you said I should.

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2625
  • VirtueMart Version: 3.2.5
Re: Invoice name change issue.
« Reply #3 on: November 14, 2017, 14:45:45 pm »
The invoice prefix is adjustable

You can just use a name language override.

COM_VIRTUEMART_FILEPREFIX_INVOICE="invoice_"
regards
A

Joomla 3.8.2
php 5.6 + php 7