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

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.

  • @Dinesh see here how you can create an observer for an event. – Marius Oct 21 '14 at 7:28
  • which file i have to done modification – Dinesh Oct 21 '14 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 Oct 21 '14 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 Oct 21 '14 at 12:06

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.