Jump to content

[Solved]How to transplant modules in the left or right column into center column in the homepage?


Guest Steven_king

Recommended Posts

Hi all,

I wish transplant the top seller,new product modules into the center column in the home page.

I did this by "BO >> Modules >> Positions >> Remove the original positions and transplant the modules to the hook of Homepage content"

but they don't appear in the homepage.

Maybe I need to alter CSS and smarty templates of the modules :

take \modules\blockbestsellers\blockbestsellers.php for example:

public function install()
   {
       if (!parent::install() OR
           !$this->registerHook('rightColumn') OR
           !$this->registerHook('updateOrderStatus') OR
           !ProductSale::fillProductSales())
               return false;
           return true;
   }



   function hookRightColumn($params)
   {
       global $smarty;
       $currency = new Currency(intval($params['cookie']->id_currency));
       $bestsellers = ProductSale::getBestSalesLight(intval($params['cookie']->id_lang), 0, 5);

       $best_sellers = array();
       foreach ($bestsellers AS $bestseller)
       {
           $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency);
           $best_sellers[] = $bestseller;
       }
       $smarty->assign(array(
           'best_sellers' => $best_sellers,
           'mediumSize' => Image::getSize('medium')));
       return $this->display(__FILE__, 'blockbestsellers.tpl');
   }




   function hookLeftColumn($params)
   {
       return $this->hookRightColumn($params);
   } 



Can anybody tell me how to modify the code or get me any idea?

Link to comment
Share on other sites

Not all modules have the ability to hook to all locations, it seems that this module is only set for left or right.

You can try to manually add a new hook function, but it may not work if the .tpl /css is not set for it.

   function hookTop($params)
   {
       return $this->hookRightColumn($params);
   }

Link to comment
Share on other sites

tomerg3 ,Thank you very much.

I make it by:

function hookHome($params)
   {
       return $this->hookRightColumn($params);
   } 



It works,thank you very much for your idea.

Link to comment
Share on other sites

  • 2 months later...

Hey guys, I want to do the same, move 'Top Seller' and 'Wish List' to the left column, can you guys tell me what tpl file and I need to add or remove. I don't know where should I put that function:

function hookHome($params)
{
return $this->hookRightColumn($params);
}

Thanks
Regards

Link to comment
Share on other sites

Those modules can already be placed in the left column by default. Just go to Modules > Positions > Transplant a module, then choose the "Top sellers" or "Wishlist block" in the "Module" dropdown and "Left column blocks" in the "Hook into" dropdown, then click Save. You can then have these modules in both the left and right columns. Go back to Modules > Positions > Right column blocks and click the X next to the modules to delete them from the right column.

Link to comment
Share on other sites

Thanks for your fast answer, I've tried to do what you say but I don't know why I see those option (the dropdown) but for some reason is locked and I can't modify it. Same with both modules. Do u know why?

Thanks

Link to comment
Share on other sites

  • 2 months later...
×
×
  • Create New...