0

Auto generate meta description for all products on Reindex data like this :Buy {product name} for Rs {price} at sitename.com | New Book | Authorised seller for {publihser}

  • There is no need to do this every time you reindex. Instead you can do this on product save. Listen for the product save before event and set the meta data then. In this way things will be more efficient. – Henry's Cat Oct 29 '14 at 11:17
  • @Woolfie i create a module on catalog_product_save_before this working when save product but not working for imported product – Dinesh Oct 29 '14 at 11:20
  • Sounds like you are on the right track. How are you importing products? – Henry's Cat Oct 29 '14 at 11:21
  • @Woolfie using external extension instead of magneto's default import – Dinesh Oct 29 '14 at 11:23
  • In that case you could write a module with a cron job that runs once in a while. This could them check the most recent product id, if new ones have arrived do the update as desired. You could store the last product id or do a query to find products created since last check. – Henry's Cat Oct 29 '14 at 11:25
1

It's easier to observe the catalog_product_save_after event. It's triggered after saving the product.

The observer would look something like

class [Namespace]_[Module]_Model_Observer
{
    public function saveInventoryData($observer)
    {
        $product = $observer->getEvent()->getProduct();

        $product->setMetaDescription(":Buy {$product->getName()} for Rs {$product->getPrice()} at sitename.com | New Book | Authorised seller for {$product->getPublisher()}");

        $product->save();
        return $this;
    }
}

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.