- Posts: 256
- Thank you received: 2
Limit characters when user types in billing or delivery address
- dancingkazzaf
-
Topic Author
- Offline
Less
More
4 years 8 months ago #338794
by dancingkazzaf
-- url of the page with the problem -- :
www.restorationuk.com/
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.5
-- PHP version -- : 7.4.27
-- Browser(s) name and version -- : Chrome
Hello, We use Sagepay along with Hikashop but some of our payments cannot be verified by Sagepay due to the characters being too long on the billing or delivery addresses. Is there a way to limit characters a user can type in. Sagepay recommend maximum 50 characters.
Thanks.
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.5
-- PHP version -- : 7.4.27
-- Browser(s) name and version -- : Chrome
Hello, We use Sagepay along with Hikashop but some of our payments cannot be verified by Sagepay due to the characters being too long on the billing or delivery addresses. Is there a way to limit characters a user can type in. Sagepay recommend maximum 50 characters.
Thanks.
Please Log in or Create an account to join the conversation.
4 years 8 months ago #338796
by nicolas
Replied by nicolas on topic Limit characters when user types in billing or delivery address
We do have some code in the Sagepay plugin to limit the data sent to Sagepay.
However, I looked at the code and it uses a limit of 100 characters, not 50. So I can only think that Sagepay might have changed that limit at some point ?
You can open the file plugins/hikashoppayment/sagepay/sagepay.php via FTP and you'll find the code:
There, You can see several times 100 mentioned. If you replace 100 by 50 everywhere there, it will restrict the address to 50 characters instead of 100.
Please let us know how it goes so that we can include the changes on our end too.
However, I looked at the code and it uses a limit of 100 characters, not 50. So I can only think that Sagepay might have changed that limit at some point ?
You can open the file plugins/hikashoppayment/sagepay/sagepay.php via FTP and you'll find the code:
Code:
$address1 = ''; $address2 = '';
$address1 = @$order->cart->billing_address->address_street;
if( strlen($address1) > 100 ) {
$address2 = substr($address1, 100, 100);
$address1 = substr($address1, 0, 100);
}
$shipping_address = !empty($order->cart->shipping_address->address_firstname) ? $order->cart->shipping_address : $order->cart->billing_address;
$ship_address1 = ''; $ship_address2 = '';
$ship_address1 = @$shipping_address->address_street;
if( empty($ship_address1) ) { $ship_address1 = $address1; }
if( strlen($ship_address1) > 100 ) {
$ship_address2 = substr($ship_address1, 100, 100);
$ship_address1 = substr($ship_address1, 0, 100);
}
Please let us know how it goes so that we can include the changes on our end too.
Please Log in or Create an account to join the conversation.
- dancingkazzaf
-
Topic Author
- Offline
Less
More
- Posts: 256
- Thank you received: 2
4 years 8 months ago #338849
by dancingkazzaf
Replied by dancingkazzaf on topic Limit characters when user types in billing or delivery address
Hello,
Thankyou for getting back to me. That is strange they must have changed the limit recently then. I will get the plugin updated and see how I get on with orders.
Thanks
Thankyou for getting back to me. That is strange they must have changed the limit recently then. I will get the plugin updated and see how I get on with orders.
Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.180 seconds