OXID Community Forum

> International Forums > Modules > Overwriting template block of third party module
Login
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Thread: Overwriting template block of third party module


Reply
 
Thread Tools Search this Thread Display Modes
#Top   #1  
Old 10-12-2016, 09:48 AM
magnussen magnussen is offline
Junior Member
Join Date: Oct 2016
Posts: 4
magnussen is on a distinguished road
Default 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!
Reply With Quote
#Top   #2  
Old 10-12-2016, 10:20 AM
Marco Steinhaeuser's Avatar
Marco Steinhaeuser Marco Steinhaeuser is offline
Community Manager @OXID
Join Date: Oct 2008
Posts: 12,674
Marco Steinhaeuser is on a distinguished road
Default Re: Overwriting template block of third party module

Hi,

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

Cheers
__________________
Marco
http://oxidforge.org
http://about.me/marco.steinhaeuser

Will ignore unsolicited support requests via PM, email or IM.
Reply With Quote
#Top   #3  
Old 10-12-2016, 11:01 AM
vanilla thunder's Avatar
vanilla thunder vanilla thunder is online now
Marco's Sidekick
Join Date: Nov 2010
Posts: 6,374
vanilla thunder is on a distinguished road
Default AW: Overwriting template block of third party module

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:
PHP Code:
        array(
            
'template' => 'page/checkout/payment.tpl',
            
'block'    => 'change_payment',
            
'file'     => '/application/views/blocks/heidelpay_change_payment.tpl',
            
'position' => 999
        
), 
Reply With Quote
#Top   #4  
Old 10-12-2016, 01:55 PM
magnussen magnussen is offline
Junior Member
Join Date: Oct 2016
Posts: 4
magnussen is on a distinguished road
Default Re: Overwriting template block of third party module

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:

original > {module b, module a}

instead of

original > module a > module b

The strange thing is that other blocks are correctly overwritten...
Reply With Quote
#Top   #5  
Old 10-12-2016, 05:58 PM
foxido.de foxido.de is offline
Senior Member
Join Date: Jul 2013
Posts: 1,129
foxido.de is on a distinguished road
Default Re: Overwriting template block of third party module

Maybe
Code:
[{$smarty.block.parent}]
__________________
Grüße

http://www.foxido.de/

- Modulentwicklung, Komplette Systeme, Beratung, Service

Tel: 02841-9161670

Deep-AutoSuggest, der neue Finder 4.6x 4.10.x und 90 weitere Module
Reply With Quote
#Top   #6  
Old 10-12-2016, 07:58 PM
magnussen magnussen is offline
Junior Member
Join Date: Oct 2016
Posts: 4
magnussen is on a distinguished road
Default Re: Overwriting template block of third party module

Actually, all correctly overwritten blocks do not have:
Code:
[{$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:
Code:
[{$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...
Reply With Quote
#Top   #7  
Old 10-12-2016, 08:12 PM
foxido.de foxido.de is offline
Senior Member
Join Date: Jul 2013
Posts: 1,129
foxido.de is on a distinguished road
Default Re: Overwriting template block of third party module

With
Code:
[{$smarty.block.parent}]
you only add and not overwrite and now i only can note the same as marco:...

Quote:
Originally Posted by Marco Steinhaeuser View Post
without seeing the code it is hard to check this issue, I reckon.
__________________
Grüße

http://www.foxido.de/

- Modulentwicklung, Komplette Systeme, Beratung, Service

Tel: 02841-9161670

Deep-AutoSuggest, der neue Finder 4.6x 4.10.x und 90 weitere Module

Last edited by foxido.de; 10-12-2016 at 09:21 PM. Reason: spelling mistake
Reply With Quote
#Top   #8  
Old 10-12-2016, 08:34 PM
magnussen magnussen is offline
Junior Member
Join Date: Oct 2016
Posts: 4
magnussen is on a distinguished road
Default Re: Overwriting template block of third party module

I see, thank you.
But considering such scenario:

original > module a > module b

the call
Code:
[{$smarty.block.parent}]
in Module B should add stuff from original, is that correct?
Reply With Quote
#Top   #9  
Old 10-12-2016, 09:26 PM
foxido.de foxido.de is offline
Senior Member
Join Date: Jul 2013
Posts: 1,129
foxido.de is on a distinguished road
Default Re: Overwriting template block of third party module

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.
__________________
Grüße

http://www.foxido.de/

- Modulentwicklung, Komplette Systeme, Beratung, Service

Tel: 02841-9161670

Deep-AutoSuggest, der neue Finder 4.6x 4.10.x und 90 weitere Module
Reply With Quote
Reply

Bookmarks

Tags
block, module, overwriting, party, template

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Nicht Sichtbar
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moduleinstellungen abfragen in Template Block des Moduls Anpan Module 3 04-13-2015 04:25 PM
Adding block to every template matheus Newbies 5 08-20-2014 05:49 PM
Admin Template Block überschreiben - keine Auswirkungen nightcoding Templates und Design 3 07-04-2014 02:48 PM
template block ooverride nisarg Templates and Design 2 02-01-2013 07:26 AM
Module is not overwriting proper hardikbadani Developers 4 06-20-2012 03:53 PM

All times are GMT +1. The time now is 05:16 PM.