0

I have a booking system set up using Rooms.

The customer enters their phone number on checkout, which is a 5 number area code, followed by 6 other numbers. E.g. 01234 567 890.

The rooms at the hotel have a secure pin pad entry which is set to the last 6 digits of their phone number for their arrival.

As far as I can see there are two ways of doing this.

  1. Replace the phone nunber field with two fields, one for area code and one for the 6 digits, then send the 6 digits to the customer in a confirmation email. The only downside to this will be the existing customer phone numbers in the database will not fit the new fields, and also the validation of phone numbers used in the "Phone Number" module will not work for a split field.

  2. Create a way to only print the last 6 digits of the data in the phone number field. This seems like the best option, as it doesn't involve me having to edit the data for current bookings.

Can anyone explain to me how I might achieve option 2? Printing the last 6 digits in views etc would be easy enough, but I need to print the last 6 digits into an email template, and then send that email with rules. I have a token for [commerce-order:commerce-customer-billing:field-phone-number] that I can put into the confirmation email. Is there a way to trim the output of a token?

0

You could probably use the rules module with the "Execute custom PHP Code" option to execute a small php substr function.

You might need to enable the php filter module for this.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.