Post by ADD Creative » Fri Jul 07, 2017 8:45 pm

Sorry, there was an extra ) on one of the lines. Try.

Code: Select all

				$phone = preg_replace("/[^0-9.]/", "", html_entity_decode($order_info['telephone'], ENT_QUOTES, 'UTF-8'));
				$this->data['night_phone_a'] = substr($phone, 0, 3);
				$this->data['night_phone_b'] = substr($phone, 3, 3);
				$this->data['night_phone_c'] = substr($phone, 6);
Where you had it or just after line below should be fine.

Code: Select all

			$this->data['country'] = $order_info['payment_iso_code_2'];

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by RideTheWave » Fri Jul 07, 2017 9:07 pm

There is an error on the checkout confirmation step: "Indirect modification of overloaded property ControllerExtensionPaymentPPStandard::$data has no effect" and that error is for all 3 of those lines containing night_phone_a, night_phone_b, and night_phone_c.

New member

Posts

Joined
Fri May 19, 2017 8:29 am

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

Sorry, try.

Code: Select all

				$phone = preg_replace("/[^0-9.]/", "", html_entity_decode($order_info['telephone'], ENT_QUOTES, 'UTF-8'));
				$data['night_phone_a'] = substr($phone, 0, 3);
				$data['night_phone_b'] = substr($phone, 3, 3);
				$data['night_phone_c'] = substr($phone, 6);

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by RideTheWave » Sat Jul 08, 2017 7:30 am

No errors this time, but the phone number field is still not populated. Do you think it makes a difference if the customer enters the phone number as (333) 333-3333 vs 333-333-3333 vs 3333333333 ?
Last edited by RideTheWave on Sun Jul 09, 2017 7:17 am, edited 1 time in total.

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by ADD Creative » Sun Jul 09, 2017 12:38 am

See PayPal's information and example here. https://www.paypal.com/cgi-bin/webscr?c ... te_outside

To check, 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="night_phone_a" value="123" type="hidden"> in the form sent to PayPal. Check the night_phone_a, b, and c are correct.

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by RideTheWave » Sun Jul 09, 2017 7:23 am

For phone number, I entered 1234567890. When inspecting the page at the Confirm Order step, I do see the variables:

<input name="night_phone_a" value="123" type="hidden">
<input name="night_phone_b" value="456" type="hidden">
<input name="night_phone_c" value="7890" type="hidden">

That should be an indication that the numbers are at least being sent to PayPal, right? I'm wondering if it could be something on PayPal's end? Add Creative: Does it work for you? Are you getting the phone number field populated in the PayPal guest checkout?

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by RideTheWave » Sun Jul 09, 2017 7:36 am

Ok, I think I've figured it out. All your above code DOES work! The problem was that I was testing it with fictitious area codes like 123 or 333. If I put in a REAL area code like 213 or 646, then it works! And I think it might be country specific too because when I put in a US address but enter a Canadian area code, the phone number doesn't get pre-populated. Thank-you ADD Creative!

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by ADD Creative » Sun Jul 09, 2017 8:25 am

It will be US only. See the following link for other countries.
https://www.paypal.com/uk/cgi-bin/websc ... te_outside

You might have to do something like this for other countries.

Code: Select all

$phone = preg_replace("/[^0-9.]/", "", html_entity_decode($order_info['telephone'], ENT_QUOTES, 'UTF-8'));
if ($order_info['payment_iso_code_2'] == 'US') {
	$data['night_phone_a'] = substr($phone, 0, 3);
	$data['night_phone_b'] = substr($phone, 3, 3);
	$data['night_phone_c'] = substr($phone, 6);
} else if ($order_info['payment_iso_code_2'] == 'CA') {
	$data['night_phone_a'] = '1'
	$data['night_phone_b'] = substr($phone, 0, 16);
	$data['night_phone_c'] = '';
}

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by RideTheWave » Sun Jul 09, 2017 12:24 pm

I have to correct my above post. Without changing any of the code (ie/ without specifying country code & just keeping your original code), when I enter a Canadian phone number (say area code 416) and put a US address, it does go through "sometimes." For example, say I get to the PayPal checkout page and I see that the phone number is missing. Then I'll press the Back button until I get back to the checkout page again. Without changing anything, I'll re-submit the same info from the checkout page and then this time the phone number will appear on the PayPal checkout page. So it seems like a hit or miss.

The same thing occurs when I enter a UK address. The phone number sometimes does and sometimes doesn't get populated (again, without changing any of the code). By the way, I'm wondering how would someone from the UK enter his/her phone number? I saw that a London area code is 020 plus 8 digits so the test number I used was 02033333333 and it went through. It was populated as 20333 33333 (five digits, a space, then five digits). How many digits is a phone number from the UK?

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by ADD Creative » Mon Jul 10, 2017 1:55 am

The most common length in the UK is 11 including the leading 0. There are however exceptions. The leading 0 is removed if dialing from outside the UK and replaced with the country code 44. So 01234 567890 becomes +44 1234 567890. This is probably why PayPal removes the leading 0.

The following seemed to work for me.

Code: Select all

$phone = preg_replace("/[^0-9.]/", "", html_entity_decode($order_info['telephone'], ENT_QUOTES, 'UTF-8'));
if ($order_info['payment_iso_code_2'] == 'US') {
	$data['night_phone_a'] = substr($phone, 0, 3);
	$data['night_phone_b'] = substr($phone, 3, 3);
	$data['night_phone_c'] = substr($phone, 6);
} else {
	$data['night_phone_a'] = ''
	$data['night_phone_b'] = substr($phone, 0, 16);
	$data['night_phone_c'] = '';
}

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by RideTheWave » Mon Jul 10, 2017 10:36 am

On your 4th last line you forgot a semi-colon which gave a syntax error. Also, since Canada follows the exact same phone number structure as the US (3 digit area code, 3 digit prefix, and 4 for the rest), I changed the code a little to look like this:

Code: Select all

 $phone = preg_replace("/[^0-9.]/", "", html_entity_decode($order_info['telephone'], ENT_QUOTES, 'UTF-8'));
			if (($order_info['payment_iso_code_2'] == 'US')||($order_info['payment_iso_code_2'] == 'CA')) {
				$data['night_phone_a'] = substr($phone, 0, 3);
				$data['night_phone_b'] = substr($phone, 3, 3);
				$data['night_phone_c'] = substr($phone, 6);
            } else {
			    $data['night_phone_a'] = '';
	            $data['night_phone_b'] = substr($phone, 0, 16);
            	$data['night_phone_c'] = '';
But I have to tell you, this seems to be a hit or miss thing. Sometimes the phone number is not populated, then I'll press the Back button a few times, then press Confirm Order again (with the exact same details), and then the phone number field will be populated. So it doesn't seem to be a consistent thing. Are you finding the same? Oh well, I guess it's not going to be a huge inconvenience for a customer to enter their phone number again (at least I hope not)...

New member

Posts

Joined
Fri May 19, 2017 8:29 am

Post by ADD Creative » Mon Jul 10, 2017 8:15 pm

For UK numbers it worked every time. For US numbers there seemed to be some validation going on, when I tested in the sandbox. The numbers that worked always worked and the numbers that didn't always failed, as far as I could tell.

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by tingwing » Tue Oct 31, 2017 12:29 pm

I have a naive thought ,if use paypal express checkout,would the problem disappear?

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

Post by ADD Creative » Tue Oct 31, 2017 6:40 pm

The PayPal Express module passes both the payment and the shipping address, so should not have the problem or the shipping address not being passed to PayPal.

ADD Creative - Web development and e-commerce development, Milton Keynes or Christchurch, UK
ADD Filtration - HVAC Panel Filters, Bag Filters and HEPA Filters


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am

Post by tingwing » Fri Nov 03, 2017 9:25 pm

thanks

for paypal standard,the simple solution.
go to catalog\view\theme\default\template\extension\payment\pp_standard.tpl
edit
name="no_shipping" value="1"
to
name="no_shipping" value="2"

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 3 guests