Jump to content

Solved ! Change the order of displayed newest, popular, most sold, feutured


Recommended Posts

Can anybody help?: Regarding order of displayed "Newest, popular, Best sellers, featured (added module)" tabs.

I would like popular products to be the first seen instead of newest.

www.ani-event.dk

I HAVE changed the order at live edit, (which put Popular as nr 1) but newest products are still shown as the only products. Only when tabbing on another tab and then again Popular " the correct products are shown.

 

Also.. how do I expand, so that all (Newest, Best sellers etc) are show at frontpage at same time below each other, instead of having to see them one at a time by clicking on tabs?)

B.r. Kim

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

Kim,

If you actually want them separated, it's not really necessary to ask to change the order first.... ;-)

 

But okay:

To change the order:

Go to Modules->Positions in back office.

There you can find the block displayHomeTap and displayHomeTabContents

 

There you will find the three tabs currently added. To change their order, just move their position in the block, by dragging them or clicking on the arrows up or down. Make sure you do this for BOTH displayHomeTab AND displayHomeTabContents, otherwise the wrong header shows with the wrong contents. They should be identical in both blocks.

 

To put it separately on the home page, like in PS 1.5, that's more work, as you need to write hooks for displayHome, which isn't always available by default...

 

modules/blockbestsellers/blockbestsellers.php

 

add new function, for example, just below the function hookdisplayHomeTabContent

 

  public function hookdisplayHome($params) {
      return $this->hookdisplayHomeTabContent($params);
  }
 
and in same file, add a line in the install() function to register the newly created hook function (add red code line):
 
public function install()
{
    $this->_clearCache('*');
 
    if (!parent::install()
            || !$this->registerHook('header')
            || !$this->registerHook('actionOrderStatusPostUpdate')
            || !$this->registerHook('addproduct')
            || !$this->registerHook('updateproduct')
            || !$this->registerHook('deleteproduct')
            || !$this->registerHook('displayHome')
            || !$this->registerHook('displayHomeTab')
            || !$this->registerHook('displayHomeTabContent')
            || !ProductSale::fillProductSales()
)
 
then save the file and go to modules->modules and find the "top-sellers block" module. In the select menu on the right of it, choose Reset, to reinstall the module with the new hook. Then go to Modules->positions and remove the module from the displayHomeTab and displayHomeTabContens hook, and add to the displayHome hook (to add, use "transpose a module" button at the top right of modules->positions page to add top-sellers block to hook displayHome)
 
this should add the top sellers to the front page, separated from the tab..
 
 
the same procedure needs to be done for blocknewproducts:
- add function in modules/blocknewproducts/blocknewproducts.php
- add new function to install() function to register
- reset module in modules->modules
- remove module from displayHomeTab and displayHomeTabContents (in modules->positions)
- add module to displayHome hook (using 'transpose a module' button on modules->positions page at the top right)
 

the function hookdisplayHome for module homefeatured already exists, so we don't have to create and register this one. We only have to remove the module from displayHomeTab and displayHomeTabContents, and add the module to the displayHome hook in modules->positions

 

 

We might need to add some headers to each block, to clearly/better separate them. That should be done in the:

- themes/<your theme folder>/modules/blockbestsellers/blockbestsellers.tpl file, 

- themes/<your theme folder>/modules/blocknewproducts/blocknewproducts.tpl file, 

- themes/<your theme folder>/modules/homefeatured/homefeatured.tpl file, 
 
I leave that as an exercise for you.
 
Hope that helps! I hope I didn't forget anything. Not fully tested here, but should probably it.
pascal.
Edited by PascalVG (see edit history)
  • Like 2
Link to comment
Share on other sites

 

Kim,

If you actually want them separated, it's not really necessary to ask to change the order first.... ;-)

 

But okay:

To change the order:

Go to Modules->Positions in back office.

There you can find the block displayHomeTap and displayHomeTabContents

 

There you will find the three tabs currently added. To change their order, just move their position in the block, by dragging them or clicking on the arrows up or down. Make sure you do this for BOTH displayHomeTab AND displayHomeTabContents, otherwise the wrong header shows with the wrong contents. They should be identical in both blocks.

 

To put it separately on the home page, like in PS 1.5, that's more work, as you need to write hooks for displayHome, which isn't always available by default...

 

modules/blockbestsellers/blockbestsellers.php

 

add new function, for example, just below the function hookdisplayHomeTabContent

 

  public function hookdisplayHome($params) {
      return $this->hookdisplayHomeTabContent($params);
  }
 
and in same file, add a line in the install() function to register the newly created hook function (add red code line):
 
public function install()
{
    $this->_clearCache('*');
 
    if (!parent::install()
            || !$this->registerHook('header')
            || !$this->registerHook('actionOrderStatusPostUpdate')
            || !$this->registerHook('addproduct')
            || !$this->registerHook('updateproduct')
            || !$this->registerHook('deleteproduct')
            || !$this->registerHook('displayHome')
            || !$this->registerHook('displayHomeTab')
            || !$this->registerHook('displayHomeTabContent')
            || !ProductSale::fillProductSales()
)
 
then save the file and go to modules->modules and find the "top-sellers block" module. In the select menu on the right of it, choose Reset, to reinstall the module with the new hook. Then go to Modules->positions and remove the module from the displayHomeTab and displayHomeTabContens hook, and add to the displayHome hook (to add, use "transpose a module" button at the top right of modules->positions page to add top-sellers block to hook displayHome)
 
this should add the top sellers to the front page, separated from the tab..
 
 
the same procedure needs to be done for blocknewproducts:
- add function in modules/blocknewproducts/blocknewproducts.php
- add new function to install() function to register
- reset module in modules->modules
- remove module from displayHomeTab and displayHomeTabContents (in modules->positions)
- add module to displayHome hook (using 'transpose a module' button on modules->positions page at the top right)
 

the function hookdisplayHome for module homefeatured already exists, so we don't have to create and register this one. We only have to remove the module from displayHomeTab and displayHomeTabContents, and add the module to the displayHome hook in modules->positions

 

 

We might need to add some headers to each block, to clearly/better separate them. That should be done in the:

- themes/<your theme folder>/modules/blockbestsellers/blockbestsellers.tpl file, 

- themes/<your theme folder>/modules/blocknewproducts/blocknewproducts.tpl file, 

- themes/<your theme folder>/modules/homefeatured/homefeatured.tpl file, 
 
I leave that as an exercise for you.
 
Hope that helps! I hope I didn't forget anything. Not fully tested here, but should probably it.
pascal.

 

Great. Thanks for helping !!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...