Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like you're using the wrong layout handle, although it's easy to see why folks would get tripped up by this. </p> <p>If I <a href="http://store.pulsestorm.net/products/commerce-bug-2" rel="nofollow noreferrer">use Commerce Bug to view the layout handles</a> (self link, Commerce Bug is the commercial debugging extension I created and sell) for that page, I see the following</p> <p><img src="https://i.stack.imgur.com/IE1ok.png" alt="enter image description here"></p> <p>So that's <code>admin_catalog_category_edit</code> instead of <code>admin_catalog_category_index</code>.</p> <p>Why <code>edit</code> instead of <code>index</code>? If I use <a href="http://store.pulsestorm.net/products/commerce-bug-2" rel="nofollow noreferrer">Commerce Bug's</a> Request tab to find the controller file</p> <p><img src="https://i.stack.imgur.com/Th6nE.png" alt="enter image description here"></p> <p>and then look at the index action method.</p> <pre><code>#File: app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php public function indexAction() { $this-&gt;_forward('edit'); } </code></pre> <p>Ah ha! The <code>indexAction</code> method forwards to the <code>edit</code> action. When you forward a request in Magento, you're saying</p> <blockquote> <p>Hey Magento, let's pretend the request used <strong>this</strong> action method instead of the actual action method, <strong>without</strong> doing an HTTP redirect.</p> </blockquote> <p>Assuming your Layout XML is in the correct file, change your <code>admin_catalog_category_index</code> handle to <code>admin_catalog_category_edit</code> and you'll be good to go. </p> <p><strong>Update</strong>: Assuming, of course, you don't want to update the content block.<br> The other problem with the category editing page is, when the page load it replaces its content area with an AJAX request. When I added the following to <code>local.xml</code></p> <pre><code>&lt;layout&gt; &lt;admin_catalog_category_index&gt; &lt;reference name="content"&gt; &lt;!-- &lt;block type="categorysearch/adminhtml_categorysearch_search" name="categorysearch" /&gt; --&gt; &lt;block type="core/text" name="WednesdayApril32013"&gt; &lt;action method="setText"&gt; &lt;text&gt;This is a test&lt;/text&gt; &lt;/action&gt; &lt;/block&gt; &lt;/reference&gt; &lt;/admin_catalog_category_index&gt; &lt;/layout&gt; </code></pre> <p>The text "This is a test" was rendered in the page source (<code>View -&gt; Developer -&gt; View Source</code> in Chrome). However, Magento immediately makes a background ajax request to a URL something like this</p> <pre><code>http://store.example.com/index.php/admin/catalog_category/edit/key/c184cfd77dcf298659d1cb3a31c51852/section/general/?isAjax=true </code></pre> <p>and replaces the content section. If we take another look at the controller</p> <pre><code> #File: app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php if ($this-&gt;getRequest()-&gt;getQuery('isAjax')) { // prepare breadcrumbs of selected category, if any $breadcrumbsPath = $category-&gt;getPath(); if (empty($breadcrumbsPath)) { // but if no category, and it is deleted - prepare breadcrumbs from path, saved in session $breadcrumbsPath = Mage::getSingleton('admin/session')-&gt;getDeletedPath(true); if (!empty($breadcrumbsPath)) { $breadcrumbsPath = explode('/', $breadcrumbsPath); // no need to get parent breadcrumbs if deleting category level 1 if (count($breadcrumbsPath) &lt;= 1) { $breadcrumbsPath = ''; } else { array_pop($breadcrumbsPath); $breadcrumbsPath = implode('/', $breadcrumbsPath); } } } Mage::getSingleton('admin/session') -&gt;setLastViewedStore($this-&gt;getRequest()-&gt;getParam('store')); Mage::getSingleton('admin/session') -&gt;setLastEditedCategory($category-&gt;getId()); // $this-&gt;_initLayoutMessages('adminhtml/session'); $this-&gt;loadLayout(); $eventResponse = new Varien_Object(array( 'content' =&gt; $this-&gt;getLayout()-&gt;getBlock('category.edit')-&gt;getFormHtml() . $this-&gt;getLayout()-&gt;getBlock('category.tree') -&gt;getBreadcrumbsJavascript($breadcrumbsPath, 'editingCategoryBreadcrumbs'), 'messages' =&gt; $this-&gt;getLayout()-&gt;getMessagesBlock()-&gt;getGroupedHtml(), )); Mage::dispatchEvent('category_prepare_ajax_response', array( 'response' =&gt; $eventResponse, 'controller' =&gt; $this )); $this-&gt;getResponse()-&gt;setBody( Mage::helper('core')-&gt;jsonEncode($eventResponse-&gt;getData()) ); return; } </code></pre> <p>We can this this ajax request is handled outside of the normal layout rendering flow.</p> <p>So, with this additional knowledge, I'd create an event listener for <code>category_prepare_ajax_response</code>, and then add your content to the response object that's passed in</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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