alfredopacino Posted February 20, 2014 Share Posted February 20, 2014 hi, so long i found tiny customization kind of easy, i just editing invoice.tpl as i want. there is a way to print this (ecommerce company infos ) {$shop_address|escape:'htmlall':'UTF-8'} one per row? now i get all in a row (name, address, city..) Link to comment Share on other sites More sharing options...
vekia Posted February 20, 2014 Share Posted February 20, 2014 you can use str_replace modifier to replace commas with <br> can you show how it looks exacly? (output of variable) Link to comment Share on other sites More sharing options...
alfredopacino Posted February 20, 2014 Author Share Posted February 20, 2014 (edited) you can use str_replace modifier to replace commas with <br> can you show how it looks exacly? (output of variable) this is the output SHOP NAME - ADDRESS - ADDRESS LINE2 - CITY - PROVINCE - COUNTRY Tel: 000202020 Fax: 000202021 123123132 (registration code) this is the code printing this output (in footer.tpl) {$shop_address|escape:'htmlall':'UTF-8'}<br /> {if !empty($shop_phone) OR !empty($shop_fax)} {if !empty($shop_phone)} Tel: {$shop_phone|escape:'htmlall':'UTF-8'} {/if} {if !empty($shop_fax)} Fax: {$shop_fax|escape:'htmlall':'UTF-8'} {/if} <br /> {/if} {if isset($shop_details)} {$shop_details|escape:'htmlall':'UTF-8'}<br /> {/if} a correct format could be: shop name COMPANY REAL NAME (important!!) REGISTRATION CODE ADDRESS ADDRESS LINE2 CITY (PROVINCE) - COUNTRY TELEPHONE - FAX for a legally correct invoice i have to change the client info order too, how can i do? i mean {$invoice_address} and {$delivery_address} vars Edited February 20, 2014 by alfredopacino (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted February 21, 2014 Share Posted February 21, 2014 You have to override the getFooter() function in /classes/pdf/HTMLTemplate.php to have all address pieces available. Then you can compose them in the footer your way. I recommend to save COMPANY REAL NAME and REGISTRATION CODE as 2 rows under Contact details > Registration. Link to comment Share on other sites More sharing options...
alfredopacino Posted February 21, 2014 Author Share Posted February 21, 2014 (edited) You have to override the getFooter() function in /classes/pdf/HTMLTemplate.php to have all address pieces available. Then you can compose them in the footer your way. I recommend to save COMPANY REAL NAME and REGISTRATION CODE as 2 rows under Contact details > Registration. how can i override this file?where i have to place the overrided file? i posted the correct italian invoice format, an help to realize this format could be very helpful to the whole italian community: the currect PS invoice format is off the law. Edited February 21, 2014 by alfredopacino (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted February 22, 2014 Share Posted February 22, 2014 OK. A little change. Create a new file /override/classes/pdf/HTMLTemplateInvoice.php with this content: <?php class HTMLTemplateInvoice extends HTMLTemplateInvoiceCore { /** * Returns the template's HTML footer * @return string HTML footer */ public function getFooter() { ... create your new variables here ... $shop_address = $this->getShopAddress(); $this->smarty->assign(array( ... place for your new variables ... 'available_in_your_account' => $this->available_in_your_account, 'shop_address' => $shop_address, 'shop_fax' => Configuration::get('PS_SHOP_FAX', null, null, (int)$this->order->id_shop), 'shop_phone' => Configuration::get('PS_SHOP_PHONE', null, null, (int)$this->order->id_shop), 'shop_details' => Configuration::get('PS_SHOP_DETAILS', null, null, (int)$this->order->id_shop), 'free_text' => Configuration::get('PS_INVOICE_FREE_TEXT', (int)Context::getContext()->language->id, null, (int)$this->order->id_shop) )); return $this->smarty->fetch($this->getTemplate('footer')); } } Don't forget to remove /cache/class_index.php file to clear class cache before using the new class. Link to comment Share on other sites More sharing options...
alfredopacino Posted February 22, 2014 Author Share Posted February 22, 2014 (edited) OK. A little change. Create a new file /override/classes/pdf/HTMLTemplateInvoice.php with this content: <?php class HTMLTemplateInvoice extends HTMLTemplateInvoiceCore { /** * Returns the template's HTML footer * @return string HTML footer */ public function getFooter() { ... create your new variables here ... $shop_address = $this->getShopAddress(); $this->smarty->assign(array( ... place for your new variables ... 'available_in_your_account' => $this->available_in_your_account, 'shop_address' => $shop_address, 'shop_fax' => Configuration::get('PS_SHOP_FAX', null, null, (int)$this->order->id_shop), 'shop_phone' => Configuration::get('PS_SHOP_PHONE', null, null, (int)$this->order->id_shop), 'shop_details' => Configuration::get('PS_SHOP_DETAILS', null, null, (int)$this->order->id_shop), 'free_text' => Configuration::get('PS_INVOICE_FREE_TEXT', (int)Context::getContext()->language->id, null, (int)$this->order->id_shop) )); return $this->smarty->fetch($this->getTemplate('footer')); } } Don't forget to remove /cache/class_index.php file to clear class cache before using the new class. -"create your new variables here" -"place for your new variables" im sorry im a php developer but i know nothing about prestashop development.. -how exactly can i create and place new variables? -creating vars here i will find some extra text field in backoffice in shop details? -can i override the invoice.tpl placind a new invoice.tpl in override/pdf/invoice.tpl? ..if its so difficult adapt invoice template to my needs maybe i could get around those problems writing the company info directly in invoce.tpl (i will take this solution as last shot).. Edited February 22, 2014 by alfredopacino (see edit history) Link to comment Share on other sites More sharing options...
alfredopacino Posted March 7, 2014 Author Share Posted March 7, 2014 up? Link to comment Share on other sites More sharing options...
Recommended Posts