I want to make an automation that takes the web title of a product's page, and write this to the meta description section of the Magento's back end. How would that be posible ?
1 Answer
Not sure what your "web title" is, but you can do it in this way. It will set the metadescription on product save to product name.
in
config.xml
add an observer tocatalog_product_save_before
<catalog_product_save_before> <observers> <some_alias> <type>model</type> <class>your_module/observer</class> <method>setMetaDescriptionFromProductName</method> </some_alias> </observers> </catalog_product_save_before>
add this to
Observer.php
public function setMetaDescriptionFromProductName(Varien_Event_Observer $observer) { # adjust this to your needs $product = $observer->getProduct(); $product->setMetaDescription($product->getName()); return $this; }
If you want to generate meta data on the fly (without saving to product) you can use catalog_controller_product_view
event instead: see How to copy product information to meta information in Magento 1.9.2