Jump to content

Certain Blocks won't appear in "header" or top of pages hook in.


Recommended Posts

Hey Forum.
I am trying to set up a shop here, and I would really like stuff like categories block and shopping cart to be in the header og "top of pages". But when I try to hook them up there they don't show. not even in the code. What is it about top of pages that makes it so special ? or what makes certain modules like language and login stay up there ?

Best regards Dsan

Link to comment
Share on other sites

The categories block and cart block were not designed to be placed in the header, only in the left or right column. The "User info block" displays cart information in the header. I suggest that you use a menu module to display categories in a menu, since the categories block as it looks in a column wouldn't look good in a header.

Link to comment
Share on other sites

  • 2 months later...

I'm having the same problem here. I'm a webdesigner/frontend developer and started building themes for Prestashop. The past 2 years I've been working on Magento and decided I should try Prestashop. I have several designs ready.

When I hook the "Categories block" to the "Top of pages" it won't show. There's no markup/ouput from the tpl file either. It isn't a CSS or JS issue. The module just won't load into the top of pages. It loads in the left column or the right column. I need it as a horizontal menu on the "top of pages".

I want to avoid core changes or adding custom modules as much as possible since. So far that's going well, but I'm stuck at this one.

Link to comment
Share on other sites

In PrestaShop, you can't just put modules anywhere you want. You can only put them in the positions they were designed to be placed in. The categories block was only designed to be placed in the left or right column. You can add a new hook to the module so that it can be placed at the top of the page, but unless you create a separate menu template, it will display just like it does in the columns.

PrestaShop doesn't come with any kind of menu module. I suggest you use the third-party Top Horizontal Menu module. It's the best menu module I'm aware of at this time. I plan to write my own megamenu module in the future, when I get around to it.

Link to comment
Share on other sites

Thanks!

In my opinion the frontend must be as flexbile as can be. The output of the categories is just plain and simple

  • html markup. It's up to the designer to style the
    • structure to a horizontal or vertical menu through CSS and maybe some Javascript. So the main navigation should be placed anywhere you'd like. But that's only my humble opinion ;-).

      Anyways I figured it out w/ a little hack/addon to the module file.

      Open the file: modules/blockcategories/blockcategories.php

      Go to line 201:

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



      copy these lines and paste it below the public function hookRightColumn and change the function into:

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



      That's it, now you can hook the categories block in the "top of pages"

      The final code should look like this:

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



      Please note: I'm working with PrestaShop™ 1.4.0.7. The themes will be ready for the new version. You must als keep in mind to document this editing for future reference when updating the Prestashop software.

Link to comment
Share on other sites

  • 2 months later...

I agree with pixelate. We should be able to put modules in any position and then style them to suit that position, as in other systems like Wordpress, Joomla, CubeCart etc. Pixelate, thanks for posting your solution. And thanks for the posts NC; I'm going to check out that horizontal menu you mentioned.

Link to comment
Share on other sites

  • 3 weeks later...

Thanks for that bit of code, I'll have to try it out. I wanted to put by shopping cart summary in the header (see screenshot - defaults to collapsed so it doesn't interfere up there), so I ended up moving the left hook up there to accomplish that goal. This is probably a better way to do it, however.

41912_tLJVYysB14eQDIdt9j2s_t

Link to comment
Share on other sites

  • 2 years 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...