0

I have an extension that do layout update to push something to all pages headers. It worked so far for several clients and versions, but suddenly we got a client that just don't get the layout update.

  • We know the extension works because routes we added work.
  • We already checked with the client that extension output is not disabled in admin panel.
  • The client assured us they did clear cache in admin.
  • Its probably not because some full-page cache extensions (like varnish), because we tried accessing the pages with "?aaa=bbb" added to the URL and it still didn't work, and usually full-page caching solutions are URL-based.

And important point to note: this client manage two sites/stores on the same server (from the same admin), if that might affect anything...

Anyway... here's our layout xml:

app\design\frontend\base\default\layout\vendor\core.xml

<!-- Layout updates to inject vendor headers to all pages (include vendor js and page metadata). -->
<layout version="0.1.0">
    <default>
        <reference name="head">
                <block type="vendor_core/injectjs" name="vendor_js" as="vendor_js" template="vendor/injectjs.phtml" />
        </reference>
    </default>
</layout>

And here's the config.xml that apply this update:

<?xml version="1.0" encoding="UTF-8"?>
<config>

  <modules>
    <Vendor_Core>
      <version>1.0.0</version>
    </Vendor_Core>
  </modules>

  <global>
<models>
  <vendor_core>
    <class>Vendor_Core_Model</class>
  </vendor_core>
</models>

<helpers>
  <vendor_core>
    <class>Vendor_Core_Helper</class>
  </vendor_core>
</helpers>

<blocks>
  <vendor_core>
    <class>Vendor_Core_Block</class>
  </vendor_core>
</blocks>
  </global>

  <frontend>
    <layout>
      <updates>
        <vendor_core>
          <file>vendor/core.xml</file>
        </vendor_core>
      </updates>
    </layout>
    </frontend>
</config> 

Note that the company name was replaced with "vendor", so if you notice any typos there ignore them :)

Any ideas why the layout update might not work or how can I figure it out? I might get like an hour at the client's office to test things, but right now I don't have any access, just the code.

EDIT:

Added the phtml file:

app\design\frontend\base\default\template\vendor\injectjs.phtml

<?php if( $this->isEnabled() ): ?>

    <script type="text/javascript" id="vendor-src" <?php echo $this->getAsyncMode(); ?> src="<?php echo $this->getJsUrl(); ?>"></script>

<?php else: ?>

    <!-- Note: Vendor (<?php echo $this->getVersion(); ?>) is temporarily disabled via admin panel. -->

<?php endif; ?>
  • you skipped the boring stuff, but it's not that boring. it's actually important. – Marius May 23 '16 at 12:54
  • don't see why but added anyway. thanks! – Ronen Ness May 23 '16 at 12:56
  • 1
    Well your <frontend> tag is not closed. – Raphael at Digital Pianism May 23 '16 at 12:57
  • it is sorry it was removed when I pasted it in the question. fixed the question, thanks! – Ronen Ness May 23 '16 at 12:58
  • 1
    and does your injectjs block file exists and is name like this? Vendor/Core/Block/Injectjs.php ? – Marius May 23 '16 at 13:10
1

One possible issue could be that the page/html/head.phtml template has been modified and the following line has been removed/modified:

<?php echo $this->getChildHtml() ?>

Try to enable Template Hints under System > Configuration > Developers to find out the path of this template and ensure the line I mentioned has not been deleted.

To ensure that the problem does not come from your block, I suggest you should try adding your block to another block, for instance the after_body_start block:

    <reference name="after_body_start">
            <block type="vendor_core/injectjs" name="vendor_js" as="vendor_js" template="vendor/injectjs.phtml" />
    </reference>
  • 1
    So we just got a call from the client, they put one of the folders in the wrong place. what a relief :) I can't accept this solution but I learned from it so have my upvote. Thanks! – Ronen Ness May 23 '16 at 14:53
  • @Ness yeah, awesome glad you worked it out =) – Raphael at Digital Pianism May 23 '16 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.