Forums / Addon Payment Modules / Beanstream or CP Shipping Module? 64 Character Limit

Beanstream or CP Shipping Module? 64 Character Limit

Started by blackthorne on 5 Oct 2010, 11:28 AM · Views: 7,787

Results 1 to 20 of 25
5 Oct 2010, 11:28 AM
#1
blackthorne avatar

blackthorne

New Zenner

Join Date:
Jan 2010
Posts:
35
Plugin Contributions:
0

Beanstream or CP Shipping Module? 64 Character Limit

Hey guys...

Just had one transaction get refused by Beanstream. Error is as follows:

Shipping method must be less than 64 characters

  • Your credit card could not be authorized for this reason. Please
    correct the information and try again or contact us for further
    assistance.

So it turns out that the shipping option he has selected is:

Canada Post (1 box(es)) (Domestic Lettermail: estimated 2-4 business days):

OBVIOUSLY more than 64 characters...

Problem is I can't find where that is being generated. In my "/includes/languages/english/modules/shipping/canadapost.php"

I have already changed:

define('MODULE_SHIPPING_PACKAGING_RESULTS', ' box(es) to be shipped');

to:

define('MODULE_SHIPPING_PACKAGING_RESULTS', ' box(es)');

And I can't find any reference to this or a "Letter" module component in the Beasnstream payment module.

Any help directing me to where the shipping description is generated greatly appreciated!

5 Oct 2010, 11:38 AM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,751
Plugin Contributions:
56

Re: Beanstream or CP Shipping Module? 64 Character Limit

In ./includes/modules/payment/beanstream.php, try changing the two references to

$order->info['shipping_method']

to (say)

substr($order->info['shipping_method'], 0, 30);

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

5 Oct 2010, 12:31 PM
#3
blackthorne avatar

blackthorne

New Zenner

Join Date:
Jan 2010
Posts:
35
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

OK..I found the line but am code-weak and am not sure how to add what you suggested.

What I change it to:

'shipName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
                         'shipAddress1' => $order->delivery['street_address'],
                         'shipAddress2' => $order->delivery['suburb'],
                         'shipCity' => $order->delivery['city'],
                         'shipProvince' => $province_code_ship,
                         'shipPostalCode' => $order->delivery['postcode'],
                         'shipCountry' => $order->delivery['country']['iso_code_2'],
                        [B] 'substr($order->info['shipping_method'], 0, 30);[/B]

Original

'shipName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
                         'shipAddress1' => $order->delivery['street_address'],
                         'shipAddress2' => $order->delivery['suburb'],
                         'shipCity' => $order->delivery['city'],
                         'shipProvince' => $province_code_ship,
                         'shipPostalCode' => $order->delivery['postcode'],
                         'shipCountry' => $order->delivery['country']['iso_code_2'],
                         'shippingMethod' => $order->info['shipping_method'];

Is this how it's supposed to look?

5 Oct 2010, 12:57 PM
#4
blackthorne avatar

blackthorne

New Zenner

Join Date:
Jan 2010
Posts:
35
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

When I make the code changes I get this error:

Parse error: syntax error, unexpected '(', expecting ')' in /home/neitarms/public_html/includes/modules/payment/beanstream.php on line 338

in the administrator back end, Payment module page. Only three Authorize.net modules load, all the rest don't load.

This is my line 338:

'substr'($order->info['shipping_method'], 0, 30);

5 Oct 2010, 3:46 PM
#5
drbyte avatar

drbyte

Sensei

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

Re: Beanstream or CP Shipping Module? 64 Character Limit

No, you should have replaced ONLY EXACTLY what swguy told you, not the entire line.

.
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.

5 Oct 2010, 3:53 PM
#6
blackthorne avatar

blackthorne

New Zenner

Join Date:
Jan 2010
Posts:
35
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

OK. I just replaced the code, not the whole line.

Still get the same error:

Parse error: syntax error, unexpected ';', expecting ')' in /home/neitarms/public_html/includes/modules/payment/beanstream.php on line 338

Here is the code as it looks now:

if (isset($order->delivery['street_address']) && $order->delivery['street_address'] != '') {
      $shipping_data = array(
//                         'deliveryEstimate' => $order->delivery['shipping_method'],
                         'shipName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
                         'shipAddress1' => $order->delivery['street_address'],
                         'shipAddress2' => $order->delivery['suburb'],
                         'shipCity' => $order->delivery['city'],
                         'shipProvince' => $province_code_ship,
                         'shipPostalCode' => $order->delivery['postcode'],
                         'shipCountry' => $order->delivery['country']['iso_code_2'],
                         'shippingMethod' => substr($order->info['shipping_method'], 0, 30);
    } else {
      $shipping_data = array();
    }
    $extra_data = array(
                         'shippingMethod' => substr($order->info['shipping_method'], 0, 30),
                         'trnComments' => 'Website Order', // $order->info['comments'],
                         // Additional Merchant-defined variables go here
                         'ref1' => $_SESSION['customer_id'],
                         'ref2' => $order_time,
                         'ref3' => zen_get_ip_address(),
                         'ref4' => $sessID,
                         'customerIp' => zen_get_ip_address()
                          );
5 Oct 2010, 3:57 PM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,751
Plugin Contributions:
56

Re: Beanstream or CP Shipping Module? 64 Character Limit

The first changed line you have

'shippingMethod' => substr($order->info['shipping_method'], 0, 30);

change to:

'shippingMethod' => substr($order->info['shipping_method'], 0, 30)
);

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

5 Oct 2010, 4:01 PM
#8
blackthorne avatar

blackthorne

New Zenner

Join Date:
Jan 2010
Posts:
35
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

OK. I used Dreamweaver to figure out the error.

Line needed to be:

substr($order->info['shipping_method'], 0, 30));

Was missing bracket.

Code that lets me load the page is now:

if (isset($order->delivery['street_address']) && $order->delivery['street_address'] != '') {
      $shipping_data = array(
//                         'deliveryEstimate' => $order->delivery['shipping_method'],
                         'shipName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
                         'shipAddress1' => $order->delivery['street_address'],
                         'shipAddress2' => $order->delivery['suburb'],
                         'shipCity' => $order->delivery['city'],
                         'shipProvince' => $province_code_ship,
                         'shipPostalCode' => $order->delivery['postcode'],
                         'shipCountry' => $order->delivery['country']['iso_code_2'],
                         'shippingMethod' => substr($order->info['shipping_method'], 0, 30));
    } else {
      $shipping_data = array();
    }
    $extra_data = array(
                         'shippingMethod' => substr($order->info['shipping_method'], 0, 30),
                         'trnComments' => 'Website Order', // $order->info['comments'],
                         // Additional Merchant-defined variables go here
                         'ref1' => $_SESSION['customer_id'],
                         'ref2' => $order_time,
                         'ref3' => zen_get_ip_address(),
                         'ref4' => $sessID,
                         'customerIp' => zen_get_ip_address()
                          );

Will update after testing this evening.

Thanks folks!

5 Oct 2010, 4:03 PM
#9
blackthorne avatar

blackthorne

New Zenner

Join Date:
Jan 2010
Posts:
35
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

swguy:

In ./includes/modules/payment/beanstream.php, try changing the two references to

$order->info['shipping_method']

to (say)

substr($order->info['shipping_method'], 0, 30);

Thanks!

Can you tell me what this actually does? LOL

:D

5 Oct 2010, 4:28 PM
#10
drbyte avatar

drbyte

Sensei

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

Re: Beanstream or CP Shipping Module? 64 Character Limit

Sends only the first 30 characters of the shipping method.

.
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.

6 Oct 2010, 3:22 AM
#11
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,751
Plugin Contributions:
56

Re: Beanstream or CP Shipping Module? 64 Character Limit

Please let us know the status of your testing. Thanks!

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

30 Oct 2010, 7:15 PM
#12
bareoaks avatar

bareoaks

New Zenner

Join Date:
Oct 2010
Location:
East Gwillimbury, Ontario, Canada
Posts:
2
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

Brilliant! That solved my problem too!! Thank you very much!!!
:smile:

16 Nov 2010, 10:52 PM
#13
chrispritchard avatar

chrispritchard

New Zenner

Join Date:
Nov 2010
Posts:
4
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

Hello ... I'm getting the same error. I've followed your instructions and changed the two strings in beanstream.php:

'shippingMethod' => substr($order->info['shipping_method'], 0, 30)

but I'm still getting this error:

Shipping method must be less than 64 characters

  • Your INTERAC® card could not be authorized for this reason. Please correct the information and try again or contact us for further assistance.

I'm using version 1.3.9g and the Canada Post module. Site is located at https://www.mysocksrock.ca. The error doesn't occur when using the "Walk in" shipping method.

Any ideas how to fix this? Is it possible to change to 128 chars?

Thanks in advance,
Chris

16 Nov 2010, 11:50 PM
#14
chrispritchard avatar

chrispritchard

New Zenner

Join Date:
Nov 2010
Posts:
4
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

Okay, i fixed this. In /includes/classes/order.php I changed the following (line 614):

'shipping_method' => $this->info['shipping_method'],
TO
'shipping_method' => substr($order->info['shipping_method'], 0, 30),

This was in addition to the change suggested by swguy above.

Chris

15 Mar 2011, 12:50 AM
#15
ruffendz avatar

ruffendz

New Zenner

Join Date:
Oct 2009
Posts:
17
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

Hello...i have updated both files so that my code currently looks like this in /includes/modules/payment/beanstream.php:

   $shipping_data = array(
//                         'deliveryEstimate' => $order->delivery['shipping_method'],
                         'shipName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
                         'shipAddress1' => $order->delivery['street_address'],
                         'shipAddress2' => $order->delivery['suburb'],
                         'shipCity' => $order->delivery['city'],
                         'shipProvince' => $province_code_ship,
                         'shipPostalCode' => $order->delivery['postcode'],
                         'shipCountry' => $order->delivery['country']['iso_code_2'],
                         [B]'shippingMethod' => substr($order->info['shipping_method'], 0, 30)); [/B]    
    } else {
      $shipping_data = array();
    }
    $extra_data = array(
                         [B]'shippingMethod' => substr($order->info['shipping_method'], 0, 30));[/B]                         
                         'trnComments' => 'Website Order', 
                         // $order->info['comments'],
                         // Additional Merchant-defined variables go here
                         'ref1' => $_SESSION['customer_id'],
                         'ref2' => $order_time,
                         'ref3' => zen_get_ip_address(),
                         'ref4' => $sessID,
                         'customerIp' => zen_get_ip_address()
                          );

And My code looks like this in /includes/classes/order.php after I changed the recomended line 614:

'shipping_method' => substr($order->info['shipping_method'], 0, 30),

And i still get the error message:
•Shipping method must be less than 64 characters

  • Your INTERAC® card could not be authorized for this reason. Please correct the information and try again or contact us for further assistance.

I am Lost and dont know what else to change unless someone can see something that i am missing. Your help is greatly apprecated!

21 Mar 2011, 1:08 AM
#16
ruffendz avatar

ruffendz

New Zenner

Join Date:
Oct 2009
Posts:
17
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

Figured it all out...its all about the brakets and closing the open code!
:clap:

14 Nov 2011, 12:44 AM
#17
davidgylland avatar

davidgylland

New Zenner

Join Date:
Jun 2011
Posts:
10
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

This is how i solved the issue on my site. Go to \includes\modules\payment\beanstream.php and replace line of 656 to line 702 with the below code however I did not change the \includes\classes\order.php. Changing that file caused additional errors.

  $shipping_data = array(

// 'deliveryEstimate' => $order->delivery['shipping_method'],

                     'shipName' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],

                     'shipAddress1' => $order->delivery['street_address'],

                     'shipAddress2' => $order->delivery['suburb'],

                     'shipCity' => $order->delivery['city'],

                     'shipProvince' => $province_code_ship,

                     'shipPostalCode' => $order->delivery['postcode'],

                     'shipCountry' => $order->delivery['country']['iso_code_2'],

                     'shippingMethod' => substr($order->info['shipping_method'],0,30));

} else {

  $shipping_data = array();

}

$extra_data = array(

                      'shippingMethod' => substr($order->info['shipping_method'], 0, 30),

                     'trnComments' => 'Website Order', 
					 // $order->info['comments'],

                     // Additional Merchant-defined variables go here

                     'ref1' => $_SESSION['customer_id'],

                     'ref2' => $order_time,

                     'ref3' => zen_get_ip_address(),

                     'ref4' => $sessID,

                     'customerIp' => zen_get_ip_address()

                      );
11 May 2012, 4:57 PM
#18
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

Hello All,

I just had a call from a customer flagging this 64 character issue....I made the change to my beanstream.php file, uploaded it and now my beanstream module has disappeared from the admin and any order that used beanstream is a blank page. I tried reverting back to the original file and everything is still blank. Has anyone bumped into this or can someone please recommend a solution?

Any help is appreciated. Thank you.
Paul

11 May 2012, 5:08 PM
#19
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

kcb410:

Hello All,

I just had a call from a customer flagging this 64 character issue....I made the change to my beanstream.php file, uploaded it and now my beanstream module has disappeared from the admin and any order that used beanstream is a blank page. I tried reverting back to the original file and everything is still blank. Has anyone bumped into this or can someone please recommend a solution?

Any help is appreciated. Thank you.
Paul

Sorry Guys...panicked. I just downloaded the original file set and replaced my beanstream.php file and everything is okay.

17 May 2012, 5:42 PM
#20
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Re: Beanstream or CP Shipping Module? 64 Character Limit

swguy:

In ./includes/modules/payment/beanstream.php, try changing the two references to

$order->info['shipping_method']

to (say)

substr($order->info['shipping_method'], 0, 30);

Hello Everyone,

Does anyone know if this fix still works with Zen 139h? I notice it's a couple of years old.

I've tried it a couple of times and when I try to process a payment I just get a blank page.

Any help or comment would be appreciated. Thank you!

Zen 139h
PHP Version: 5.3.10
MySQL 5.0.95