Jump to content

How to create a new hook in default template?


Recommended Posts

1) Open PHPMyAdmin. search for your shop database and open it.
search for "ps_hook" table and open it.
Insert new Row and name it for example displayBeforeFooter .
 
2) open footer.tpl file and insert this:
{Hook::exec('displayBeforeFooter')}
 
 
right before:
			<div id="footer" class="grid_9 alpha omega clearfix">
				{$HOOK_FOOTER}
				{if $PS_ALLOW_MOBILE_DEVICE}
					<p class="center clearBoth"><a href="{$link->getPageLink('index', true)}?mobile_theme_ok">{l s='Browse the mobile site'}</a></p>
				{/if}
			</div>
  • Like 2
Link to comment
Share on other sites

Presta 1.5.4.1

 

have done all steps, but module don't want to insert in hook

 

maybe problem in footer.tpl:

<!-- Footer -->
			<div id="footer" class="grid_9 alpha omega clearfix">
				{$HOOK_FOOTER}
		
			</div>
		</div>
		{Hook::exec('displayBeforeFooter')}
	{/if}
	</body>
</html>

it is correct?

post-541242-0-73775900-1394707732_thumb.jpg

Edited by kotkotan (see edit history)
Link to comment
Share on other sites

it works!

have add this code to my general php module file (in this case lofnewproduct.php)

function hookdisplayBeforeFooter($params) {
		return $this->hookhome($params, 'displayBeforeFooter');
	}

and changed footer.tpl to this:

	{Hook::exec('displayBeforeFooter')}

<!-- Footer -->
			<div id="footer" class="grid_9 alpha omega clearfix">
				{$HOOK_FOOTER}
		
			</div>
						</div>
		{/if}
		</body>
</html>

it's works 100% thanks to vekia

Link to comment
Share on other sites

 

1) Open PHPMyAdmin. search for your shop database and open it.
search for "ps_hook" table and open it.
Insert new Row and name it for example displayBeforeFooter .
 
2) open footer.tpl file and insert this:
{Hook::exec('displayBeforeFooter')}
 
 
right before:

			<div id="footer" class="grid_9 alpha omega clearfix">
				{$HOOK_FOOTER}
				{if $PS_ALLOW_MOBILE_DEVICE}
					<p class="center clearBoth"><a href="{$link->getPageLink('index', true)}?mobile_theme_ok">{l s='Browse the mobile site'}</a></p>
				{/if}
			</div>

 

thanx mod

Link to comment
Share on other sites

maybe somebody know how to add to this new hook displayBeforeFooter another module which is coming in default template and called homefeatured

this is not working:

 

have add this code to my general php module file (in this case lofnewproduct.php)

function hookdisplayBeforeFooter($params) {
        return $this->hookhome($params, 'displayBeforeFooter');
    }
Link to comment
Share on other sites

 

you have to modify module code.

by default this module dont support this hook. so you have add function to handle it.

public function hookdisplayBeforeFooter($params) {
        return $this->hookhome($params);
    }

when i've add this code to homefeatured.php and mudule switch on, there are disappears my footer and another module hooked in displayBeforeFooter (previous)

Link to comment
Share on other sites

  • 2 weeks later...

Hello !

Work for my presta 1.5.6 but i have now problem. I use this for hook new module content box from this site http://contentbox.org/

 

I am getting error "Your text file is empty." wen i edit content of module!

 

Module work good wen is not pushed to newhook by code in file php of module

public function hookdisplayBeforeFooter($params) {
	return $this->hookDisplayHome($params);
	}

Some one help me please!

 

 

Ok! i install module after adding this code and working good

Edited by Joshuaadamo (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...