Page 1 of 1

adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 8:41 am
by labeshops
When paypal send the shipping name to opencart (version 3.0.3.2), it does not put a space between first and last names so when I print a shipping label from paypal it comes out as "firstnamelastname" and is hard to read. Looking at paypal.php control file, I see at line 144:

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .= $order_info['shipping_lastname'];			
How can I add a space? Can I do something simple like adding .' ' in the 2nd line, or is there a better way?

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .' ' .= $order_info['shipping_lastname'];			

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 8:56 am
by mikeinterserv
There is no file called paypal.php in 3.0.3.2
Which paypal extension is it. - edit - yep I missed the title :-)

Also do not put your space where you have. It won't work, you could put it inside the array element but it might upset paypal extension and may get trimmed anyway.

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 9:10 am
by straightlight
$shipping_info['name']['full_name'] .' ' .= $order_info['shipping_lastname'];
This line sure won't work.

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 9:17 am
by mikeinterserv
is there a twig file that corresponds to that page
I don't have commerce manager to see
Also I can't find anything called paypal commerce manager

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 10:26 am
by ADD Creative
labeshops wrote:
Sat Mar 13, 2021 8:41 am
When paypal send the shipping name to opencart (version 3.0.3.2), it does not put a space between first and last names so when I print a shipping label from paypal it comes out as "firstnamelastname" and is hard to read. Looking at paypal.php control file, I see at line 144:

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .= $order_info['shipping_lastname'];			
How can I add a space? Can I do something simple like adding .' ' in the 2nd line, or is there a better way?

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .' ' .= $order_info['shipping_lastname'];			
Try.

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .= ' ' . $order_info['shipping_lastname'];

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 10:50 pm
by labeshops
mikeinterserv wrote:
Sat Mar 13, 2021 9:17 am
is there a twig file that corresponds to that page
I don't have commerce manager to see
Also I can't find anything called paypal commerce manager
https://www.opencart.com/index.php?rout ... n_id=38358

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sat Mar 13, 2021 11:43 pm
by mikeinterserv
I thought it might be that but wasn't sure :-) Thanks for the link.
Did you try ADDs idea
I think the space issue is related to the email on one line issue also.
There are some spacing and new line issues with some php version and twig.
Where do you first see the shipping name with no space in admin or only on paypal page

Re: adding a space between first and last names in paypal commerce manager?

Posted: Sun Mar 14, 2021 2:08 am
by mikeinterserv
EDIT - I posted this on the wrong thread but it still may be relevant
To fix your twig issues try this
Find system/library/template/twig/lexer.php line 162

Code: Select all

if (isset($this->positions[2][$this->position][0]) ) {
    $text = rtrim($text);
Change to

Code: Select all

if (isset($this->positions[2][$this->position][0]) && ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0])) {
   $text = rtrim($text);
I just fully tested this on 3.0.3.2 with the issue with php7.4 and it worked.
This should fix your paypal no space issue

Re: adding a space between first and last names in paypal commerce manager?

Posted: Mon Apr 05, 2021 10:21 am
by Gilmore
mikeinterserv wrote:
Sun Mar 14, 2021 2:08 am
EDIT - I posted this on the wrong thread but it still may be relevant
To fix your twig issues try this
Find system/library/template/twig/lexer.php line 162

Code: Select all

if (isset($this->positions[2][$this->position][0]) ) {
    $text = rtrim($text);
Change to

Code: Select all

if (isset($this->positions[2][$this->position][0]) && ($this->options['whitespace_trim'] === $this->positions[2][$this->position][0])) {
   $text = rtrim($text);
I just fully tested this on 3.0.3.2 with the issue with php7.4 and it worked.
This should fix your paypal no space issue
I just tried this and it didn't work. Using OC 3.0.3.2 and paypal commerce patform oc3xv1.1.2
Cleared cache too. PHP v7.3.27

Could just be me or has anyone else tried this and it didn't work?

Re: adding a space between first and last names in paypal commerce manager?

Posted: Mon Apr 05, 2021 10:36 am
by Gilmore
ADD Creative wrote:
Sat Mar 13, 2021 10:26 am
labeshops wrote:
Sat Mar 13, 2021 8:41 am
When paypal send the shipping name to opencart (version 3.0.3.2), it does not put a space between first and last names so when I print a shipping label from paypal it comes out as "firstnamelastname" and is hard to read. Looking at paypal.php control file, I see at line 144:

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .= $order_info['shipping_lastname'];			
How can I add a space? Can I do something simple like adding .' ' in the 2nd line, or is there a better way?

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .' ' .= $order_info['shipping_lastname'];			
Try.

Code: Select all

		if ($this->cart->hasShipping()) {
			$shipping_info['name']['full_name'] = $order_info['shipping_firstname'];
			$shipping_info['name']['full_name'] .= ' ' . $order_info['shipping_lastname'];
PERFECT! This is the fix. Just tested it with OC 3.0.3.2 and paypal commerce patform oc3xv1.1.2