MOD: Add word counter to meta descriptions & keywords

This has been requested a couple times so I decided to throw one together.



This modification will add a simple word counter under the Meta description and ([COLOR=DarkRed]optional[/COLOR]) Meta keyword input fields when adding or updating products.







Tested only on version 2.1.4 with IE8 and FF3.6 and ‘not completely’ so be prepared to revert if needed.



Requires:

1 template edit

1 file upload



Known issues:

When loading a product with existing words in these fields the counter will show 0 until a key is pressed in the field…

reserved

reserved



Possible issues:

May conflict with other javascript especially if you have other product option related addons.



Instructions:



Upload jquery.meta_counter.js to the /js directory



(Option 1) [COLOR=DarkRed]Skip to Option 2 below if you want description AND keyword word counters[/COLOR]





========= Meta Description Counter Only ===========



Template Edit



Open skins/yourskin/admin/views/products/update.tpl



Add this to the top of file

```php {script src=“js/jquery.meta_counter.js”}

{literal}


{/literal} ```find this line in same file

add this directly below it

Word Count : 0

Save file



!!! Clear Cache !!!



========

Finished

========





(Option 2)



========= Meta Description And Keyword Counters ===========



Template Edit



Open skins/yourskin/admin/views/products/update.tpl



Add this to the top of file

```php {script src=“js/jquery.meta_counter.js”}

{literal}




{/literal} ```find this line in same file
```php {$product_data.meta_description} ```add this directly below it
```php

Word Count : 0

```

find this line
```php {$product_data.meta_keywords} ```add this directly below it
```php

Word Count : 0

```Save file

!!! Clear Cache !!!


========
Finished
========

metawordcounter.zip

Thanks mate. But i am getting problem. when i enter words it is still showing counting 0

word.JPG

Thanks mate to accept my request :smiley:

This was a great idea, and I followed the instructions (that were very clear) to the letter, however the result is still



Word Count : 0



regardless of how many words I type in the SEO/Meta Meta description box in the product edit/add page.



I am using the 2.2.3 version and this was tested with 2.1.4 so I wander if this could be the reason.





Does anyone have any idea what could be wrong? Any help is appreciated

Well as I tried the mod, it seems in 2.1.4 that it only works when you type in the fields. If you save and return its always 0. I supose it reads only the keyboard and not the database table cells.



I dont find it annoying cause I need that only once, when I enter the fields. It could be fixxed if it could store the count in a cell on the db at the products table on a ceperate row.



Anyway thanks, it is a major improvment to the original cs-cart.