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->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->displayAddress?
The code that I am talking about is as under.
/*The following block commented out
$addressClass = hikashop_get('class.address');
if($app->isAdmin()){
$view = 'order';
}else{
$view = 'address';
}
echo $addressClass->displayAddress($order->fields,$order->$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->fields)){
foreach($order->fields as $field){
$fieldname = $field->field_namekey;
if(!empty($order->$oneAddress->$fieldname)) $html=str_replace('{'.$fieldname.'}',$fieldsClass ->show($field,$order->$oneAddress->$fieldname),$html);
}
}
$html = str_replace("\n","<br/>\n",str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html)));
echo str_replace("<br />\r<br/>","<br/>",$html);