Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento Ajax Static Block Call
    primarykey
    data
    text
    <p>folks.</p> <p>I've been searching for a solution but all I get is some fragments of what I need. I am trying to display some extra content on the footer. This content will be displayed when a footer link is clicked. I can do that easily with some code like:</p> <pre><code>&lt;!-- TRIGGER --&gt; &lt;li&gt;&lt;a href="javascript:void(0);" onclick="return abreInfo();"&gt;Sobre&lt;/a&gt;&lt;/li&gt; &lt;!-- CONTAINER --&gt; &lt;div id="infoShow"&gt; &lt;section&gt; ... &lt;/section&gt; &lt;/div&gt; &lt;!-- SCRIPT --&gt; &lt;script type="text/javascript"&gt; function abreInfo(id) { jQuery("#infoShow").slideDown('fast', function () { jQuery('html,body').animate({ scrollTop: jQuery("#infoShow").offset().top -54 }, 200); }); } &lt;/script&gt; </code></pre> <p>Although this is not actually what I need. Because the content inside the section needs to be a CMS Static Block, and there will be more than one Static Block to load, according to the footer link the user click (what I'm trying to do is a AJAX call of the footer links, like 'about', 'payment methods', 'delivery info', etc.). Unfortunately knowledge leads me to this kind of script:</p> <pre><code>function abreInfo(id) { jQuery("#infoShow").slideDown('fast', function () { jQuery('html,body').animate({ scrollTop: jQuery("#infoShow").offset().top -54 }, 200); jQuery("#infoShow&gt;section").load("&lt;?php echo $this-&gt;getLayout()-&gt;createBlock('cms/block')-&gt;setBlockId('" + id + "')-&gt;toHtml() ?&gt;", function () { }); }); } </code></pre> <p>But, as you may see, I am using a php echo inside javascript, disabling all the script. What I am not being able to resolute is a way to get the CMS Static Block ID by clicking on the 'a' element and printing it on the javascript function.</p> <p>Looking on the web, I've found a code that may be helpfull, but I am not pretty sure of how to deal with that:</p> <pre><code>$block_identifier = $_GET['id']; $block = Mage::app()-&gt;getLayout()-&gt;createBlock('cms/block')-&gt;setBlockId($block_identifier); </code></pre> <p>Any help will be appreciated.</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.
    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