Posted By


cpres on 06/05/12

Tagged


Statistics


Viewed 636 times
Favorited by 1 user(s)

Magento Customer Saving Blocked by Phone #


/ Published in: jQuery
Save to your folder(s)

Annoyed by Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890. in admin? Here's the trick.
Copy over your default/default/template/customer/tab/addresses.phtml to your default/your-template/template/customer/tab/address.phtml


Copy this code and paste it in your HTML
  1. addressesModel.prototype = {
  2. initialize : function() {
  3. /*** in the initialization of the addressModel at the end right after bindCountryRegion I put the initilization for the overrideTelephone script I made. ***/
  4. this.bindCountryRegionRelation();
  5. this.overrideTelephone();
  6.  
  7. /*** Put this function somewhere in the mix where it suits your fancy ****/
  8.  
  9. // Used to override annoying telephone alerts while saving a customer in admin
  10. overrideTelephone: function() {
  11. var overrides = $(this.formContainer).getElementsByClassName('required-entry');
  12. for(var j in overrides) {
  13. if (overrides[j].id.indexOf("telephone") >= 0) {
  14. var phone = overrides[j].value.replace(/\D/g, '');
  15. if (phone != overrides[j].value) {
  16. overrides[j].value = phone;
  17. }
  18. if ( overrides[j].value == "") {
  19. overrides[j].value = "0000000000";
  20. }
  21. }
  22. }
  23. },

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.