cancel
Showing results for 
Search instead for 
Did you mean: 

Customer Account Information data in uppercase

Highlighted

Customer Account Information data in uppercase

is possible to change automatically Customer Account Information data written in lowercase to uppercase?

For example a client write is name jhon dole and i need change to Jhon Dole.

 

Regads!

6 REPLIES 6
Highlighted

Re: Customer Account Information data in uppercase

You could fairly easily write an observer that looks for events where that data is saved and update it using a PHP ucwords() call.   Perhaps look into the customer_save_before event.

 

Certified Plus Magento Developer | Top 50 Magento Contributor for 2017 | CEO/Founder at Jamersan | I make Magento videos at Ecommerce-aholic
Highlighted

Re: Customer Account Information data in uppercase

Hi,

thanks for you answer, but  could you explain in more detail how I can do this task?

Highlighted

Re: Customer Account Information data in uppercase

other option valid to me it´s all text in caps, how can make this task?

Highlighted

Re: Customer Account Information data in uppercase

Create Observer

 

Here is some info on creating the observer on the event you need.   In the observer file, just ucwords anything you need updated.  I haven't tested the code below....

 

$customer = $observer->getCustomer();

$customer->setData( 'first_name', ucwords($customer->getData('first_name'));
Certified Plus Magento Developer | Top 50 Magento Contributor for 2017 | CEO/Founder at Jamersan | I make Magento videos at Ecommerce-aholic
Highlighted

Re: Customer Account Information data in uppercase

If its only the display in account dashboard information you cared about, I suggest to modify template or css if possible, e.g.

<?php echo $this->htmlEscape(ucwords($this->getCustomer()->getName())) ?>

in customer/account/dashboard/info.phtml

Highlighted

Re: Customer Account Information data in uppercase

In case you are willing to uppercase addresses in order then this extension may help

 

https://redchamps.com/address-formatter-magento-2-extension.html