0

i want auto generation of meta description for my products liks this: Buy {product name} for Rs {price} at sitename.com | New Book | Authorised seller for {publihser}

0

1 Answer 1

0

Just create an observer on the event catalog_product_save_before with this code:

public function autoMetaDescription($observer) {
     $product = $observer->getEvent()->getProduct();
     $metaDescription = "Buy ". $product->getName()." for Rs ".number_format($product->getFinalPrice(), 2)." at sitename.com | New Book | Authorised seller for ". $product->getAttributeText('publisher');
    $product->setMetaDescription($metaDescription);
} 

Of course you may need some changes if the website is multilanguage. You have to check on which language you are saving the product.

4
  • @Dinesh see here how you can create an observer for an event.
    – Marius
    Commented Oct 21, 2014 at 7:28
  • which file i have to done modification
    – Dinesh
    Commented Oct 21, 2014 at 9:28
  • You don't need to edit any file. You need to create one. Check the tutorial I gave you to see how you should create an observer for an event. There is no point in replicating what is there
    – Marius
    Commented Oct 21, 2014 at 9:30
  • try this but not working can you tell some detail, i am not understanding tutorial so much for my use because i am new to magneto/programming
    – Dinesh
    Commented Oct 21, 2014 at 12:06

Your Answer

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

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