Posted By

cpres on 06/05/12


Tagged

jquery magento


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

WGenie
BrockSamsom


Magento Customer Saving Blocked by Phone #


 / Published in: jQuery
 

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

  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  

You need to login to post a comment.