Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As far as I can see the problem is that you specify your block in the "default" layout handle while most of the content in the "content" block is added by other layout handles which are applied later. That's why the added dependencies in your XML registration file (mentioned by Fabian) are not helping.</p> <p>Please consider these two options depending on your needs:</p> <h2>1. If you really want to include your block on all frontend pages</h2> <p>In your XML layout file (local.xml or a custom one), <strong>add a new layout handle</strong>:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;layout version="0.1.0"&gt; &lt;!-- your other adjustments for default, category_product_view and so on go here --&gt; &lt;add_my_block&gt; &lt;reference name="content"&gt; &lt;block type="mymod/blockname" name="myblockname" after="-" template="mymod/block.phtml"/&gt; &lt;/reference&gt; &lt;/add_my_block&gt; &lt;/layout&gt; </code></pre> <p>Now you <strong>create an event observer</strong> to inject your layout handle into your layout:</p> <pre><code> &lt;?php class YourCompany_YourExtension_Model_Observer { /** * Adds a block at the end of the content block. * * Uses the event 'controller_action_layout_load_before'. * * @param Varien_Event_Observer $observer * @return YourCompany_YourExtension_Model_Observer */ public function addBlockAtEndOfMainContent(Varien_Event_Observer $observer) { $layout = $observer-&gt;getEvent()-&gt;getLayout()-&gt;getUpdate(); $layout-&gt;addHandle('add_my_block'); return $this; } } </code></pre> <p>Then you <strong>register the event observer</strong> in your XML extension configuration file (config.xml):</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;config&gt; &lt;modules&gt; &lt;YourCompany_YourExtension&gt; &lt;version&gt;0.0.1&lt;/version&gt; &lt;/YourCompany_YourExtension&gt; &lt;/modules&gt; &lt;frontend&gt; &lt;events&gt; &lt;controller_action_layout_load_before&gt; &lt;observers&gt; &lt;mymod_add_block_at_end_of_main_content&gt; &lt;type&gt;singleton&lt;/type&gt; &lt;class&gt;mymod/observer&lt;/class&gt; &lt;method&gt;addBlockAtEndOfMainContent&lt;/method&gt; &lt;/mymod_add_block_at_end_of_main_content&gt; &lt;/observers&gt; &lt;/controller_action_layout_load_before&gt; &lt;/events&gt; &lt;!-- declaring your layout xml etc. --&gt; &lt;/frontend&gt; &lt;global&gt; &lt;!-- declaring your block classes etc. --&gt; &lt;models&gt; &lt;mymod&gt; &lt;class&gt;YourCompany_YourExtension_Model&lt;/class&gt; &lt;/mymod&gt; &lt;/models&gt; &lt;/global&gt; &lt;/config&gt; </code></pre> <p>Now your block should end up below the other blocks. I tested this successfully for the homepage, customer login page and category view page. If you have to exclude your block on a few pages, you can check in your event observer if the block should be excluded on that certain page.</p> <h2>2. If you want to include your block only on some pages</h2> <p><strong>Add a layout handle</strong> to your XML layout file just as we did before but instead of creating and registering an event observer, just <strong>tell your XML layout file to use the custom layout handle</strong> in some areas:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;layout version="0.1.0"&gt; &lt;catalog_category_default&gt; &lt;update handle="add_my_block" /&gt; &lt;/catalog_category_default&gt; &lt;catalog_category_layered&gt; &lt;update handle="add_my_block" /&gt; &lt;/catalog_category_layered&gt; &lt;cms_page&gt; &lt;update handle="add_my_block" /&gt; &lt;/cms_page&gt; &lt;!-- and so on --&gt; &lt;add_my_block&gt; &lt;reference name="content"&gt; &lt;block type="mymod/blockname" name="myblockname" after="-" template="mymod/block.phtml"/&gt; &lt;/reference&gt; &lt;/add_my_block&gt; &lt;/layout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    3. 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