Forums / Built-in Shipping and Payment Modules / PayPal, Split the zip, zip1 zip2 for Japan

PayPal, Split the zip, zip1 zip2 for Japan

Locked

Views: 2,669

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
20 Mar 2008, 6:35 AM
#1
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

PayPal, Split the zip, zip1 zip2 for Japan

I am working on the Japanese pack for 1.3.8.

Paypal now works for Japan, but I need to edit the PayPal IPN module for the zip code.

Paypal Japan, splits the zip code into two parts.

Here is the source code for PayPal when I pass the zip code of 1234567

<input type="text" id="zip" size="3" maxlength="3" onKeyUp="javascript: autoTab(this, this.form.zip2);" onKeyDown="javascript: zip_length=this.value.length;" name="zip" value="1234567"><span> - 
</span><input type="text" id="zip2" size="4" maxlength="4" name="zip2" value="">
```Now I need to give paypal the 1st 3 digits of the zip code for zip1 and the last 4 for zip2.

This is the first time for me to jump into the PayPal module, so if anyone can point me in the right place, that would be great.  

more than just /includes/modules/payment/paypal.php :cool:

Regards,

CKD
20 Mar 2008, 10:45 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: PayPal, Split the zip, zip1 zip2 for Japan

The following is based on using v1.3.8a version of /includes/modules/payment/paypal.php.
I've not checked PayPal's site for any documentation explaining the need which you describe. Thus, the following is based solely on your list of requirements:

Locate this section, around line 216:$optionsCust = array( 'first_name' => replace_accents($order->customer['firstname']), 'last_name' => replace_accents($order->customer['lastname']), 'address1' => replace_accents($order->customer['street_address']), 'city' => replace_accents($order->customer['city']), 'state' => zen_get_zone_code($order->customer['country']['id'], $order->customer['zone_id'], $order->customer['zone_id']), 'zip' => $order->customer['postcode'], 'country' => $order->customer['country']['iso_code_2'], 'email' => $order->customer['email_address'], ); if ($order->customer['suburb'] != '') $optionsCust['address2'] = $order->customer['suburb'];add this immediately after the above code:```
if ($order->customer['country']['iso_code_2'] == 'JP') {
$optionsCust['zip'] = substr($order->customer['postcode'], 0, 3);
$optionsCust['zip2'] = substr($order->customer['postcode'], 3);
}

This will take the zip/postal code that the customer used during account creation, and split it up into two separate pieces (zip = first 3 digits, zip2 = remaining digits) to send to PayPal.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Mar 2008, 11:27 AM
#3
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: PayPal, Split the zip, zip1 zip2 for Japan

@DrByte

Thank you so much for looking into this. I am having a hard time finding documentation on this. So maybe if you can point me in the right way.

I did what you said but when I check the source on paypal its still the same, which is kind of weird.

Here is the code I added below, you can see the lines before and after.

$order->customer['zone_id']),
                   'zip' => $order->customer['postcode'],
                   'country' => $order->customer['country']['iso_code_2'],
                   'email' => $order->customer['email_address'],
                   );
    if ($order->customer['suburb'] != '') $optionsCust['address2'] = $order->customer['suburb'];
        if ($order->customer['country']['iso_code_2'] == 'JP') {
      $optionsCust['zip'] = substr($order->customer['postcode'], 0, 3);
      $optionsCust['zip2'] = substr($order->customer['postcode'], 3);
    }
    if (MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED == 2) $optionsCust = array(

If you want I can send you a link to the site and give you a login and pass to use. I don't want to steal too much of your time, but I am just trying to make this a living thing in Japan, as it's currently kind of dead. A payment module like PayPal will help a ton for people in Japan along with making the pack more user friendly.

Regards,

CKD

20 Mar 2008, 11:30 AM
#4
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: PayPal, Split the zip, zip1 zip2 for Japan

right now I just tried removing it from the if statement so it did it no matter what, but still no go.

20 Mar 2008, 11:36 AM
#5
crystalkoi avatar

crystalkoi

Zen Follower

Join Date:
Apr 2007
Posts:
181
Plugin Contributions:
0

Re: PayPal, Split the zip, zip1 zip2 for Japan

I got the fix!

Thanks for putting me in the right spot

$optionsCust['zip'] = substr($order->customer['postcode'], 0, 3) . '-' . substr($order->customer['postcode'], 3);

thats what did the trick.