Question

How to increase the limit of meta_description in magento1.9 .When we have import bulk of products during CSV then showing meta_description limit error.Please give me any solution?

Was it helpful?

Solution 2

This is worked for me. Firstly, run the following code to change the attributes from varchar to text and move them into the right tables. Make sure you back up your website and database first!

START TRANSACTION; 

SET @attribute_id = (SELECT attribute_id FROM eav_attribute WHERE entity_type_id = 4 AND attribute_code = "meta_description"); UPDATE eav_attribute SET frontend_class = 'validate-length maximum-length-2000' WHERE attribute_code = 'meta_description'; 

UPDATE eav_attribute SET backend_type = 'text' WHERE attribute_id = @attribute_id; UPDATE eav_attribute SET note = 'Maximum 2000 chars' WHERE attribute_code = 'meta_description'; 

INSERT INTO catalog_product_entity_text (entity_type_id, attribute_id, entity_id, store_id, value) SELECT entity_type_id, attribute_id, entity_id, store_id, value from catalog_product_entity_varchar WHERE attribute_id=@attribute_id AND entity_type_id=4; 

DELETE FROM catalog_product_entity_varchar where attribute_id = @attribute_id; 

COMMIT;

OTHER TIPS

You can manually change the meta_description field size by logging into database and then goto table eav_attribute.

Then change the backend_type to text from varchar. Default is varchar which is maximum of 255 characters. If you change this to text then it will work like the description and short description fields.

First of all here are some change releted to meta descriptions by google.

While Google showed snippets with long meta descriptions (around 320 characters) in the past few months, the snippets are now back to their old length (between 150 and 170 characters). A few weeks ago, we published the results of our research in which we experimented with long and short meta descriptions on Yoast.com. All of the long meta descriptions we added to articles on Yoast.com, that were visible in the search results pages earlier, are now all replaced by short ones. https://yoast.com/shorter-meta-descriptions/

Rather then do this manually in database you can create setup file in magento to update database

You can create file in your module on below path

company/module/sql/dbscript_setup/install-1.0.0.php

Here is more information related to setup script https://inchoo.net/magento/magento-install-install-upgrade-data-and-data-upgrade-scripts/

Here is the code that you can use to update backend type for meta_description

$installer = $this;

$installer->startSetup();

$installer->run("UPDATE `eav_attribute` SET `backend_type` = 'text' WHERE `eav_attribute`.`attribute_code` = 'meta_description' AND `eav_attribute`.`entity_type_id` = '4' ; ");

$installer->endSetup(); 
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top