Jump to content

Block Newsletter: Can't transplant it to the top


Hyperion_

Recommended Posts

Hello,

 

I've been trying to transplant the Block Newsletter module that's fixed on the footer and I've added the code below to the blocknewsletter.php in the modules folder but no success.

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

Thank you

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

If you go to Module Positions - does Block Newsletter shows under displayTop group? If not, add it there, now that you created the function hookDisplayTop.

 

Thank you but how do I add it there? Don't I have to transplant it to displayTop? If so, it still doesn't work. It's in actionCustomerAccountAdd and if I do unhook it goes to another groups and eventually ends up in the Footer group.

 

This is how I have the rest of the code:

public function hookDisplayLeftColumn($params)
    {
        if (!isset($this->prepared) || !$this->prepared)
            $this->_prepareHook($params);
        $this->prepared = true;
        return $this->display(__FILE__, 'blocknewsletter.tpl');
    }

    public function hookFooter($params)
    {
        return $this->hookDisplayLeftColumn($params);
    }
    
   public function hookdisplayTop($params) {
       
       $this->hookDisplayHome($params);
   }

    public function hookdisplayMaintenance($params)
    {
        return $this->hookDisplayLeftColumn($params);
    }

    public function hookDisplayHeader($params)
    {
        $this->context->controller->addCSS($this->_path.'blocknewsletter.css', 'all');
        $this->context->controller->addJS($this->_path.'blocknewsletter.js');
      
    }

Thank you.

Link to comment
Share on other sites

I see that you are calling

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

But don't know what is in your hookDisplayHome.

 

Try a simple test:

   public function hookdisplayTop($params) {
//      $this->hookDisplayHome($params);
      ddd('hookdisplayTop should work');
   }

Clear cache, enable _PS_MODE_DEV_ and reload the page. If it shows a blank page with hookdisplayTop should work then it should :).

 

Check further in hookDisplayHome.

  • Like 1
Link to comment
Share on other sites

I see that you are calling

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

But don't know what is in your hookDisplayHome.

 

Try a simple test:

   public function hookdisplayTop($params) {
//      $this->hookDisplayHome($params);
      ddd('hookdisplayTop should work');
   }

Clear cache, enable _PS_MODE_DEV_ and reload the page. If it shows a blank page with hookdisplayTop should work then it should :).

 

Check further in hookDisplayHome.

 

Just enabled _PS_MODE_DEV_ in the defines.inc.php. The test didn't work so I guess the function is not achieving anything. Where do I get more info from hookDisplayHome? I just really copied the code from vekia in some other topic. Thank you!

Link to comment
Share on other sites

Just enabled _PS_MODE_DEV_ in the defines.inc.php. The test didn't work so I guess the function is not achieving anything. Where do I get more info from hookDisplayHome? I just really copied the code from vekia in some other topic. Thank you!

 

No, this means that the module is not transplanted to displayTop.

 

Go to Module > Positions > Transplant a module;

Select your module from Module drop-down and displayTop (Top of pages) for Hook into. See that you don't have any exception selected.

Save and check if the module was successfully added to the hook. After that, test again.

  • Like 1
Link to comment
Share on other sites

No, this means that the module is not transplanted to displayTop.

 

Go to Module > Positions > Transplant a module;

Select your module from Module drop-down and displayTop (Top of pages) for Hook into. See that you don't have any exception selected.

Save and check if the module was successfully added to the hook. After that, test again.

Works now. Thank you!

 

It's on the displayTop group but is not being displayed on top. What should I do?

Link to comment
Share on other sites

Then you should put something like 

   public function hookdisplayTop($params) {
      $this->hookDisplayLeftColumn($params);
   }

This is to test if it shows on the front page. Then you probably have to make a new tpl file, to be displayed in the header (instead of the left column). 

And also any other code you require.

  • Like 1
Link to comment
Share on other sites

Then you should put something like 

   public function hookdisplayTop($params) {
      $this->hookDisplayLeftColumn($params);
   }

This is to test if it shows on the front page. Then you probably have to make a new tpl file, to be displayed in the header (instead of the left column). 

And also any other code you require.

I've added that. Doesn't show up. Was only showing on the footer and now is not being displayed whatsoever.

Edited by Hyperion_ (see edit history)
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...