Jump to content

Get rid of Homepage Tabs


Recommended Posts

Hi, anyone knows how do I get rid of the homepage tabs? I want to display new products and best sellers block one after another.

 

I've tried to hook these blocks into displayHome - but it seems I cant hook these modules into displayHome.

 

Any ideas? Thanks!

Link to comment
Share on other sites

hello

 

unhook these modules from:

displayHomeTabContent

displayHomeTab

 

and attach them to

displayHome

 

Unfortunately this is not possible. In order to hook them to displayHome it would be necessary to add this hook to homefeatured.php in the module folder /modules/homefeatured/

 

The only hook that is allowed here is displayHomeTab. In order to being able to hook the module to displayHome it would be necessary to add another line

    || !$this->registerHook('displayHome')

 

2014-03-19_0902.png

Link to comment
Share on other sites

it's not necessary to register hook, you can just simply transplant modules without registerhook,

the only one thing that is necessary is a function to handle this hook.

but in fact - this function already exists, so all you have to do is just simple transplantation in back office without any kind of modification in module .php file.

  • Like 1
Link to comment
Share on other sites

Unfortunately this is not possible. In order to hook them to displayHome it would be necessary to add this hook to homefeatured.php in the module folder /modules/homefeatured/

 

The only hook that is allowed here is displayHomeTab. In order to being able to hook the module to displayHome it would be necessary to add another line

    || !$this->registerHook('displayHome')

 

2014-03-19_0902.png

it's not necessary to register hook, you can just simply transplant modules without registerhook,

the only one thing that is necessary is a function to handle this hook.

but in fact - this function already exists, so all you have to do is just simple transplantation in back office without any kind of modification in module .php file.

Link to comment
Share on other sites

 

it's not necessary to register hook, you can just simply transplant modules without registerhook,

the only one thing that is necessary is a function to handle this hook.

but in fact - this function already exists, so all you have to do is just simple transplantation in back office without any kind of modification in module .php file.

 

 

vekia, what function do you mean? When I tried to hook homefeatured to displayHome I got the message that the module could not be hooked to this position. This is why I added the hook to homefeatured.php. Then it was possible to hook it to displayHome.

Link to comment
Share on other sites

vekia, what function do you mean? When I tried to hook homefeatured to displayHome I got the message that the module could not be hooked to this position. This is why I added the hook to homefeatured.php. Then it was possible to hook it to displayHome.

 

The same thing happened when I did it. Vekia, were you able to correctly transplant? is it different in 1.6 version than 1.5?

Link to comment
Share on other sites

The same thing happened when I did it. Vekia, were you able to correctly transplant? is it different in 1.6 version than 1.5?

Of course that i tested it in 1.6 :)

 

and yes, im able to transplant it without any modification of module file, it's because function hookdisplayHome already exists in this addon (from 1.5 release)

	public function hookDisplayHome($params)
	{
		if (!$this->isCached('homefeatured.tpl', $this->getCacheId()))
		{
			$this->_cacheProducts();
			$this->smarty->assign(
				array(
					'products' => HomeFeatured::$cache_products,
					'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
					'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
				)
			);
		}

		return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId());
	}

To transplant addon it's not necessary to register hook. The only one requirement is function to handle this hook.

 

 

 

check video (i recorded it especially for this case)

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

hello

 

unhook these modules from:

displayHomeTabContent

displayHomeTab

 

and attach them to

displayHome

What if you don't have these in your positions? I upgraded from 1.5 but these are missing entirely.

 

Thanks much in advance!

Z

Link to comment
Share on other sites

Hi,

I would like to know how I can move the "displayHome" module just above the "displayHomeTabs".

Is there any way to do it?

 

Thanks in advance!

Tolo

Yes , it is possible. Unfortunately not from backoffice. You will need to modify the INDEX.TPL inside your theme folder.

There are two hooks . First the HomeTabs then displayHome. Just invert them. 

So to make things clearer here is the default index.tpl :

{if isset($HOOK_HOME_TAB_CONTENT) && $HOOK_HOME_TAB_CONTENT|trim}
    {if isset($HOOK_HOME_TAB) && $HOOK_HOME_TAB|trim}
        <ul id="home-page-tabs" class="nav nav-tabs clearfix">
			{$HOOK_HOME_TAB}
		</ul>
	{/if}
	<div class="tab-content">{$HOOK_HOME_TAB_CONTENT}</div>
{/if}
{if isset($HOOK_HOME) && $HOOK_HOME|trim}
	<div class="clearfix">{$HOOK_HOME}</div>
{/if}

you will have to invert them to :

{if isset($HOOK_HOME) && $HOOK_HOME|trim}
	<div class="clearfix">{$HOOK_HOME}</div>
{/if}
{if isset($HOOK_HOME_TAB_CONTENT) && $HOOK_HOME_TAB_CONTENT|trim}
    {if isset($HOOK_HOME_TAB) && $HOOK_HOME_TAB|trim}
        <ul id="home-page-tabs" class="nav nav-tabs clearfix">
			{$HOOK_HOME_TAB}
		</ul>
	{/if}
	<div class="tab-content">{$HOOK_HOME_TAB_CONTENT}</div>
{/if}

And magic ... they are inverted :D

 

Happy shopping. Rate if you find it usefull.

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

I also would like to change the order of the tabs on the home page - as in post #11. And perhaps add more ...

 

But I have no section for displayHomeTabs so have nowhere to be able to switch positions. They aren't there in my install of v1.6.0.6 - the positions list goes from displayHome to displayInvoice. Where can I find the positions to change over?

Link to comment
Share on other sites

So, I tried both adding the hook code in the tpl file as suggested at the beginning of this topic, and also checked the hooks table, nothing will work. The home featured products yes, they can be hooked into displayHome without problem, but not the best sellers block. 

 

So is there any other way to display the New products and the featured products below each other, instead of tabbed?

Link to comment
Share on other sites

  • 2 weeks later...

What about if the situation is opposite. I did reset "home featured products", "new products" and "best sellers" modules and since that time home page tabs doesn't work any more. All of those modules display under themselves.

 

I can not add "best sellers" product to homepagetab as well :D

Link to comment
Share on other sites

prestashop 1.6 doesnt allow to display these modules in displayHome tab

it's because modules support only displayHomeTabContents only.

 

if you want to move these modules there it's necessary to modify these modules.

for exmaple ,for new products you can use this one:

http://www.prestashop.com/forums/topic/278949-free-module-homepage-featured-new-products-block/

but it's not fully ready for 1.6

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

The same thing happened when I did it. Vekia, were you able to correctly transplant? is it different in 1.6 version than 1.5?

I have same problem , I cant transplant the hook. Im trying to get block On Sale products on home page tab , just next to the New products. Actually non of the blocks can be hooked there. Always get the same Red answer. Cant be hooked.:-( My be need to check something somewhere?

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

hello

 

unhook these modules from:

displayHomeTabContent

displayHomeTab

 

and attach them to

displayHome

possible to hook featured product in displayHome

but for new product module and best seller module you need to add this

 

public function hookDisplayHome($params)
{
$this->hookdisplayHomeTabContent($params);
}
 
to php file (tested in ps 1.6.0.9)
  • Like 1
Link to comment
Share on other sites

thank you,it works for me,i have another question .when i hook newproduct module to homepage ,it doesn't have any title.how can i fix it with a title?

You should go into themes/Yourtheme/modules/blocknewproducts/ and edit the blocknewproducts_home.tpl

 

look for

{if isset($new_products) && $new_products}

and right after it on a new line add :

<h4 class="title_block">{l s='New products' mod='blocknewproducts'}</h4>

It should work, I have no way to test right now , as my local version is a bit messed up

 

Let me know how it went.

 

Always make a back-up of the original file just in case.

  • Like 1
Link to comment
Share on other sites

i need to change the position of new products and best sellers and specials and hook them to hoe position ,when their position changed their title doesn't shown,as Goerge said i add that line to the blocknewproducts-home.tpl.but when i do that to best sellers they start to show there isn't any product.i 'm really confused pelease help me in that.

Link to comment
Share on other sites

i need to change the position of new products and best sellers and specials and hook them to hoe position ,when their position changed their title doesn't shown,as Goerge said i add that line to the blocknewproducts-home.tpl.but when i do that to best sellers they start to show there isn't any product.i 'm really confused pelease help me in that.

Different modules might need different approaches.

Let me look into the Best sellers module. I will come back with an answer. 

 

EDIT: 

Ok, so for the best sellers you need to look for 

{if isset($best_sellers) && $best_sellers} 

and add after it on a new line :

 

<h4 class="title_block">{l s='Top sellers' mod='blockbestsellers'}</h4>
Edited by George.Gall (see edit history)
Link to comment
Share on other sites

i added the correct line to each module and they show the title correctly but without any content they show the blue box showing when there isn't any product("No new products at this time").i deleted the cashe in cashe/smarty it came true first but messed up now again..

Link to comment
Share on other sites

it's in my local,i dont know how can i share it for you and also in persian language

This happens because the hook is trying to display the tabed content , but you just unhooked the tab from displayhometabcontent thus nothing is displaying.

I am looking for a solution.

 

Hello everybody!

I need your help because I have an issue with my home-feature products: It does not appear when I load my homepage, I only have the link in the tab to show it. What can I do to solve the bug? If you have any solutions, it would be really great!

 

Thank you!

 

Jaques

Could you share a link or do you work in local too , like yasaman ?

Edited by George.Gall (see edit history)
Link to comment
Share on other sites

 

possible to hook featured product in displayHome

but for new product module and best seller module you need to add this

 

public function hookDisplayHome($params)
{
$this->hookdisplayHomeTabContent($params);
}
 
to php file (tested in ps 1.6.0.9)

 

Ok , so the solution was fairly simple.  

taoufiqaitali added only the tab content to the displayhome hook, but in fact the displayhometab and displayhometabcontent are related because the actual caching happens in the tab. 

 

The CORRECT solution is to edit the blocknewproducts.php in the prestashop_folder/modules/blocknewproducts/ and add this code wherever you want.

	public function hookDisplayHome($params)
	{
		$this->hookdisplayHomeTab($params);
		$this->hookdisplayHomeTabContent($params);
	}
Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...