Product name should be cutted

Permalink Browser Info Environment
When product name is longer than 255 characters which is more than Paytrail api allows, payment will fail.

Something like this should fix it:
$title = $p->getProductName();
$title = strlen($title) > 255 ? substr($title, 0, 252)."..." : $title;

Type: Discussion
Status: Legacy: Invalid
codaone
View Replies:
Mainio replied on at Permalink Reply
Mainio
Hmm, not sure about that.

I just downloaded the latest version of core_commerce and in its db.xml the length of the prName column in the CoreCommerceProducts is 255 characters by maximum.

So, you shouldn't be able to even save product names longer than 255 characters.

I also tested this myself and I couldn't save a product name that is longer than 255 in the core_commerce add-on.

Best regards,
Antti Hukkanen
Mainio Tech Ltd.
codaone replied on at Permalink Reply
codaone
That is actually true. So this can be ignored.

We actually add extra stuff to the name and because of that it went over the character limit.

concrete5 Environment Information

Doesn't matter

Browser User-Agent String

Doesn't matter

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.