gr4devel Posted May 22, 2013 Share Posted May 22, 2013 (edited) Hi community. Here's the problem: I've put an override > classes > Address.php in one of my modules because I need to set the phone a required field when creating an address. I've added the 'required' keyword to the $definition in the override of AddressCore. However it doesn't seem to be considered! I've already tried to delete the class_index.php in the cache directory but nothing changes... Can someone help me...I'm really frustrated Edited May 23, 2013 by gr4devel (see edit history) Link to comment Share on other sites More sharing options...
eleazar Posted May 22, 2013 Share Posted May 22, 2013 (edited) Why this complicated? Just open preferences --> customers in BO an activate phone number to make this a required field. This is why the help text tells you there: 'If you chose yes, your customer will have to provide at least one phone number to register.' Edited May 22, 2013 by eleazar (see edit history) Link to comment Share on other sites More sharing options...
gr4devel Posted May 22, 2013 Author Share Posted May 22, 2013 Thank you very much eleazar! Unfortunately my goal is to force the insertion of a valid phone when creating an address in the BO. In particular an address associated with a manufacturer. However let me thank you again for your help! Thanks !!! Link to comment Share on other sites More sharing options...
vekia Posted May 22, 2013 Share Posted May 22, 2013 you created override after installation? If so, you have to reinstall module ah problem solved, sorry, i marked this thread as solved regards Link to comment Share on other sites More sharing options...
gr4devel Posted May 23, 2013 Author Share Posted May 23, 2013 Sorry for the lateness of my response Vekia . You're right. I was trying to do the override after the module installation. However when I try to reinstall the module I get this error: The following module(s) were not installed properly: - mymoudulename : Unable to install override: Class AddressOverrideOriginal does not exist As always thank you very much for your patience and your precious help ! Link to comment Share on other sites More sharing options...
vekia Posted May 23, 2013 Share Posted May 23, 2013 hey, so the problem isn't solved? Link to comment Share on other sites More sharing options...
gr4devel Posted May 23, 2013 Author Share Posted May 23, 2013 Unfortunately it isn't solved Link to comment Share on other sites More sharing options...
vekia Posted May 23, 2013 Share Posted May 23, 2013 okay, so, can you show file with your override? I think that issue is with file Link to comment Share on other sites More sharing options...
gr4devel Posted May 23, 2013 Author Share Posted May 23, 2013 Sure here it is the Address.php that I placed inside my module override/classes/ dir. <?php class Address extends AddressCore { public static $definition = array( 'table' => 'address', 'primary' => 'id_address', 'fields' => array( 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_warehouse' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId', 'copy_post' => false), 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_state' => array('type' => self::TYPE_INT, 'validate' => 'isNullOrUnsignedId'), 'alias' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), 'company' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'required' => true, 'size' => 32), 'vat_number' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'address1' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'required' => true, 'size' => 128), 'address2' => array('type' => self::TYPE_STRING, 'validate' => 'isAddress', 'size' => 128), 'postcode' => array('type' => self::TYPE_STRING, 'validate' => 'isPostCode', 'size' => 12), 'city' => array('type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64), 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'required', 'size' => 32), 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'required', 'size' => 32), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateFormat', 'copy_post' => false), ), ); } The only thing that I changed is the required in phone and phone_mobile fields. Link to comment Share on other sites More sharing options...
gr4devel Posted May 24, 2013 Author Share Posted May 24, 2013 One thing. I'm having some difficulties also in doing an override of the AdminOrderControllerCore. I've placed my custom AdminOrderController.php file in the override/controllers/admin but it seems that it isn't considered at all . If I need to open another topic for this problem please let me know so that I can keep the forum clean and coherent . Link to comment Share on other sites More sharing options...
eleazar Posted May 25, 2013 Share Posted May 25, 2013 Did you delete /cache/class_index.php? This is crucial since 1.5.4x to make your changes happen. File will be automatically rebuild. 2 Link to comment Share on other sites More sharing options...
gr4devel Posted May 26, 2013 Author Share Posted May 26, 2013 Sorry eleazar for my incredibly late response . If I remove the /cache/class_index.php I get the following error when I load the FO: Fatal error: Call to undefined method Address::getFirstCustomerAddressId() in /media/data/dev/sites/vdp/vdp/classes/controller/FrontController.php on line 241 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