Osama Nashaat Posted September 15, 2017 Share Posted September 15, 2017 How Can I Change Field Label in Address Form as attached file Link to comment Share on other sites More sharing options...
El zorro Posted September 28, 2017 Share Posted September 28, 2017 I have the same problem! Link to comment Share on other sites More sharing options...
Aurelink_ Posted March 13, 2018 Share Posted March 13, 2018 I found a solution, it's not a good one but ... i went on my custom.js in themes/my_theme/js/ then i added $('#identity .field5 .form-control-label, #authentication .field5 .form-control-label').html('my_new_text'); yes, yes i changed my text with .html in jQuery be careful too select the good classes to avoid mistakes the hard part was to have a different class for my different field so i went to themes/my_theme/templates/customer/_partials/customer-form.tpl and created a variable that increase at every line. <form action="{$action}" id="customer-form" class="js-customer-form" method="post"> <section> {block "form_fields"} {assign var="number" value="0"} {foreach from=$formFields item="field"} {assign var=number value=$number+1} {block "form_field"} <div class="field{$number}"> {form_field field=$field} </div> {/block} {/foreach} {/block} </section> <footer class="form-footer clearfix"> <input type="hidden" name="submitCreate" value="1"> {block "form_buttons"} <button class="btn btn-primary form-control-submit pull-xs-right send_to_adresse" data-link-action="save-customer" type="submit"> {l s='Save' d='Shop.Theme.Actions'} </button> {/block} </footer> </form> with that i have differents variables for every lines and it's easier to target with css/js Good luck with that Link to comment Share on other sites More sharing options...
Rizzzle Posted August 12, 2019 Share Posted August 12, 2019 Bump. Link to comment Share on other sites More sharing options...
Kriter.io Posted March 13, 2020 Share Posted March 13, 2020 just use the TRANSLATION tool and give the name you prefer as a translation Link to comment Share on other sites More sharing options...
doncamillo Posted December 7, 2020 Share Posted December 7, 2020 same problem... I need to rename one of the label but there is not in TRANSLATION tool, any lang file or in databeses. any solution? Link to comment Share on other sites More sharing options...
Surffari Posted October 26, 2023 Share Posted October 26, 2023 On 12/7/2020 at 9:22 PM, doncamillo said: same problem... I need to rename one of the label but there is not in TRANSLATION tool, any lang file or in databeses. any solution? Go to translations or edit directly the table ps_translation. Edit or add a row (one for each language) where: - id_lang id of the langauge - key: Address - translation: "whatever you want the label to be in the desired language" - domain: ShopFormsLabels - theme: your theme Here 1 is EN and 7 is NL for me, yours might differ Link to comment Share on other sites More sharing options...
Skate3 Posted March 24 Share Posted March 24 However, neither the TRANSLATION tool nor any lang file nor the data files contain a rename for one of the labels. Link to comment Share on other sites More sharing options...
Hoda245 Posted March 24 Share Posted March 24 same problem here... Any proper solution for it??? Link to comment Share on other sites More sharing options...
Paul C Posted March 27 Share Posted March 27 (edited) On 3/24/2024 at 11:47 AM, Hoda245 said: same problem here... Any proper solution for it??? Depends on how you define "proper" Here's an example module that can rename the registration field labels and make them translatable at the same time. <root>/modules/formlabelmangler.php <?php /** * Module Name: formlabelmangler * Description: Example code to show how to modify field labels * Version: 8.0.0 * @author: Paul Campbell [https://www.prestashop.com/forums/profile/11264-paul-c/] * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ declare(strict_types=1); if (!defined('_PS_VERSION_')) { exit; } class formlabelmangler extends Module { /** @var array */ private $hooks; /** * @param string|null $name (Deprecated parameter) * @param Context|null $context * @return void */ public function __construct() { $this->name = 'formlabelmangler'; $this->tab = 'front_office_features'; $this->author = 'PaulC'; $this->version = '8.0.0'; parent::__construct(); $this->displayName = $this->trans('Fun with forms and hooks.', [], 'Modules:formlabelmangler.Admin'); $this->description = $this->trans('Modify field names on customer registration form.', [], 'Modules.formlabelmangler.Admin'); $this->ps_versions_compliancy = array('min' => '1.7.0', 'max' => _PS_VERSION_); // Hooks to install to $this->hooks = [ 'additionalCustomerFormFields' ]; } /** * Install and hook module. * @return bool True on success, False if an error is encountered */ public function install() { return parent::install() && $this->registerHook($this->hooks); } /** * Respond whether the module uses the new translation system. * * @return bool */ public function isUsingNewTranslationSystem(): bool { return true; } /** * Inject additional customer registration fields and/or manipulate existing * Hook::exec('additionalCustomerFormFields', ['fields' => &$format], null, true) * @see https://github.com/PrestaShop/PrestaShop/blob/develop/classes/form/FormField.php * * @param array FormField &$arguments['fields'] any additional data * @return array The field definitions to be rendered * */ public function hookAdditionalCustomerFormFields(array $arguments) : array { // The current fields which are set can be retrieved with the following // since the data is passed by reference. $fields = $arguments['fields']; // Uncomment the following if you want to record the current field details in the // PHP error log for reference. //error_log('We got ourselves some fields to play in: '. print_r($fields, true)); // In this example we want to spruce up the 'email' field and call it "Email Address" // instead of just plain old "Email". foreach ($fields as $field) { if ($field->getName() == 'email') { $field->setLabel( $this->trans( 'Email Address', [], 'Shop.Forms.Labels' )); } } // This is where you would return any additional fields you want to create return []; } } This has been tested with 8.1.4 but should be fine for 1.7.0+ php7+ Edited March 27 by Paul C fixed typos (see edit history) 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