Jump to content

How to allow users logged change price list with a dropdown


Recommended Posts

Hi devs,

 

I recently created a store in prestashop using Warehouse template and I realized that need an option that I can't find through modules.

I need to create on the homepage a drop-down list in where our professional and wholesale customers (after they logged in) can select and change their rate if they are selling from our page to an 'end customer', so they can view their really prices and buy directly or change their rate to PVP and sell from the website. Tried to program a small script by coupling it to one of the Prestashop native modules and I think I'm missing something to make it work. I used the module 'blockuserinfo' and put this source within:

public function hookDisplayNav($params)
	{
		if($this->context->customer->isLogged){
			$name_group = array(
				'2' => 'PvP',
				'3' => 'Profesional',
				'4' => 'Wholesaler'
				);
			$groupBox = Customer::getGroupsStatic((int)$this->context->customer->id);
			$id_default_group = Customer::getDefaultGroupId((int)$this->context->customer->id);

			$os = $groupBox;
			$showres = false;
			if (in_array(3, $os)) {
			   $showres = true;
			}
			if (in_array(4, $os)) {
			   $showres = true;
			}		
			$this->smarty->assign(array(
					'groupBox' => $groupBox,
					'default_group'=> $id_default_group,
					'name_group' => $name_group,
					'showres' => $showres
			));
		}
		return $this->display(__FILE__, 'nav.tpl');
	}

 

Hope you can help me to make this script work or recommend me another way to do this. Thanks a lot!!

 

Edited by bmn3 (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...