Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I extend CMS Block on save event of Magento?
    text
    copied!<p>I have this XML structure in my Alchemy Catalog Module:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!-- @filepath /app/code/local/Alchemy/Catalog/etc The XML has been extended following Magento Events API Observers http://www.excellencemagentoblog.com/magento-part11-series-eventsapi or http://blog.chapagain.com.np/magento-event-observer-with-save-before-and-save-after/ --&gt; &lt;config&gt; &lt;modules&gt; &lt;Alchemy_Catalog&gt; &lt;version&gt;0.1.0&lt;/version&gt; &lt;/Alchemy_Catalog&gt; &lt;/modules&gt; &lt;global&gt; &lt;models&gt; &lt;alchemycatalog&gt; &lt;rewrite&gt; &lt;product&gt;Alchemy_Catalog_Model_Product&lt;/product&gt; &lt;block&gt;Alchemy_Catalog_Model_Block&lt;/block&gt; &lt;/rewrite&gt; &lt;/alchemycatalog&gt; &lt;/models&gt; &lt;events&gt; &lt;!-- Examples: catalog_product_save_before, catalog_product_prepare_save Check out Magento events cheat sheet at http://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/ --&gt; &lt;catalog_product_save_after&gt; &lt;observers&gt; &lt;Alchemy_Catalog&gt; &lt;type&gt;singleton&lt;/type&gt; &lt;class&gt;Alchemy_Catalog_Model_Product&lt;/class&gt; &lt;method&gt;pingBaseProductService&lt;/method&gt; &lt;/Alchemy_Catalog&gt; &lt;/observers&gt; &lt;/catalog_product_save_after&gt; &lt;catalog_category_save_after&gt; &lt;observers&gt; &lt;Alchemy_Catalog&gt; &lt;type&gt;singleton&lt;/type&gt; &lt;class&gt;Alchemy_Catalog_Model_Product&lt;/class&gt; &lt;method&gt;pingBaseCategoryService&lt;/method&gt; &lt;/Alchemy_Catalog&gt; &lt;/observers&gt; &lt;/catalog_category_save_after&gt; &lt;cms_block_save_before&gt; &lt;observers&gt; &lt;Alchemy_Catalog&gt; &lt;type&gt;singleton&lt;/type&gt; &lt;class&gt;Alchemy_Catalog_Model_Block&lt;/class&gt; &lt;method&gt;rabbitmqBlockProducer&lt;/method&gt; &lt;/Alchemy_Catalog&gt; &lt;/observers&gt; &lt;/cms_block_save_before&gt; &lt;/events&gt; &lt;/global&gt; &lt;/config&gt; </code></pre> <p>and this model that should log a message to prove it works:</p> <pre><code>&lt;?php class Alchemy_Catalog_Model_Block extends Mage_Cms_Model_Block { /** * Implement function rabbitmqBlockProducer(). * This function writes a message to the rabbit * mq server */ protected $_eventPrefix = 'cms_block'; public function rabbitmqBlockProducer ($event) { Mage::log('save3 block invoked', null, 'marian.log'); } /** * Prevent blocks recursion * * @throws Mage_Core_Exception * @return Mage_Core_Model_Abstract */ protected function _beforeSave() { Mage::log('save2 block invoked', null, 'marian.log'); } } </code></pre> <p>But the <strong>rabbitmqBlockProducer()</strong> method never gets called. Note: The other methods for product and catalog work just fine.</p> <p>Any help fixing this or any other method will be appreciated</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload