Jump to content

[SOLVED] How can I move the user info block to the right column?


5haun

Recommended Posts

Hi all,

 

Okay so what I need to do is exactly what this user said in the old thread:

http://www.prestashop.com/forums/topic/34684-how-to-move-user-info-block-from-header-of-pages-to-the-right-side/

I want to move it above the cart block but I don't really understand how to do it. Can anyone please eleborate futher on the steps to do this?
 

Thanks

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

open module .php file and before last bracket } add this code:

	public function hookRightColumn($params)
	{
		if (!$this->active)
			return;

		$this->smarty->assign(array(
			'cart' => $this->context->cart,
			'cart_qties' => $this->context->cart->nbProducts(),
			'logged' => $this->context->customer->isLogged(),
			'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
			'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
			'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
			'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
		));
		return $this->display(__FILE__, 'blockuserinfo.tpl');
	}

go to modules > positions

then click on green "transplant" button

from first dropdown select: block user info module

from second dropdown select right column

save changes. Voila! remember to remove userinfo block from displayTop (attention! displayTop not displayHeader!)

Link to comment
Share on other sites

open module .php file and before last bracket } add this code:

	public function hookRightColumn($params)
	{
		if (!$this->active)
			return;

		$this->smarty->assign(array(
			'cart' => $this->context->cart,
			'cart_qties' => $this->context->cart->nbProducts(),
			'logged' => $this->context->customer->isLogged(),
			'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
			'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
			'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
			'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
		));
		return $this->display(__FILE__, 'blockuserinfo.tpl');
	}

go to modules > positions

then click on green "transplant" button

from first dropdown select: block user info module

from second dropdown select right column

save changes. Voila! remember to remove userinfo block from displayTop (attention! displayTop not displayHeader!)

Thank you Milos! Solved once again

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

open module .php file and before last bracket } add this code:

	public function hookRightColumn($params)
	{
		if (!$this->active)
			return;

		$this->smarty->assign(array(
			'cart' => $this->context->cart,
			'cart_qties' => $this->context->cart->nbProducts(),
			'logged' => $this->context->customer->isLogged(),
			'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
			'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
			'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
			'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
		));
		return $this->display(__FILE__, 'blockuserinfo.tpl');
	}

go to modules > positions

then click on green "transplant" button

from first dropdown select: block user info module

from second dropdown select right column

save changes. Voila! remember to remove userinfo block from displayTop (attention! displayTop not displayHeader!)

 

I'm using latest version of PS and the above code is already inside the php file. Then I tried to hook it to the right column but it says that this module cannot be moved there. Solution?

Link to comment
Share on other sites

I'm using latest version of PS and the above code is already inside the php file. Then I tried to hook it to the right column but it says that this module cannot be moved there. Solution?

 

i checked latest module core but i can't find this code inside ...

Link to comment
Share on other sites

Thanks for looking into this. The code is there, trust me (I nstalled PS today).

 

I also believe you are contradicting yourself by saying that the module can be moved to the right column, because in this 3D you are saying the opposite: http://www.prestashop.com/forums/topic/268565-solved-login-move-from-top-of-page/

 

So where's the truth and where can I find a real "customer login module"? The many I found are either too old or bug filled.

Link to comment
Share on other sites

original blockuserinfo.php file (from latest release of ps)

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

if (!defined('_PS_VERSION_'))
	exit;

class BlockUserInfo extends Module
{
	public function __construct()
	{
		$this->name = 'blockuserinfo';
		$this->tab = 'front_office_features';
		$this->version = 0.1;
		$this->author = 'PrestaShop';
		$this->need_instance = 0;

		parent::__construct();

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

	public function install()
	{
		return (parent::install() AND $this->registerHook('top') AND $this->registerHook('header'));
	}

	/**
	* Returns module content for header
	*
	* @param array $params Parameters
	* @return string Content
	*/
	public function hookTop($params)
	{
		if (!$this->active)
			return;

		$this->smarty->assign(array(
			'cart' => $this->context->cart,
			'cart_qties' => $this->context->cart->nbProducts(),
			'logged' => $this->context->customer->isLogged(),
			'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
			'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
			'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
			'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
		));
		return $this->display(__FILE__, 'blockuserinfo.tpl');
	}

	public function hookHeader($params)
	{
		$this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all');
	}
}


so i just wondering how it is possible that you've got this code with default module ... you, or someone else, added it ? or what?

Link to comment
Share on other sites

English is not my language but you said

original blockuserinfo.php file (from latest release of ps)

 

an that to me means "the code is taken from the latest version of PS".

Then I'm telling you the code is like that, and to prove it I'm attaching the file. See for yourself, really!

 

Now, we can continue going on like this forever, the fact is the problem of moving the infoblock goes unsolved to me

blockuserinfo.php

Link to comment
Share on other sites

sorry, there is no code that i suggested to use. this is why it doesn't work.

 

open this file once again and search for

	public function hookRightColumn($params)
	{
		if (!$this->active)
			return;

		$this->smarty->assign(array(
			'cart' => $this->context->cart,
			'cart_qties' => $this->context->cart->nbProducts(),
			'logged' => $this->context->customer->isLogged(),
			'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
			'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
			'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
			'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
		));
		return $this->display(__FILE__, 'blockuserinfo.tpl');
	}

it doesn't exist there

Link to comment
Share on other sites

  • 1 year later...

Hi Milos,

I followed your advice, added the missing function in blockuserinfo.php, added the transplant but nothing shows up in the right column of our site.

I thought the problem was the original install function that was:

 

public function install()
{
return (parent::install() && $this->registerHook('displayTop') && $this->registerHook('displayNav') && $this->registerHook('displayHeader'));
}
so I changed it to:
 
public function install()
{
return (parent::install() && $this->registerHook('displayTop') && $this->registerHook('displayNav') && $this->registerHook('displayHeader') && $this->registerHook('displayRightColumn'));
}
 
Then I tried removing the transplant and applying it again, but no luck. 
Can you help me please?
Thanks.
Tami

 

Link to comment
Share on other sites

  • 3 months later...

open module .php file and before last bracket } add this code:

	public function hookRightColumn($params)
	{
		if (!$this->active)
			return;

		$this->smarty->assign(array(
			'cart' => $this->context->cart,
			'cart_qties' => $this->context->cart->nbProducts(),
			'logged' => $this->context->customer->isLogged(),
			'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
			'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
			'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
			'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
		));
		return $this->display(__FILE__, 'blockuserinfo.tpl');
	}

go to modules > positions

then click on green "transplant" button

from first dropdown select: block user info module

from second dropdown select right column

save changes. Voila! remember to remove userinfo block from displayTop (attention! displayTop not displayHeader!)

 

Hi Vekia

I am trying to move the Currency drop down module form the Nav bar into the right colum. I'm using the default bootstrap theme on presta shop 1.6.0.

I think I might be looking at the wrong file? I opened module.php locled at root/ classes/module.

When I paste the code in to this page that you provided above it just gives a white page.

Cna you tell me the location of the module.php that needs to be edited?

 

thanks

Breda

Link to comment
Share on other sites

Hi Vekia

Could you please help with this problem?

I am trying to move the Currency drop down module form the Nav bar into the right colum. I'm using the default bootstrap theme on presta shop 1.6.0.

I think I might be looking at the wrong file? I opened module.php locled at root/ classes/module.

When I paste the code in to this page that you provided above it just gives a white page.

Can you tell me the location of the module.php that needs to be edited?

 

thanks

Breda

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