Post by glolar » Tue Jul 04, 2017 9:53 pm

Sorry if this has been beaten to death, but I don't see a fix for this problem for OpenCart 2.3.0.2. I found SUPPOSED fixes for earlier versions here:

http://forum.opencart.com/viewtopic.php ... 1&start=20

But I tried some of those suggestions and nothing works. Here's my SPECIFIC problem (which I discovered placing some orders myself):

1. I DO enter the full Shipping Address in OpenCart when I place the order. Then I chose the Pay With Debit or Credit Card option when I get to the PayPal screen.
2. Everything I entered for Shipping Address in OpenCart DOES get pre-populated in the PayPal address fields, except for State and Phone Number. I am forced to enter these two values before PayPal will process the order (which is good). Pretty sure the Address form fields in the PayPal form are for Billing Address though. There are no fields shown for SHIPPING Address.
3. The payment goes thru just fine, but when I log into PayPal, the transaction has only the Country in the address, all other fields are blank.

I am trying to use ShipStation to print Shipping labels, but when ShipStation syncs with PayPal, the orders come into ShipStation with blank addresses (other than Country), because that's what is stored in PayPal ... nothing but Country.

One of my colleagues has an old OpenCart 1.4.9(?) store, and he doesn't have this problem.

I really need a quick suggestion here for a specific fix for OpenCart 2.3.0.2, because I am dead in the water right now. ShipStation lets me "Verify" addresses, but if they don't come in from PayPal, I have to manually enter the shipping address for EVERY order in ShipStation. Not good.

Thanks in advance for any help.

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by ADD Creative » Thu Jul 06, 2017 8:12 pm

Have you changed in catalog/controller/extension/payment/pp_standard.php:

Code: Select all

			$data['first_name'] = html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8');
			$data['last_name'] = html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
			$data['address1'] = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
			$data['address2'] = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
			$data['city'] = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
			$data['zip'] = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
			$data['country'] = $order_info['payment_iso_code_2'];
to this:

Code: Select all

			$data['first_name'] = html_entity_decode($order_info['shipping_firstname'], ENT_QUOTES, 'UTF-8');
			$data['last_name'] = html_entity_decode($order_info['shipping_lastname'], ENT_QUOTES, 'UTF-8');
			$data['address1'] = html_entity_decode($order_info['shipping_address_1'], ENT_QUOTES, 'UTF-8');
			$data['address2'] = html_entity_decode($order_info['shipping_address_2'], ENT_QUOTES, 'UTF-8');
			$data['city'] = html_entity_decode($order_info['shipping_city'], ENT_QUOTES, 'UTF-8');
			$data['zip'] = html_entity_decode($order_info['shipping_postcode'], ENT_QUOTES, 'UTF-8');
			$data['country'] = $order_info[shipping_iso_code_2'];
The issue could also be that the state is missing. Try adding something like the following after the above.

Code: Select all

			if ($order_info['payment_iso_code_2'] == 'US') {
				$data['state'] = $order_info['shipping_zone_code'];
			} else {
				$data['state'] = $order_info['shipping_zone'];
			}
And add the following to catalog/view/theme/default/template/extension/payment/pp_standard.tpl:

Code: Select all

  <input type="hidden" name="state" value="<?php echo $state; ?>" />
Note: There are more countries, other than US, that require the shipping_zone_code. Look at the PayPal documentation to see which ones and add the tests for these.
Last edited by ADD Creative on Tue Aug 08, 2017 6:45 pm, edited 1 time in total.

www.add-creative.co.uk


Active Member

Posts

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

Post by glolar » Thu Jul 06, 2017 11:19 pm

ADD Creative,

I had already made the change to pp_standard.tpl to add the State, but I have never heard of the changes to pp_standard.php. Is there a link to this solution in the OpenCart forum? If so, I would like to read it.

When you say "The issue may be that the state is missing", I do remember seeing something in the PayPal docs somewhere that said something like "The address is not shown if it is invalid", or something to that effect. I guess a missing State would make the address invalid, so I am first going to try adding that code to pp_standard.php. As for changing all of the "payment_" variables to "shipping_" variables in pp_standard.php, do the "payment_" variables refer to Billing Address? If so, won't these changes to pp_standard.php just cause all of the shipping address values to be passed to the PayPal screen's Billing Address fields? How will this change cause PayPal to store the Shipping Address values in the PayPal transaction's Shipping Address (vs. the Billing Address)?

Have you actually had the issue I am having, and did your suggested changes fix the problem?

On another note, should I continue to use the following settings in the pp_standard.tpl file:

<input type="hidden" name="address_override" value="1" />
<input type="hidden" name="no_shipping" value="2" />

Having the "no_shipping" set to "2" is SUPPOSED to cause the PayPal payment screen to show the SHIPPING ADDRESS form fields. The "address_override" value of "1" is supposed to tell PayPal to override the customer PayPal account's address (their docs don't say if they are talking about Billing Address or Shipping Address), but in the particular scenario I am describing, my customer is using the PayPal "Guest Checkout", which means my customer either has no PayPal account, or want's to pay by Credit Card (and doesn't WANT to use his PayPal account for payment).

So, what should I use for these two values?

If I could cause the PayPal Guest Checkout screen to show the Shipping Address fields (and have them be required), then I think my problem would go away (ShipStation would then have Shipping Addresses after loading the PayPal transactions, and I could print Shipping Labels). The customer would have to enter the Shipping Address values into the PayPal Guest Checkout screen (I don't think PayPal would pre-populate the Shipping Address fields, like they do the Billing Address fields, would they)?

Thanks in advance for all the suggestions.

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by ADD Creative » Fri Jul 07, 2017 8:17 am

I don't know of any thread about the state. I looked at the PayPal docs and the code for 1.4.x. https://developer.paypal.com/docs/class ... variables/

The problem with the different addresses is PayPal only allow you to send one address. This would normally be the shipping address if you were only allowing PayPal accounts. You could then set address_override to 1 and no_shipping to 0 or 2 (I can't remember which is best).

However the problem arises when you allow PayPal to accept cards without a PayPal account. The customer need to enter their billing address for the card (I believe this is why OpenCart sends the payment address).

If the payment (billing)address is different from the shipping address your are always going to have problems. If you pass the payment (billing) address, customers probably won't bother entering their shipping address in PayPal (as they have already entered it into OpenCart), so PayPal will end up without the shipping address.

If you pass the shipping address, PayPal will use this for the card billing address. So address_override will need setting to 0 so they can enter the correct one to actually make a card payment. The customer will then change the address to their card billing address and again will not click the box to say the shipping address is different, therefore PayPal will still end up with the wrong shipping address.

Your best option is to use the PayPal sandbox to try the different combinations with all the different scenarios that could happen to see which works best.

www.add-creative.co.uk


Active Member

Posts

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

Post by glolar » Fri Jul 07, 2017 10:15 am

Add Creative,

Use the PayPal sandbox ... you're kidding right? :D

I tried to follow their convoluted instructions the other day on how to set that up, and got completely lost.

FYI, my OpenCart customers only have to enter their shipping address ONCE, in OpenCart, when they create their store account. When they check out, they are shown their shipping address, and only have to click a Continue button (unless they want to add a different shipping address).

Yes, I already saw those PayPal docs, but they are very old (OpenCart version 1.4.x ???), but that's where I found out about the "no_shipping" variable. Having the "no_shipping" set to "2" is SUPPOSED to cause the PayPal payment screen to show the SHIPPING ADDRESS form fields, and make them required (it doesn't). That would solve my problem.

In the case of a customer that does not have a PayPal account, and they use the PayPal Guest Checkout, PayPal just doesn't give a damn about Shipping Address???

Lastly, I don't see any "box that says the shipping address is different" on the PayPal Guest Checkout screen. See a screen capture here:

Image

By the way, I got a reply from PayPal today that said "This is not a PayPal SDK issue. Contact OpenCart or ShipStation", and they closed my ticket. They didn't even bother to confirm that a "no_shipping" value of "2" is SUPPOSED to cause the PayPal payment screen to show the SHIPPING ADDRESS form fields and make them required (as their docs claim), or answer my question on how to get PayPal Guest Checkout to display the SHIPPING ADDRESS fields. Typical PayPal support.

I am going to try your earlier coding change suggestions, but if that doesn't work, I am dead in the water as far as printing Shipping Labels.

Truly, thanks for all your help. Hopefully someone with knowledge of this OpenCart PayPal Payments Standard / PayPal / ShipStation integration will chime in to this post and save my day.

Regards,

Larry Sanford

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by RideTheWave » Fri Jul 07, 2017 10:41 am

glolar wrote:
Fri Jul 07, 2017 10:15 am
In the case of a customer that does not have a PayPal account, and they use the PayPal Guest Checkout, PayPal just doesn't give a damn about Shipping Address???

Lastly, I don't see any "box that says the shipping address is different" on the PayPal Guest Checkout screen.
Do you think it's that bad that customers who use PayPal Guest checkout are "forced" to use their billing address as the shipping address? When they do that, it automatically covers you the seller under PayPal seller protection if they claim fraud or non-receipt of the item. You aren't covered (or you aren't supposed to be covered) when the shipping address is different than the billing address.

On another note, I am not sure if this PayPal guest checkout "forces" the true billing address of the credit card used. I just did a test purchase and I put 123 Street as my address and the payment went through successfully. I did put my correct zip code though. And when I logged in PayPal as the seller, I did see it as eligible for seller protection. So this seems pretty buggy, but to me it seems buggy in the seller's favor.

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by RideTheWave » Fri Jul 07, 2017 11:40 am

One other thing to consider, it's possible that PayPal is intentionally only allowing 1 address in the guest checkout as incentive for people to register with PayPal and pay with their PayPal accounts instead (where you can put multiple addresses). I don't know for certain but it's definitely a possibility.

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by glolar » Fri Jul 07, 2017 1:29 pm

RideTheWave,

You said:

"Do you think it's that bad that customers who use PayPal Guest checkout are "forced" to use their billing address as the shipping address? When they do that, it automatically covers you the seller under PayPal seller protection if they claim fraud or non-receipt of the item. You aren't covered (or you aren't supposed to be covered) when the shipping address is different than the billing address".

Where did I say that it is bad that customers who use PayPal Guest checkout are "forced" to use their billing address as the shipping address???

You either didn't read my entire post(s), or you are missing the point, which is:

When I log into PayPal and look at the orders, I see that PayPal HAS NO SHIPPING ADDRESS for these transactions. When I log into ShipStation (which pulls these transactions from PayPal), and try to print shipping labels, I have to MANUALLY copy/paste (or type in) the customer's shipping address into ShipStation before I can print a shipping label. That is the ONLY point I am trying to make.

I wouldn't care if PayPal stored the BILLING address as the SHIPPING address, as long as they STORED A SHIPPING ADDRESS. Got it now?

The CAPS are for emphasis, not to yell at anyone ;D

BTW, how did you do that "glolar wrote ^" thing?

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by RideTheWave » Fri Jul 07, 2017 1:51 pm

Ok, misunderstanding then. When you mention "PayPal just doesn't give a damn about Shipping Address", in my other post I think it's a possibility that it's not that they don't give a damn, but they might be intentionally allowing only 1 address in order to give people an incentive to join PayPal and pay with PayPal instead. Just a possibility, if I'm wrong and someone does find that you can somehow put a billing address and a shipping address in the guest checkout, then please post here.

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by glolar » Fri Jul 07, 2017 2:49 pm

RideTheWave,

Yeah, I don't doubt PayPal's motives. They used to go out of their way to obscure the fact that you can checkout with a Debit/Credit card.

I just want ShipStation to be able to pull down PayPal transactions that have a Shipping Address, so I can print Shipping labels. Cannot believe I am the only one experiencing this issue. I have been on the ShipStation forums .... nada.

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by glolar » Fri Jul 07, 2017 5:32 pm

Add Creative,

FYI, I added your suggested code for the state to the two files you mention, and it made no difference. The State field is not being pre-populated in the PayPal form (all the other Billing Address data is, but not the State). PayPal must be intentionally forcing people to select a State from the form.

Do you know of a way to dump the contents of what OpenCart is sending to PayPal? I'd really like to present them with proof that the State is being passed to them, and it is THEM that is dropping the State information.

Thanks

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by RideTheWave » Fri Jul 07, 2017 6:00 pm

How about phone number? Are you by chancing getting the phone number field populated or is it just the state?

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by glolar » Fri Jul 07, 2017 6:23 pm

Ride The Wave,

Phone number is NOT being populated either (See the screen cap in the trail above).

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by ADD Creative » Fri Jul 07, 2017 9:27 pm

Just done a quick test in the sandbox.

If you set the state to a correct code such as 'CA' the state gets correctly filled in on PayPal.

Use your web browsers 'Inspect' (right click to the left of the Confirm Order button) on "Step 6: Confirm Order". You should see somewhere <input name="state" value="CA" type="hidden"> in the form sent to PayPal.

If address_override is set to 1 you will not see the shipping address on PayPal checkout. I assume PayPal will us the address OpenCart sent it anyway, but just no show it. If you want to see the address, address_override has to be 0.

As you are passing an address to PayPal no_shipping can be 0 or 2, but never 1. It's really only for PayPal account payments as an address is nearly always entered in guest checkouts. Probably 2 is best.

So, the problem seems to me to be that you are not passing the state code correctly. Get that working and things should work.

www.add-creative.co.uk


Active Member

Posts

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

Post by glolar » Sat Jul 08, 2017 11:33 am

Add Creative,

You are a genius! After using the browser inspect tool to inspect what is actually getting sent to PayPal, the State wasn't even being sent, and the "no_shipping" value was there, but was set to the default value of "1", even though I did change it in the code to "2". Well, I discovered that I had been modifying the pp_standard.tpl file in the \store\catalog\view\theme\theme708\template directory, and NOT the pp_standard.tpl file in the \store\catalog\view\theme\default\template\extension folder (I am using a purchased theme, so I guess that's why I have two versions of the pp_standard.tpl file). I mistakenly updated the WRONG file.

Once I updated the correct file, the Shipping Address is now showing up on the PayPal Guest Checkout screen! The State is now also being populated after I added that missing line of code to the correct .tpl file.

One last issue: phone number. I added the following in the pp_standard.php file:

$data['phone_number'] = $order_info['telephone'];

And then added the following in the pp_standard.tpl file:

<input type="hidden" name="phone_number" value="<?php echo $phone_number; ?>" />

Inspection in the browser shows:

<input name="phone_number" value="619-417-2224" type="hidden">

... but the phone number is not being pre-populated on the PayPal Guest Checkout screen. I checked the PayPal documentation, and the only thing they have about the phone number are the following three fields (looks like they split the phone number up into three different components):

night_phone_a (The area code for US phone numbers, or the country code for phone numbers outside the U.S. PayPal fills in the buyer's home phone number automatically).

night_phone_b (The three-digit prefix for U.S. phone numbers, or the entire phone number for phone numbers outside the U.S., excluding country code. PayPal fills in the buyer's home phone number automatically).

night_phone_c (The four-digit phone number for U.S. phone numbers. PayPal fills in the buyer's home phone number automatically).

Obviously, based on my inspection of the html sent to PayPal, since the phone number IS there, OpenCart stores the phone number as "xxx-xxx-xxxx". If I split this up into the three different components listed in the PayPal documentation, will that cause the PayPal form field to be pre-populated? Don't want the user to have to enter that if he doesn't have to.

If that would do the trick, do you have a code snippet that would split the OpenCart phone number into the three different components?

Again, I cannot thank you enough. Contact me offline if you are interested in some possible OpenCart development work.

Regards,

Larry Sanford

User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA

Post by tingwing » Mon Oct 30, 2017 9:37 pm

I hope there is an extension for this problem,I would like to buy it

my email :support@bestshop24h.com
my wechat:bestshop24h
my free extension:https://www.opencart.com/index.php?rout ... estshop24h


Active Member

Posts

Joined
Tue Aug 02, 2016 9:01 pm
Who is online

Users browsing this forum: No registered users and 2 guests