Size SKU in Magento

latvian picture latvian · Jan 18, 2010 · Viewed 8.6k times · Source

How can I allow SKU be longer than 34 characters (for simple products) for all products?

When i add new product(simple) and enter more than 34 characters, Magento cuts it to 34 after saving.

In the database the 'sku' attributes ( for quete item,order item,invoice item, shipment item) from eav_attribute table hold varchar(255). For Catalog_Product_Entity the attributed is VarChar(64). In either case, it is more than 34characters. Thus, I could change SKU to 64 characters without making any change in database, correct?

How do i do that? I have good understanding of the user side magento code, but not Admin side. Can you suggest me good tutorial on making changes in Admin side that could help me figure this question myself.

Thank you, Margots

Answer

David Riddell picture David Riddell · Jan 17, 2012

There's more to it than this even....

Change SKU field in: catalog_product_entity to varchar(255) Change SKU field in: catalog_product_flat_some_number to varchar(255)

And then you will have to edit the Sku.php so the validation wont trigger in the admin.

Change: const SKU_MAX_LENGTH = 64;

to: const SKU_MAX_LENGTH = 255;

That will allow the max_length to be 255 instead of 64.. make it whatever you'd like.