Jump to content

How to move User info block from header of pages to the right side


Recommended Posts

Hi,

i need to move the "User info block" (which is located in the header) just above the cart (which is located in the right side).

I read other threads related to moving modules and i did this:

BO --> Modules --> Positions

and i moved the "User info block" from header in the right side. After that, i deleted the "User info block" from header, but the above steps were not successful because the user info block never appeared in the right side.

There's a picture attached showing exactly what i need to do.

Any suggestions?
Thanks!

14569_lqbImlLQvnu4o2ZX09z0_t

Link to comment
Share on other sites

  • 2 weeks later...

The user info block was designed only to be positioned at the top of the page, not in a column. You will need to modify modules/blockuserinfo/blockuserinfo.php and add the following code before the last }:

function hookRightColumn($params)
{
   global $smarty, $cookie, $cart;
   $smarty->assign(array(
       'cart' => $cart,
       'cart_qties' => $cart->nbProducts(),
       'logged' => $cookie->isLogged(),
       'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
       'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
       'lastName' => ($cookie->logged ? $cookie->customer_lastname : false)
   ));
   return $this->display(__FILE__, 'blockuserinfo-column.tpl');
}



Then copy blockuserinfo.tpl to blockuserinfo-column.tpl and modify it to become a block. Have a look at another module for guidance. You should add class="block" to the div, a h4 for the heading and a div class="block_content" around the content of the module.

Link to comment
Share on other sites

This is the files that i had follow your instruction.
After that i had create a file blockuserinfo-column.tpl without modify as a block. i didnt modify to as a block it is because i want it to be like that to hook at the top right column there then i uninstall and install again BUT it is not working. it is still at the top there

Can you plz let me know where i missed ? Thanks

<?php

class BlockUserInfo extends Module
{
   function __construct()
   {
       $this->name = 'blockuserinfo';
       $this->tab = 'Blocks';
       $this->version = 0.1;

       parent::__construct();

       $this->displayName = $this->l('User info block');
       $this->description = $this->l('Adds a block that displays information about the customer');
   }

   function install()
   {
       if (!parent::install())
           return false;
       if (!$this->registerHook('top'))
           return false;
       return true;
   }

   /**
   * Returns module content for header
   *
   * @param array $params Parameters
   * @return string Content
   */
   function hookTop($params)
   {
       global $smarty, $cookie, $cart;
       $smarty->assign(array(
           'cart' => $cart,
           'cart_qties' => $cart->nbProducts(),
           'logged' => $cookie->isLogged(),
           'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
           'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
           'lastName' => ($cookie->logged ? $cookie->customer_lastname : false)
       ));
       return $this->display(__FILE__, 'blockuserinfo.tpl');
   }

   function hookRightColumn($params)
{
       global $smarty, $cookie, $cart;
       $smarty->assign(array(
       'cart' => $cart,
       'cart_qties' => $cart->nbProducts(),
       'logged' => $cookie->isLogged(),
       'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
       'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
       'lastName' => ($cookie->logged ? $cookie->customer_lastname : false)
   ));
   return $this->display(__FILE__, 'blockuserinfo-column.tpl');
} 


}

?>

Link to comment
Share on other sites

That's why you need to rewrite the code in blockuserinfo-column.tpl to make it a block, so it won't overlap other modules. If you don't turn it into a block, you'll need to modify the /* block top user information */ section of global.css to fix the overlapping issue.

Link to comment
Share on other sites

  • 1 month later...

Hiya all,

This is what i'm trying to achieve for my store but think i've messed things up a bit now and can't transpalnt the user info back into the origional place. What i'd like still is to have the user info in the right hand column at the top like discussed in this forum.

I understand what is being said that I need to change the code to create a midule box but i'm not able to do this withour help at the moment. Am getting there with PS but need some help with creating the module.

Has anyone who has made these changes able to put their fully modified blockuserinfo.tpl & blockuserinfo.php file content in this post for me to read and make changes to my files.

See my store sofar at http://www.hydroflora.co.uk

Thanks in advance, without the community I wouldn't of got as far as i have now:)

JayKay

Link to comment
Share on other sites

Hiya all,

This is what i'm trying to achieve for my store but think i've messed things up a bit now and can't transpalnt the user info back into the origional place. What i'd like still is to have the user info in the right hand column at the top like discussed in this forum.

I understand what is being said that I need to change the code to create a midule box but i'm not able to do this withour help at the moment. Am getting there with PS but need some help with creating the module.

Has anyone who has made these changes able to put their fully modified blockuserinfo.tpl & blockuserinfo.php file content in this post for me to read and make changes to my files.

See my store sofar at http://www.hydroflora.co.uk

Thanks in advance, without the community I wouldn't of got as far as i have now:)

JayKay


I like your slide at the top right....how do u do that ?

to move your block from top to right side just follow the code as show at above.....
i'm not able to move the picture in blockuserinfo into a new block so i just delete the picture and maintain the "text"....
Link to comment
Share on other sites

The page corner peel is a mod from this forum. I just cant work out how to follow the code. If you could send me copies of your 2 files that need updating so that I can take a look if you have done this i'd appreciate it. If you need any help with the page peel mod i'd be happy to help in return. Just send me the small and big images that you want in there. 100px X 100px Small & 500px X 500px Large.

Thanks for the reply.

Jay Kay

Link to comment
Share on other sites

  • 1 year later...

hi,

need help with the positioning topic of the UserInfo Block....
struggling to figure this out...
if anyone can point me in the right direction

See attached picture...

looking to move that info from the RED block to the yellow Block..

37639_bhHWjYlqYUzjWrLUJz2K_t

Link to comment
Share on other sites

  • 1 year later...

The user info block was designed only to be positioned at the top of the page, not in a column. You will need to modify modules/blockuserinfo/blockuserinfo.php and add the following code before the last }:

function hookRightColumn($params)
{
global $smarty, $cookie, $cart;
$smarty->assign(array(
	'cart' => $cart,
	'cart_qties' => $cart->nbProducts(),
	'logged' => $cookie->isLogged(),
	'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
	'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
	'lastName' => ($cookie->logged ? $cookie->customer_lastname : false)
));
return $this->display(__FILE__, 'blockuserinfo-column.tpl');
}

Then copy blockuserinfo.tpl to blockuserinfo-column.tpl and modify it to become a block. Have a look at another module for guidance. You should add class="block" to the div, a h4 for the heading and a div class="block_content" around the content of the module.

 

Hey rocky, Is this code still relevant for 1.4.6.2??

Link to comment
Share on other sites

  • 1 month later...

Dear all,

 

I would like to move the cart - which is apparently linked to block user info - from header to right column, like in image "Original condition".

 

I followed the steps as above, added the code to blockuserinfo.php, copied blockuserinfo.tpl to blockuserinfo-column.tpl and added the classes to it. Then I transplated the module in backoffce and deleted it from header in positions. Now what I get is what is shown in image "Current condition".

 

The ajax cart is expanding nicely where it should, but the cart itself does not look the same as previously (with background image etc). I get the text only.

 

What should I do to look it the same as previously, but be in the right column?

 

[using Prestashop 1.4.7.0, New template.]

post-333513-0-34972500-1331093560_thumb.png

post-333513-0-14408900-1331093630_thumb.png

Link to comment
Share on other sites

OK, i figured it out. As following, for those who might be interested.

 

1. Add the code in blockuserinfo.php as mentioned above.

2. Copy blockuserinfo.tpl to blockuserinfo-column.tpl under your theme (as mentioned above).

3. In back office, transplant User info block module from Top pages (delete) to Right column. Then, transplant Prestashop New theme Cart block v1.2 from Top pages (delete) to Right column. Move both modules to top of Right column under Positions.

4. I changed some code so that the Welcome, Login text comes before the cart. So, in blockuserinfo-column.tpl move <p...> for "Welcome,Login" before the cart part. Add a <div style="clear:both"></div> after the last </div>. -> This will separate the block from the next module in the column. Because at first it looks like the cart and user info is within the title of the next module in the column. You should clear cache + complile at this point to see the changes.

5. In blockuserinfo.css (your theme/css/modules) add "margin-bottom:10px;" under /*cart*/. -> This will create some space between the cart and next module in the column.

6. Change "margin-top:10px;" to "margin-bottom:10px;" under /*user infos*/. -> This will create some space between the Welcome, Login text and the cart image.

 

It looks fine for me now. Hope this can help somebody, too. It was not necessary for me to modify blockuserinfo-column.tpl into a block - it worked without it. I am not an expert in these things, maybe somebody has a better description / solution, too.

post-333513-0-11800800-1331282006_thumb.jpg

  • Like 1
Link to comment
Share on other sites

  • 9 months later...

I realise this is n old topic, but can I get help with this? I need to getmy webshop live i 3 weeks.. and need to get rid of that cart-part of the user info in top. Or, move as suggested here, but I dont come further that I get a tex in the right colum (where I hook the adapted block) that says, cant find template for block. I also opened a new topic, asking how to hide a part of the userinfo but didnt got any answerso far:(

Link to comment
Share on other sites

  • 3 months later...
  • 9 months later...

OK, i figured it out. As following, for those who might be interested.

 

1. Add the code in blockuserinfo.php as mentioned above.

2. Copy blockuserinfo.tpl to blockuserinfo-column.tpl under your theme (as mentioned above).

3. In back office, transplant User info block module from Top pages (delete) to Right column. Then, transplant Prestashop New theme Cart block v1.2 from Top pages (delete) to Right column. Move both modules to top of Right column under Positions.

4. I changed some code so that the Welcome, Login text comes before the cart. So, in blockuserinfo-column.tpl move <p...> for "Welcome,Login" before the cart part. Add a <div style="clear:both"></div> after the last </div>. -> This will separate the block from the next module in the column. Because at first it looks like the cart and user info is within the title of the next module in the column. You should clear cache + complile at this point to see the changes.

5. In blockuserinfo.css (your theme/css/modules) add "margin-bottom:10px;" under /*cart*/. -> This will create some space between the cart and next module in the column.

6. Change "margin-top:10px;" to "margin-bottom:10px;" under /*user infos*/. -> This will create some space between the Welcome, Login text and the cart image.

 

It looks fine for me now. Hope this can help somebody, too. It was not necessary for me to modify blockuserinfo-column.tpl into a block - it worked without it. I am not an expert in these things, maybe somebody has a better description / solution, too.

 

 

Can you write step by step instructions? I mean a complete step by step instructions how to make the block was in the right column.

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