OlenLja Posted October 18, 2016 Share Posted October 18, 2016 Hi! I need to automatic overwrite mobile phone number into special format before save to database. Where can I do it? In what controller or class? for example, user enter phone in format (XXX) XXX-XX-XX, and there is +38XXXXXXX in database. Link to comment Share on other sites More sharing options...
rocky Posted October 18, 2016 Share Posted October 18, 2016 If you've already got the mobile phone number being validated in (XXX) XXX-XX-XX format, I suggest overriding the add and update functions in classes/Address.php to check the format of the phone number is in +38XXXXXXX and change it if necessary before calling the parent function. Link to comment Share on other sites More sharing options...
bellini13 Posted October 18, 2016 Share Posted October 18, 2016 phone numbers are stored with the Address, not with the Customer, so you likely need to review the AuthController and the AddressController. That will cover new registration, as well as address updates after registration. Link to comment Share on other sites More sharing options...
OlenLja Posted October 18, 2016 Author Share Posted October 18, 2016 I use checkout in 1 step, and do I have to overwrite OrderOpcController? I don't understand what function I have to overwrite. Or do I have to overwrite Save and Update in Address class? Link to comment Share on other sites More sharing options...
rocky Posted October 19, 2016 Share Posted October 19, 2016 It depends whether you have the phone number validated in (XXX) XXX-XXX-XX format. If it isn't being validated in that format, you'll need to override AuthController and OrderOpcController controllers to add that validation. If it's already being validated, then you only need to override classes/Address.php to read and write the phone number in the right way. You'll need to override the __construct() function to remove the +38 and the add and update functions to add the +38. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now