johnme Posted February 25, 2011 Share Posted February 25, 2011 Hi i edited in Home phone as a required field ...But i know know where to edit in address.php here the code i will paste here any one should help me <?php /* SSL Management */ $useSSL = true; include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); if (!$cookie->isLogged()) Tools::redirect('authentication.php'); //CSS ans JS file calls $js_files = array( _THEME_JS_DIR_.'tools/statesManagement.js' ); if ($back = Tools::getValue('back')) $smarty->assign('back', Tools::safeOutput($back)); if ($mod = Tools::getValue('mod')) $smarty->assign('mod', Tools::safeOutput($mod)); $errors = array(); if ($id_address = intval(Tools::getValue('id_address'))) { $address = new Address(intval($id_address)); if (Validate::isLoadedObject($address) AND Customer::customerHasAddress(intval($cookie->id_customer), intval($id_address))) { if (Tools::isSubmit('delete')) { if ($cart->id_address_invoice == $address->id) unset($cart->id_address_invoice); if ($cart->id_address_delivery == $address->id) unset($cart->id_address_delivery); if ($address->delete()) Tools::redirect('addresses.php'); $errors[] = Tools::displayError('this address cannot be deleted'); } $smarty->assign(array( 'address' => $address, 'id_address' => intval($id_address) )); } else Tools::redirect('addresses.php'); } if (Tools::isSubmit('submitAddress')) { $address = new Address(); $errors = $address->validateControler(); $address->id_customer = intval($cookie->id_customer); if (Configuration::get('PS_TOKEN_ENABLE') == 1 && strcmp(Tools::getToken(false), Tools::getValue('token')) && $cookie->isLogged() === true) $errors[] = Tools::displayError('invalid token'); if (!$country = new Country($address->id_country) OR !Validate::isLoadedObject($country)) die(Tools::displayError()); if (intval($country->contains_states) AND !intval($address->id_state)) $errors[] = Tools::displayError('this country require a state selection'); if (!sizeof($errors)) { if (isset($id_address)) { $country = new Country(intval($address->id_country)); if (Validate::isLoadedObject($country) AND !$country->contains_states) $address->id_state = false; $address_old = new Address(intval($id_address)); if (Validate::isLoadedObject($address_old) AND Customer::customerHasAddress(intval($cookie->id_customer), intval($address_old->id))) { if ($cart->id_address_invoice == $address_old->id) unset($cart->id_address_invoice); if ($cart->id_address_delivery == $address_old->id) unset($cart->id_address_delivery); if ($address_old->isUsed()) $address_old->delete(); else { $address->id = intval($address_old->id); $address->date_add = $address_old->date_add; } } } if ($result = $address->save()) { if ((bool)(Tools::getValue('select_address', false)) == true) { /* This new adress is for invoice_adress, select it */ $cart->id_address_invoice = intval($address->id); $cart->update(); } Tools::redirect($back ? ($mod ? $back.'&back;='.$mod : $back) : 'addresses.php'); } $errors[] = Tools::displayError('an error occurred while updating your address'); } } elseif (!$id_address) { $customer = new Customer(intval($cookie->id_customer)); if (Validate::isLoadedObject($customer)) { $_POST['firstname'] = $customer->firstname; $_POST['lastname'] = $customer->lastname; } } if (Tools::isSubmit('id_country') AND Tools::getValue('id_country') != NULL AND is_numeric(Tools::getValue('id_country'))) $selectedCountry = intval(Tools::getValue('id_country')); elseif (isset($address) AND isset($address->id_country) AND !empty($address->id_country) AND is_numeric($address->id_country)) $selectedCountry = intval($address->id_country); elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']); if (!Validate::isLanguageIsoCode($array[0]) OR !($selectedCountry = Country::getByIso($array[0]))) $selectedCountry = intval(Configuration::get('PS_COUNTRY_DEFAULT')); } else $selectedCountry = intval(Configuration::get('PS_COUNTRY_DEFAULT')); $countries = Country::getCountries(intval($cookie->id_lang), true); $countriesList = ''; foreach ($countries AS $country) $countriesList .= ''.htmlentities($country['name'], ENT_COMPAT, 'UTF-8').''; include(dirname(__FILE__).'/header.php'); $smarty->assign(array( 'countries_list' => $countriesList, 'countries' => $countries, 'errors' => $errors, 'token' => Tools::getToken(false), 'select_address' => intval(Tools::getValue('select_address')) )); Tools::safePostVars(); $smarty->display(_PS_THEME_DIR_.'address.tpl'); include(dirname(__FILE__).'/footer.php'); ?> Link to comment Share on other sites More sharing options...
johnme Posted February 25, 2011 Author Share Posted February 25, 2011 Any one please tell how to do Link to comment Share on other sites More sharing options...
shokinro Posted February 25, 2011 Share Posted February 25, 2011 in order to add new field, you need at least do following1. add field to database table ps_address2. add field to class /classes/Address.php for validation if you want3. add field to to address /address.php4. add field to field to theme file /themes/yourtheme/address.tpl Link to comment Share on other sites More sharing options...
johnme Posted February 25, 2011 Author Share Posted February 25, 2011 i am not adding fieldi just did work phone as a required in authtication.tpl .. i did it for work Phone * In address.php .. i dont know where to make required for work phone please help me Link to comment Share on other sites More sharing options...
johnme Posted February 25, 2011 Author Share Posted February 25, 2011 Hello any body can help me please help me its urgent Link to comment Share on other sites More sharing options...
shokinro Posted February 25, 2011 Share Posted February 25, 2011 Try to replace following line of file /classed/Address.phpbefore change protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city'); after change protected $fieldsRequired = array('id_country', 'alias', 'lastname', 'firstname', 'address1', 'postcode', 'city','phone'); Link to comment Share on other sites More sharing options...
johnme Posted February 25, 2011 Author Share Posted February 25, 2011 Great its work For me Can you tell me How to Replace Text Phone To FAX NumberThanks please help me Link to comment Share on other sites More sharing options...
shokinro Posted February 25, 2011 Share Posted February 25, 2011 you can change it at /themes/yourthem/address.tpl directly. Link to comment Share on other sites More sharing options...
johnme Posted February 26, 2011 Author Share Posted February 26, 2011 you can change it at /themes/yourthem/address.tpl directly. thanksI changed Text Home Phone To My FAX in Address.tpl and authication.tpl in theme root But Stil lShows Phone Text See images below i attached Link to comment Share on other sites More sharing options...
shokinro Posted February 26, 2011 Share Posted February 26, 2011 The best way to do this is to use the translate functionality of PrestaShop.Back officeToolsTranslationsSelect error messages and language from drop down listYou can do the same thing for the field name by choose "Field name" in the drop down list Link to comment Share on other sites More sharing options...
johnme Posted February 26, 2011 Author Share Posted February 26, 2011 The best way to do this is to use the translate functionality of PrestaShop.Back officeToolsTranslationsSelect error messages and language from drop down listYou can do the same thing for the field name by choose "Field name" in the drop down list Thanks a lot Thanks for help me my problem was sloved Link to comment Share on other sites More sharing options...
shokinro Posted February 26, 2011 Share Posted February 26, 2011 I am glad that it solved your problem.I noticed you added "(solved)" at the end of subject of your first post. The correct way is to add [sOLVED] to the beginning of the subject. ;-) Link to comment Share on other sites More sharing options...
Recommended Posts