Superbegood31 Posted May 14, 2014 Share Posted May 14, 2014 (edited) Hello,Prestashop 1.6 includes a character counter for meta tags in SEO tab products sheets.Would it be possible to include this feature in all the pages where meta tags ?Does this not the countdown function in the template input_text_lang.tpl ?Thank you. Edited November 25, 2014 by SWITCHBOARD (see edit history) Link to comment Share on other sites More sharing options...
Superbegood31 Posted May 19, 2014 Author Share Posted May 19, 2014 up Link to comment Share on other sites More sharing options...
Superbegood31 Posted November 18, 2014 Author Share Posted November 18, 2014 re up Link to comment Share on other sites More sharing options...
Superbegood31 Posted November 25, 2014 Author Share Posted November 25, 2014 The solution for use characters counter for meta tags In fields_form modules controllers For meta_title Add 'maxchar' => 70 For meta_decription Add 'maxchar' => 160 For example : AdminCmsController.php array( 'type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'id' => 'name', // for copyMeta2friendlyURL compatibility 'lang' => true, 'required' => true, 'class' => 'copyMeta2friendlyURL', 'hint' => $this->l('Invalid characters:').' <>;=#{}', //'prefix' => 70, 'maxchar' => 70 array( 'type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'maxchar' => 160 That's all Link to comment Share on other sites More sharing options...
Superbegood31 Posted November 26, 2014 Author Share Posted November 26, 2014 New suggestion: Add a CSS class if it is exceeded maxchar Here is my function AddClasse function addClasse() { var maxchartitle = $('#meta_title_' + id_language + '_counter').text(); var maxchardescription = $('#meta_description_' + id_language + '_counter').text(); if (maxchartitle <= "0") { $('#meta_title_' + id_language + '_counter').addClass('seo-nok'); } else if (maxchardescription <= "0") { $('#meta_description_' + id_language + '_counter').addClass('seo-nok'); } else { $('#meta_title_' + id_language + '_counter').removeClass('seo-nok'); $('#meta_description_' + id_language + '_counter').removeClass('seo-nok'); } } But there are several problems :- The name of the ID variable is meta_title_4_counter or name_4_counter- When we delete characters the CSS class is removed only at position 2 If someone would have an idea... Thanks 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