Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento: Update block position with before/after attribute from local.xml layout reference
    primarykey
    data
    text
    <p>I need to append the <code>before</code> attribute to a block via a layout update reference call.</p> <p>This is my <code>local.xml</code> file:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;layout version="0.1.0"&gt; &lt;default&gt; &lt;reference name="content"&gt; &lt;block type="page/html_wrapper" name="content.footer" as="contentFooter" translate="label" after="-"&gt; &lt;label&gt;Content Footer&lt;/label&gt; &lt;action method="setElementId"&gt;&lt;value&gt;content-footer&lt;/value&gt;&lt;/action&gt; &lt;action method="setElementClass"&gt;&lt;value&gt;clear&lt;/value&gt;&lt;/action&gt; &lt;/block&gt; &lt;/reference&gt; &lt;/default&gt; &lt;catalog_category_default&gt; &lt;reference name="breadcrumbs.container"&gt; &lt;action method="unsetChild"&gt;&lt;name&gt;category.title&lt;/name&gt;&lt;/action&gt; &lt;/reference&gt; &lt;reference name="content"&gt; &lt;block type="catalog/category_view" name="category.title" template="catalog/category/title.phtml" before="content.footer"/&gt; &lt;/reference&gt; &lt;/catalog_category_default&gt; &lt;/layout&gt; </code></pre> <p>My problem is, on the <code>content</code> block I create a <code>content.footer</code> block that you can assign widgets to in admin. I use <code>after="-"</code> on the <code>content.footer</code> block so in my mind, should put it ALWAYS at the bottom of the content block but this is not the case.</p> <p>When you view a catalog category and it inserts the <code>category.products</code> block in to the <code>content</code> block, it displays underneath the <code>content.footer</code> block. The only way to make it work is if I redefine it in my <code>local.xml</code> and include all the child blocks in <code>category.products</code>, and set before <code>before="content.footer"</code>.</p> <p>So I thought why can't I use a reference to <code>category.products</code> in the <code>catalog_category_default</code> layout and set the block's <code>before</code> attribute, I tried the following:</p> <pre><code>&lt;reference name="category.products"&gt; &lt;action method="setBefore"&gt;&lt;value&gt;content.footer&lt;/value&gt;&lt;/action&gt; &lt;/reference&gt; </code></pre> <p>Which had no affect.</p> <p>I also noticed the <code>setAttribute()</code> function in <code>Mage_Core_Block_Abstract</code> which saw it's just a wrapper for <code>setData()</code> but thought I would try it anyway, still nothing:</p> <pre><code>&lt;reference name="category.products"&gt; &lt;action method="setAttribute"&gt;&lt;key&gt;before&lt;/key&gt;&lt;value&gt;content.footer&lt;/value&gt;&lt;/action&gt; &lt;/reference&gt; </code></pre> <p>Is it possible to do what I want? Does before/after only apply to blocks in the same reference?</p>
    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. 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