I kept looking for days to find a way to fill the product title (in the backend product add/edit form) field automatically based on values that i choose on different custom attributes.

  • 1
    The question is a bit unclear. Can you provide an example? – Marius May 27 '14 at 6:38
  • Yes, for example i have a tire as a product and i want to have its name generated as "Width/AspectRatio"R"RimSize Brand Model ..." where Width, AspectRatio, Rimsize, Brand and Model are Extra product attributes. So when i save the product its name gets filled with the attributes value that i have set. – aurel.dragut May 27 '14 at 7:04

You can observe the event catalog_product_save_before and construct the name based on the attributes you need.

Here is a small example on how the observer method could look.

public function generateName($observer) {
    $product = $observer->getEvent()->getProduct();
    $newName = $product->getWidth(). ' - '.$product->getAspectRatio().' - '....//all attributes you need
    return $this;

This could work if when you save the product from the backend, but I don't think it will work if you import products.

| improve this answer | |
  • Yeah that would be a good question, probably you have to save again every imported product or maybe "update attributes" might work. – aurel.dragut May 27 '14 at 7:37

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.