Jump to content

(Solved) Home Text Editor Top Of Page


Recommended Posts

Hi,

 

I'd like to place the Home Text Editor at the top of the page under the menu.

 

I found this thread 

 

http://www.prestashop.com/forums/topic/244935-solved-home-text-editor-how-to-display-it-only-on-homepage/?hl=%2Bdisplay+%2Bhome+%2Btext+%2Beditor+%2Btop+%2Bpage&do=findComment&comment=1213609

 

and in it there are two suggestions.

 

  Quote

 

 

Edit "tpl" of the module and add

{if $page_name=='index') code_module {/if}

 

  Quote

you have to add in module .php file this function:

    public function hookDisplayTop($params)
    {
        if (!$this->isCached('editorial.tpl', $this->getCacheId()))
        {
            $id_shop = (int)$this->context->shop->id;
            $editorial = EditorialClass::getByIdShop($id_shop);
            if (!$editorial)
                return;            
            $
editorial = new EditorialClass((int)$editorial->id, $this->context->language->id);
            if (!$editorial)
                return;
            $this->smarty->assign(array(
                    'editorial' => $editorial,
                    'default_lang' => (int)$this->context->language->id,
                    'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'),
                    'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'),
                    'id_lang' => $this->context->language->id,
                    'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') && file_exists('modules/editorial/homepage_logo_'.(int)$id_shop.'.jpg'),
                    'image_path' => $this->_path.'homepage_logo_'.(int)$id_shop.'.jpg'
                ));
        }
        return $this->display(__FILE__, 'editorial.tpl', $this->getCacheId());
    }

 

Which is the best solution and which file and where in the file do I put the code.

 

Thank you.

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

  Quote

 

 

 public function hookDisplayTop($params)

    {

        if (!$this->isCached('editorial.tpl', $this->getCacheId()))

        {

            $id_shop = (int)$this->context->shop->id;

            $editorial = EditorialClass::getByIdShop($id_shop);

            if (!$editorial)

                return;            

            $editorial = new EditorialClass((int)$editorial->id, $this->context->language->id);

            if (!$editorial)

                return;

            $this->smarty->assign(array(

                    'editorial' => $editorial,

                    'default_lang' => (int)$this->context->language->id,

                    'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'),

                    'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'),

                    'id_lang' => $this->context->language->id,

                    'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') &&file_exists('modules/editorial/homepage_logo_'.(int)$id_shop.'.jpg'),

                    'image_path' => $this->_path.'homepage_logo_'.(int)$id_shop.'.jpg'

                ));

        }

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

    }

add this before last closing bracket in editorial.php file

  • Like 1
Link to comment
Share on other sites

  • 4 months later...

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...