[Skip to main content](#vessel-content)

#   pdf PLUGIN - Change file name

##

- **[andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")**
- [![andreasuriani's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28733.jpg)](/forum/user/28733-andreasuriani "View andreasuriani's Profile") Topic Author
- [ Offline](/forum/user/28733-andreasuriani)

Less More

- Posts: 177
- Thank you received: 1
-
-

12 years 3 months ago -  12 years 3 months ago [\#168741](#168741) by [andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")  *[pdf PLUGIN - Change file name](/forum/35-orders-management/870584-pdf-plugin-change-file-name#168741 "-- HikaShop version -- : latest  Hi All, how can i change the filename of attachment invoice?  In attachment of the E.Mail the invoice name is &quot;Invoice.pdf&quot; (And it could be ok), but in the order management,(Order&gt;Show) if i try to print the invoice, the file name is &quot;Invoice&#95;nn.pdf (nn is the order id).  I'd like that the name fot both is &quot;Invoice&#95;nn.pdf&quot; (but nn it will be the invoice sequence id).  How can i do this?")* was created by *[andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")*

-- HikaShop version -- : latest

Hi All,
how can i change the filename of attachment invoice?

In attachment of the E.Mail the invoice name is "Invoice.pdf" (And it could be ok), but in the order management,(Order&gt;Show) if i try to print the invoice, the file name is "Invoice_nn.pdf (nn is the order id).

I'd like that the name fot both is "Invoice_nn.pdf" (but nn it will be the invoice sequence id).

How can i do this?

Last edit: 12 years 3 months ago by [andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3MDU4NC1wZGYtcGx1Z2luLWNoYW5nZS1maWxlLW5hbWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

12 years 3 months ago [\#168747](#168747) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[pdf PLUGIN - Change file name](/forum/35-orders-management/870584-pdf-plugin-change-file-name#168747 "-- HikaShop version -- : latest  Hi All, how can i change the filename of attachment invoice?  In attachment of the E.Mail the invoice name is &quot;Invoice.pdf&quot; (And it could be ok), but in the order management,(Order&gt;Show) if i try to print the invoice, the file name is &quot;Invoice&#95;nn.pdf (nn is the order id).  I'd like that the name fot both is &quot;Invoice&#95;nn.pdf&quot; (but nn it will be the invoice sequence id).  How can i do this?")*

Hi,

See post : [ www.hikashop.com/forum/checkout/870286-p...age-file.html#167405](https://www.hikashop.com/forum/checkout/870286-pdf-attachment-plugin-uses-wrong-language-file.html#167405)

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3MDU4NC1wZGYtcGx1Z2luLWNoYW5nZS1maWxlLW5hbWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")**
- [![andreasuriani's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28733.jpg)](/forum/user/28733-andreasuriani "View andreasuriani's Profile") Topic Author
- [ Offline](/forum/user/28733-andreasuriani)

Less More

- Posts: 177
- Thank you received: 1
-
-

12 years 3 months ago [\#168795](#168795) by [andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")  Replied by *[andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")* on topic *[pdf PLUGIN - Change file name](/forum/35-orders-management/870584-pdf-plugin-change-file-name#168795 "-- HikaShop version -- : latest  Hi All, how can i change the filename of attachment invoice?  In attachment of the E.Mail the invoice name is &quot;Invoice.pdf&quot; (And it could be ok), but in the order management,(Order&gt;Show) if i try to print the invoice, the file name is &quot;Invoice&#95;nn.pdf (nn is the order id).  I'd like that the name fot both is &quot;Invoice&#95;nn.pdf&quot; (but nn it will be the invoice sequence id).  How can i do this?")*

Hi Jerome,
this change the invoice name for the email, but not if i try to download invoice from order list.

How can i change this?

Thanks
Andrea

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3MDU4NC1wZGYtcGx1Z2luLWNoYW5nZS1maWxlLW5hbWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

12 years 3 months ago [\#168814](#168814) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[pdf PLUGIN - Change file name](/forum/35-orders-management/870584-pdf-plugin-change-file-name#168814 "-- HikaShop version -- : latest  Hi All, how can i change the filename of attachment invoice?  In attachment of the E.Mail the invoice name is &quot;Invoice.pdf&quot; (And it could be ok), but in the order management,(Order&gt;Show) if i try to print the invoice, the file name is &quot;Invoice&#95;nn.pdf (nn is the order id).  I'd like that the name fot both is &quot;Invoice&#95;nn.pdf&quot; (but nn it will be the invoice sequence id).  How can i do this?")*

Hi,

You also have to update the _getPDFInvoice function Code:

if(count($orderIds) == 1){ if(empty( $order-&gt;order_invoice_number)) $order-&gt;order_invoice_number = $order-&gt;order_number; $fileName = JText::sprintf('PDF_INVOICE', $order-&gt;order_invoice_number); if($fileName == 'PDF_INVOICE') $fileName = JText::_('INVOICE').'_'.reset($orderIds); } $html2pdf-&gt;Output($fileName.'.pdf','D');

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3MDU4NC1wZGYtcGx1Z2luLWNoYW5nZS1maWxlLW5hbWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")**
- [![andreasuriani's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar28733.jpg)](/forum/user/28733-andreasuriani "View andreasuriani's Profile") Topic Author
- [ Offline](/forum/user/28733-andreasuriani)

Less More

- Posts: 177
- Thank you received: 1
-
-

12 years 3 months ago [\#168967](#168967) by [andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")  Replied by *[andreasuriani](/forum/user/28733-andreasuriani "View andreasuriani's Profile")* on topic *[pdf PLUGIN - Change file name](/forum/35-orders-management/870584-pdf-plugin-change-file-name#168967 "-- HikaShop version -- : latest  Hi All, how can i change the filename of attachment invoice?  In attachment of the E.Mail the invoice name is &quot;Invoice.pdf&quot; (And it could be ok), but in the order management,(Order&gt;Show) if i try to print the invoice, the file name is &quot;Invoice&#95;nn.pdf (nn is the order id).  I'd like that the name fot both is &quot;Invoice&#95;nn.pdf&quot; (but nn it will be the invoice sequence id).  How can i do this?")*

Hi Jerome,
i've modified the code in this way, and now it works:
Code:

function _getPDFInvoice($orderIds = array()){ $app = JFactory::getApplication(); if(!class_exists('HTML2PDF')) include(dirname(__FILE__).DS.'attachinvoice'.DS.'html2pdf.class.php'); $config =&amp; hikashop_config(); $class = hikashop_get('class.order'); $currencyHelper = hikashop_get('class.currency'); $fields = array(); $null = null; $fieldsClass = hikashop_get('class.field'); $fields['item'] = $fieldsClass-&gt;getFields('backend_listing',$null,'item'); if(!empty($order-&gt;order_payment_id)){ $pluginsPayment = hikashop_get('type.plugins'); $pluginsPayment-&gt;type='payment'; } if(!empty($order-&gt;order_shipping_id)){ $pluginsShipping = hikashop_get('type.plugins'); $pluginsShipping-&gt;type='shipping'; } //This array stores all pdf pages... $pdfContent = array(); foreach($orderIds as $orderId){ $order = $class-&gt;loadFullOrder($orderId,true,false); $fields['order'] = $fieldsClass-&gt;getFields('backend',$order,'order'); ob_start(); if(file_exists(HIKASHOP_MEDIA.'plugins'.DS.'invoice.php')){ $file = HIKASHOP_MEDIA.'plugins'.DS.'invoice.php'; }else{ $file = dirname(__FILE__).DS.'attachinvoice'.DS.'invoice.php'; } require($file); $pdfContent[] = ob_get_clean(); } $content = implode('&lt;div style="page-break-before:always"&gt;&lt;/div&gt;',$pdfContent); $content = hikashop_absoluteURL($content); //$html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf = new HTML2PDF('P', 'A4', 'en',true, 'UTF-8'); $font = $this-&gt;params-&gt;get('font'); if(!empty($font)){ $html2pdf-&gt;setDefaultFont($font); } $html2pdf-&gt;pdf-&gt;SetDisplayMode('fullpage'); $html2pdf-&gt;writeHTML($content); if(count($orderIds) == 1){ if(empty( $order-&gt;order_invoice_number)) $order-&gt;order_invoice_number = $order-&gt;order_number; $fileName = JText::_('INVOICE').(string)$order-&gt;order_invoice_number; } $html2pdf-&gt;Output($fileName.'.pdf','D'); if(count($orderIds) == 1) $fileName.= '_'.reset($orderIds); $html2pdf-&gt;Output($fileName.'.pdf','D'); exit; }

Thanks for your support.

Andrea

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg3MDU4NC1wZGYtcGx1Z2luLWNoYW5nZS1maWxlLW5hbWU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.049 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
