A product has an attribute with a list of values A, B, C, ...

When saving the product, I want to compare the first letter of the product names with a list of attribute values. If the attribute value coincided with the first letter of the product, save this value.

How can I do that?



Creating an observer for catalog_product_save_before


In your observer

class MyNamespace_MyModule_Model_Observer {

public function catalog_product_save_before($observer)
    $product = $observer->getProduct();

    //check name
        //then set value


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.