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!!

asked Dec 16, 2015 at 14:24
1
  • 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. Commented Dec 16, 2015 at 14:56

1 Answer 1

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.

answered Dec 16, 2015 at 18:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.