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

#   PDF Invoice Plugin not working

##

- **[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")**
- [![rdpaul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36291-rdpaul "View rdpaul's Profile") Topic Author
- [ Offline](/forum/user/36291-rdpaul)

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 8 months ago -  11 years 8 months ago [\#191980](#191980) by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")  *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#191980 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")* was created by *[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")*

-- HikaShop version -- : 2.2.2
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.37
-- Browser(s) name and version -- : Chrome 40.0.2214.115 m

Hi,

I have installed the PDF Invoice Plugin and in the plugin settings I have set the "Statuses for email attachment" to "confirmed" and all other settings are at default.

With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.

When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.

Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.

Thanks in advance for your help in resolving this.

UPDATE:

I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):

&lt;fieldset&gt;

&lt;legend&gt;&lt;?php echo JText::_('HIKASHOP_'.strtoupper($oneAddress)); ?&gt;&lt;/legend&gt;

&lt;?php

$override = false;

if(!empty($order-&gt;order_shipping_id) &amp;&amp; $oneAddress=='shipping_address' &amp;&amp; method_exists($currentShipping, 'getShippingAddress')) {

$override = $currentShipping-&gt;getShippingAddress($order-&gt;order_shipping_id);

}

if($override !== false ) {

echo $override;

} else {

$addressClass = hikashop_get('class.address');

if($app-&gt;isAdmin()){

$view = 'order';

}else{

$view = 'address';

}

echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);

}

?&gt;

&lt;/fieldset&gt;

- [ ![pdfinvoice.jpg](/forum/attachment/22613) ](/forum/attachment/22613 "pdfinvoice.jpg") [ ](/forum/attachment/22613?download=1 "pdfinvoice.jpg")

Last edit: 11 years 8 months ago by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile"). Reason: Further information added to the problem

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84NzUyMDItcGRmLWludm9pY2UtcGx1Z2luLW5vdC13b3JraW5nP3RtcGw9bWFya2Rvd24=) 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: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

11 years 8 months ago [\#191997](#191997) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#191997 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi,

I think you should have a PHP error due to a too old HikaShop version.
The function "displayAddress" is not available in HikaShop 2.2.2 ; you should update to the last one (2.3.5)
[ www.hikashop.com/support/documentation/5...ashop-changelog.html](http://www.hikashop.com/support/documentation/56-hikashop-changelog.html)

Regards,

---

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

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

- **[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")**
- [![rdpaul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36291-rdpaul "View rdpaul's Profile") Topic Author
- [ Offline](/forum/user/36291-rdpaul)

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 8 months ago -  11 years 8 months ago [\#192021](#192021) by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")  Replied by *[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192021 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi Jerome,

Thanks for your reply.

Unfortunately, I have inherited the current site from a previous developer and I cannot risk a Hikashop update because of the fact that the code is heavily customized.

Meantime I have found a replacement for the offending displayAddress() function call and am giving it here in case some one else can benefit from it.
Code:

if($override !== false ) { echo $override; } else { /* The following block to be commented out $addressClass = hikashop_get('class.address'); if($app-&gt;isAdmin()){ $view = 'order'; }else{ $view = 'address'; } echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view); */ /*Add the following block to replace the above*/ $html = hikashop_getLayout('address','address_template',$params,$js); if(!empty($order-&gt;fields)){ foreach($order-&gt;fields as $field){ $fieldname = $field-&gt;field_namekey; if(!empty($order-&gt;$oneAddress-&gt;$fieldname)) $html=str_replace('{'.$fieldname.'}',$fieldsClass -&gt;show($field,$order-&gt;$oneAddress-&gt;$fieldname),$html); } } echo str_replace("\n","&lt;br/&gt;\n",str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html))); /*End of new lines added*/ } Besides the above change you will also need to add one more line before the foreach loop which processes the addresses. /*Add the following ONE line*/ $fieldsClass = hikashop_get('class.field'); foreach($addresses as $oneAddress){ .............................

Thanks for your help and for a super component.

Last edit: 11 years 8 months ago by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile").

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

- **[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")**
- [![rdpaul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36291-rdpaul "View rdpaul's Profile") Topic Author
- [ Offline](/forum/user/36291-rdpaul)

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 8 months ago [\#192060](#192060) by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")  Replied by *[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192060 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi,

A further update to my earlier message. After changing the code as mentioned earlier, my customers are able to receive confirmation emails along with the attached PDF invoice. Now I am facing two new problems as follows:

1. In spite of setting Override Front End and Back End to Yes in the plugin parameters, my Print button for the invoice on the front end is not overridden. I still get to see the regular invoice (not the PDF version) when I click Print button in the order detail screen on the front end. Is there some other way for the customer to be able to download a PDF version of the invoice on the front end?

2. In the Back End, when I click the Invoice button I momentarily get to see part of the PDF invoice being rendered and then immediately in less than a second the page redirects to [ www.mysite/adminsitrator/index.php](http://www.mysite/adminsitrator/index.php).

I can't figure out why this is happening. Any help will be much appreciated.

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

11 years 7 months ago [\#192116](#192116) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192116 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi,

1. This function requires a trigger that didn't exist on HikaShop 2.2.2 which is why it doesn't work.
The solution is to edit the file "show" of the view "order" for your frontend template via the menu Display&gt;Views and add such code at the top: Code:

&lt;?php JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher-&gt;trigger('onHikashopBeforeDisplayView', array(&amp;$this)); ?&gt;

2. Same problem. You're using an old version of HikaShop which is not compatible with that.
Add the same code in the file 'invoice' of the view 'order' for your backend template via the menu Display&gt;Views.

The following user(s) said Thank You: [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")

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

- **[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")**
- [![rdpaul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36291-rdpaul "View rdpaul's Profile") Topic Author
- [ Offline](/forum/user/36291-rdpaul)

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 7 months ago [\#192319](#192319) by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")  Replied by *[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192319 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi,

Thanks for your reply but unfortunately the changes suggested by you are not solving the problem.

I have followed your instructions and have made overrides in both the front end and back end files suggested by you.

Now when I click the Print button to print the invoice in the front end, I get to see a new page loading up (earlier the override was not working at all and I was just seeing the non-pdf version of the invoice only) but the page is totally blank with just the following error message: "TCPDF ERROR: Some data has already been output to browser, can't send PDF file".

As regards the back end, the problem remains the same as before. A partly rendered version of the PDF invoice loads up for a second and then the page redirects to [ www.mysite/adminsitrator/index.php](http://www.mysite/adminsitrator/index.php).

My apologies for not being able to update to the latest version of Hikashop. Will greatly appreciate if you can find a workaround for my situation.

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

11 years 7 months ago [\#192352](#192352) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192352 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi,

That error indicates that something has already started displaying. Did you put the code completely at the top, without an space before it ?

For the backend, maybe it requires something else in the code of HikaShop to handle the toolbar behavior properly. I don't remember. Honestly, an update would be recommended here.
You can copy the website somewhere else and try the update on the copy and see what you lost. Nomally, if the previous developer did things right like we usually recommend, he should have used view overrides, translation overrides CSS overrides and plugins and not modify the HikaShop core files directly.

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

- **[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")**
- [![rdpaul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36291-rdpaul "View rdpaul's Profile") Topic Author
- [ Offline](/forum/user/36291-rdpaul)

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 7 months ago [\#192453](#192453) by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")  Replied by *[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192453 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Thank you Nicolas for all your effort. I understand what you are saying and will see what I can do.

Can you just help me with the following code that I have changed in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php to display addresses in my invoice (because $addressClass-&gt;displayAddress is not available to be used in Hikashop 2.2.2). This code is working fine on the front end but it is causing problem while displaying an address when the invoice is to be printed from the back end. If I comment out printing addresses altogether from the invoice then it works on the back end also.

How can I make printing of the addresses possible on both front end and back end without using $addressClass-&gt;displayAddress?

The code that I am talking about is as under.
Code:

/*The following block commented out $addressClass = hikashop_get('class.address'); if($app-&gt;isAdmin()){ $view = 'order'; }else{ $view = 'address'; } echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view); */ /*The following block added to replace above but DOES NOT WORK ON BACK END*/ $html = hikashop_getLayout('address','address_template',$params,$js); if(!empty($order-&gt;fields)){ foreach($order-&gt;fields as $field){ $fieldname = $field-&gt;field_namekey; if(!empty($order-&gt;$oneAddress-&gt;$fieldname)) $html=str_replace('{'.$fieldname.'}',$fieldsClass -&gt;show($field,$order-&gt;$oneAddress-&gt;$fieldname),$html); } } $html = str_replace("\n","&lt;br/&gt;\n",str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html))); echo str_replace("&lt;br /&gt;\r&lt;br/&gt;","&lt;br/&gt;",$html);

Thanks again for your help and patience.

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

11 years 7 months ago [\#192480](#192480) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192480 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

Hi,

Your issue is that line of code:
$html = hikashop_getLayout('address','address_template',$params,$js);
That will only work on the frontend as there is no such view in the backend.
In the backend, you should use that code instead:
$html = hikashop_getLayout('order','address_template',$params,$js);

So you can do like that:
$app = JFactory::getApplication();
if($app-&gt;isAdmin()){
$html = hikashop_getLayout('order','address_template',$params,$js);
}else{
$html = hikashop_getLayout('address','address_template',$params,$js);
}

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

- **[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")**
- [![rdpaul's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36291-rdpaul "View rdpaul's Profile") Topic Author
- [ Offline](/forum/user/36291-rdpaul)

Less More

- Posts: 15
- Thank you received: 0
-
-

11 years 7 months ago [\#192501](#192501) by [rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")  Replied by *[rdpaul](/forum/user/36291-rdpaul "View rdpaul's Profile")* on topic *[PDF Invoice Plugin not working](/forum/30-integrations/875202-pdf-invoice-plugin-not-working#192501 "-- HikaShop version -- : 2.2.2 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.37 -- Browser(s) name and version -- : Chrome 40.0.2214.115 m  Hi,  I have installed the PDF Invoice Plugin and in the plugin settings I have set the &quot;Statuses for email attachment&quot; to &quot;confirmed&quot; and all other settings are at default.  With this plugin enabled, when an order is successfully paid for through Paypal, the customer does not receive the order confirmation email and no payment confirmation email is received by the site administrator. The order creation email is received every time though. If I turn the PDF Invoice plugin off, then all emails are received fine.  When I go to the back end and generate an invoice by clicking the invoice button in the order detail screen, the popup that opens to display the PDF invoice displays a partly formed invoice only. I am attaching a screen shot of that popup.  Also, I do not find any invoice generated in the /plugins/hikashop/attachinvoice/attachinvoice/invoices directory. It seems that the plugin is not able to create the PDF invoice as a result of which the order confirmation email does not get sent out at all to the customer and neither does the payment confirmation email gets sent out to the administrator.  Thanks in advance for your help in resolving this.  UPDATE:  I notice that if I comment out the following code in /plugins/hikashop/attachinvoice/attachinvoice/invoice.php then everything works fine and the confirmation and payment notification mails get sent out (though obviously the Billing and Shipping addresses do not get printed in the attached invoice):      order&#95;shipping&#95;id) &amp;&amp; $oneAddress=='shipping&#95;address' &amp;&amp; method&#95;exists($currentShipping, 'getShippingAddress')) {  $override = $currentShipping-&gt;getShippingAddress($order-&gt;order&#95;shipping&#95;id);  }  if($override !== false ) {  echo $override;  } else {  $addressClass = hikashop&#95;get('class.address');  if($app-&gt;isAdmin()){  $view = 'order';  }else{  $view = 'address';  }  echo $addressClass-&gt;displayAddress($order-&gt;fields,$order-&gt;$oneAddress,$view);  }  ?&gt;  ")*

That works great! Thanks a ton. Your component is the best and your support is matchless.

Have a great day.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy84NzUyMDItcGRmLWludm9pY2UtcGx1Z2luLW5vdC13b3JraW5nP3RtcGw9bWFya2Rvd24=) 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.322 seconds

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

[](#top)
