0

I would like to generate the product SKU automatically for every product created in admin panel.

I have found this extension which works to generate the SKU based on product name and it's category, but I would like to change it in such a way where the firs 4 characters of the SKU are it's manufacturer name.

Can anyone help?

--> https://github.com/vijays91/Magento-Auto-SKU-Generator.git

1

I assume you modify the code based on that module, place the following codes after line 18 $new_sku = ""; in app/code/local/Learn/Autosku/Model/Observer.php:

$manufacturer_name = $product->getAttributeText('manufacturer');
if ($manufacturer_name.length > 0)
    $new_sku .= substr($manufacturer_name, 0, 4);

P.S: Depends on your requirement, if you don't wont to keep category name, comment out line 19-25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.