0

I've installed a module which explicitly describes that the layout should be updated in order to see the template file. I've done this, but it's still not showing and I can't figure out why.

Here is the module's config.xml

<?xml version="1.0"?>
...
<frontend>
    <layout>
        <updates>
            <locator>
                <file>van.xml</file>
            </locator>
        </updates>
    </layout>
</frontend>
...

This is what's found in design/frontend/default/default/layoutvan.xml:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <checkout_cart_index>
         <reference name="checkout.cart">
              <block type="core/template" name="extra_block" template="van/customcoupon.phtml" />
         </reference>
    </checkout_cart_index>
</layout>

I'm using the fortis theme by Infortis and copied the frontend/fortis/defaul/template/checkout/cart.phtml to the fortis//.../cart.phtml and added <?php echo $this->getChildHtml('extra_block'); ?> to this theme just beneath the coupon section, like so:

<div class="cart-left-column grid12-8 no-left-gutter">
    <?php if ($tmpHtml = $this->getChildHtml('checkout.cart.extra')): ?>
        <div class="grid-full no-gutter">
            <?php /* Extensions placeholder */ ?>
            <?php echo $tmpHtml; ?>
        </div>
    <?php endif; ?>

    <?php if ($tmpHtml = $this->getChildHtml('block_cart_below_table')): ?>
        <div class="block_cart_below_table grid-full no-gutter"><?php echo $tmpHtml; ?></div>
    <?php endif; ?>

    <div class="grid12-6 no-left-gutter mobile-grid-half">
        <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
    </div>
    <div class="grid12-6 no-right-gutter mobile-grid-half">
        <?php echo $this->getChildHtml('coupon') ?>
        <?php echo $this->getChildHtml('extra_block'); ?> // this is the line I've added
    </div>
    <div class="grid-full no-gutter">
        <?php echo $this->getChildHtml('crosssell') ?>
    </div>
</div>

I've flushed the caches multiple times but the template is not loaded. I've also tried adding an output="toHtml" to it, as well as before="-" and after="-", I've also tried giving it an alias and using that, just to be sure, but this also doesn't work.

When I add some random text just above/below <?this->getChildHtml... ?> it comes through, but the template itself isn't loaded. Does anybody know why this might be?

Note: the coupon section is also not showing up for some reason.

2 Answers 2

0

Your files should looks like this :

app/code/local/Company/Module/etc/config.xml

<?xml version="1.0" ?>
...
<frontend>
    <layout>
        <updates>
            <company_module>
                <file>company_module.xml</file>
            </company_module>
        </updates>
    </layout>
</frontend>
...

app/design/frontend/{package}/{theme}/layout/company_module.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <checkout_cart_index>
         <reference name="root">
              <block type="core/template" name="extra_block" template="van/customcoupon.phtml" />
         </reference>
    </checkout_cart_index>
</layout>

Then you call your block in cart.phtml like this:

<?php echo $this->getBlockHtml('extra_block'); ?>

0

Okay, so I've found the problem: everything I did so far was correct, but the module itself has placed everything in the default/default theme and since we use a custom theme, it didn't load the files at all. So what I did was just copy the files to my theme and it just worked.

It goes to show the devil is in de details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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