Page 1 of 1

Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Tue Dec 29, 2015 11:30 pm
by apartamenti
I have add Custom field with name VATID.

then on admin/controller/sale/order.php

$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{vatid}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';

$find = array(
'{firstname}',
'{lastname}',
'{company}',
'{vatid}',
'{address_1}',
'{address_2}',
'{city}',
'{postcode}',
'{zone}',
'{zone_code}',
'{country}'
);

$replace = array(
'firstname' => $order_info['payment_firstname'],
'lastname' => $order_info['payment_lastname'],
'company' => $order_info['payment_company'],
'vatid' => $order_info['payment_custom_field'],
'address_1' => $order_info['payment_address_1'],
'address_2' => $order_info['payment_address_2'],
'city' => $order_info['payment_city'],
'postcode' => $order_info['payment_postcode'],
'zone' => $order_info['payment_zone'],
'zone_code' => $order_info['payment_zone_code'],
'country' => $order_info['payment_country']
);

$payment_address = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));

When i echo $payment_address in order_invoice.tpl VATID is not showing!

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 2:22 am
by IP_CAM
I would have 'mis'-used an existing, but not used default Variable, like the Fax Number, for such a Task, then, you would just have to rename a language line contnent. It would have made Life a little easier, I assume. There are Mod's, and possibly even OC v.2 Functions, making such visible on invoices as well.

just to mention it. ;)
Ernie
bigmax.ch/shop/

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 2:37 am
by apartamenti
I am not trying to show my own company VATID :) VATID for customers. O0

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 2:50 am
by IP_CAM
Sorry, but I figured, you wanted to display some Customer related Information on the invoice,
and the (text/title-wise adapted) Customer FAX-Field Content would be such a place, to do this...
Ernie

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 3:11 am
by apartamenti
IP_CAM wrote:Sorry, but I figured, you wanted to display some Customer related Information on the invoice,
and the (text/title-wise adapted) Customer FAX-Field Content would be such a place, to do this...
Ernie
Exactly :)

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 4:11 am
by IP_CAM
then, there you go:
http://www.opencart.com/index.php?route ... n_id=22666

then, find some Mod, or possibly built-in Option, to display it on the invoice:
http://www.opencart.com/index.php?route ... %20Invoice

I once created such a Mod for OC v.1.5.6.x:
http://www.opencart.com/index.php?route ... n_id=22454
you should be able, I guess, to make it work!

Good Luck
Ernie

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 5:29 am
by apartamenti
IP_CAM wrote:then, there you go:
http://www.opencart.com/index.php?route ... n_id=22666

then, find some Mod, or possibly built-in Option, to display it on the invoice:
http://www.opencart.com/index.php?route ... %20Invoice

I once created such a Mod for OC v.1.5.6.x:
http://www.opencart.com/index.php?route ... n_id=22454
you should be able, I guess, to make it work!

Good Luck
Ernie
No luck :(

Re: Bug in OC 2.0.3.1 Custom Fields not adding to invoice

Posted: Wed Dec 30, 2015 5:04 pm
by apartamenti
Problem is fixed! I clean the cache! Thank you very much to all and Happy new year!