Post by labeshops » 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'];			

Running Opencart v3.0.3.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by mikeinterserv » Sat Mar 13, 2021 8:56 am

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.
Last edited by mikeinterserv on Sat Mar 13, 2021 9:16 am, edited 1 time in total.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by straightlight » Sat Mar 13, 2021 9:10 am

$shipping_info['name']['full_name'] .' ' .= $order_info['shipping_lastname'];
This line sure won't work.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mikeinterserv » 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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by ADD Creative » 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'];

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by labeshops » Sat Mar 13, 2021 10:50 pm

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

Running Opencart v3.0.3.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by mikeinterserv » Sat Mar 13, 2021 11:43 pm

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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by mikeinterserv » 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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by Gilmore » Mon Apr 05, 2021 10:21 am

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?

Thanks!

Gilmore


User avatar
Active Member

Posts

Joined
Thu Aug 12, 2010 7:33 am

Post by Gilmore » Mon Apr 05, 2021 10:36 am

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

Thanks!

Gilmore


User avatar
Active Member

Posts

Joined
Thu Aug 12, 2010 7:33 am
Who is online

Users browsing this forum: No registered users and 10 guests