1

I am creating a new custom product attribute and I would like it should by default be populated with the product name value that I can change it to something else later. Can I do this in magentos admin panel? If not how do i execute a script to do this for me. thanks!!

  • Nope, you won't be able to achieve it via admin only, you can register an event on catalog_prdouct_save_before, and check if product is new. If it is new, you can create value in your attribute with the product title. Just a brief solution. – Prateek Dec 16 '15 at 14:56
1

To set a specific value in a product attribute you can use a backend model. In this backend model it is possible to check if the attribute is empty to update and set the product name as value. If it's not empty no action is done. This will only work if you save all the products again. An other solution is to use the afterLoad of the backend model and add the same check there.

See http://magebase.com/magento-tutorials/using-a-backend-model-to-customize-magento-a-tip-from-magento-developers-paradise/ for more details about using a backend_model with an attribute.

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.