Overwriting template block of third party module

Hi!

I am overwriting a template block of third part module with my custom one. In my metadata.php file I have all required fields plus “blocks” array. For all block .tpl files it works fine, except one. In this one case both blocks appear in the final template, though the original module’s should be overwritten with the custom block. I don’t really understand why all other blocks are overwritten except this one. Any idea why it happens? Any help would be much appreciated.

Cheers!

Hi,

without seeing the code it is hard to check this issue, I reckon.

Cheers

to completely overwrite other blocks you have to make sure, your block will be the last one.

original > module a > module b
in this szenario module b can overwrite block of module a

original > module b > module a
but here you will see both blocks from module b and module a (if it uses [{$smarty.block.parent}])

to make sure your block is the last one, you need to specify position for your block:


        array(
            'template' => 'page/checkout/payment.tpl',
            'block'    => 'change_payment',
            'file'     => '/application/views/blocks/heidelpay_change_payment.tpl',
            'position' => 999
        ),

Thank you for your answer.

I have already tested the case with ‘position’ field and the only difference is the appearance of the blocks. With ‘position’ value higher for my custom block it comes first and then the original after. But the original is not overwritten…

Any idea what might be the cause? It seems like the situation is following:

[B]original > {module b, module a}[/B]

instead of

[B]original > module a > module b[/B]

The strange thing is that other blocks are correctly overwritten…

Maybe

[{$smarty.block.parent}]

Actually, all correctly overwritten blocks [B]do not[/B] have:

[{$smarty.block.parent}]

inside.
Only the problematic template block contains this code.
To sum up: we have the original template with block ‘some_block’. Then there is a block in Module A - ‘some_block’ and Module B which overwrites ‘some_block’. Both blocks contain:

[{$smarty.block.parent}]

So the call to $smarty.block.parent in ‘some_block’ in Module B points to the original template or to the ‘some_block’ in Module A? Who actually is the parent of ‘some_block’ of Module B?

Clearly there is a problem here, as both template blocks with $smarty.block.parent call get injected into the final template…

With

[{$smarty.block.parent}] 

you only add and not overwrite and now i only can note the same as marco:…

[QUOTE=Marco Steinhaeuser;183196]
without seeing the code it is hard to check this issue, I reckon.
[/QUOTE]

I see, thank you.
But considering such scenario:

[B]original > module a > module b[/B]

the call

[{$smarty.block.parent}]

in [B]Module B[/B] should add stuff from [B]original[/B], is that correct?

I think this is only if it’s not overwritten in a. original is the parent of a und a is the parent of b, if the order is correct.