Post by JNeuhoff » Tue Dec 06, 2016 11:24 pm

I think this should work:

Code: Select all

<?php
class add_convert_coin_menu_ControllerCommonColumnLeft extends ControllerCommonColumnLeft {
	 public function preRender( $template_buffer, $template_name, &$data ) {
			if ($template_name != 'common/column_left.tpl') {
				 return parent::preRender( $template_buffer, $template_name, $data );
			}

			$this->load->language('common/column_left');

			if ($this->user->hasPermission('access', 'convert/coin')) {
				$convert_coin_menu = array(
					'name'     => $this->language->get('text_convert_coin'),
					'href'     => $this->url->link('convert/coin', 'token=' . $this->session->data['token'], true),
					'children' => array()
				);
				$sales_menu = null;
				foreach ($data['menus'] as $i=>$menu) {
					if ($menu['id']=='menu-sale') {
						$sales_menu = $menu;
						$sales_menu['children'][] = $convert_coin_menu;
						$data['menus'][$i] = $sales_menu;
						break;
					}
				}
				if (!$sales_menu) {
					$sales_menu = array(
						'id'       => 'menu-sale',
						'icon'	   => 'fa-shopping-cart', 
						'name'	   => $this->language->get('text_sale'),
						'href'     => '',
						'children' => array( $convert_coin_menu )
					);
					$data['menus'][] = $sales_menu;
				}
			}

			return parent::preRender( $template_buffer, $template_name, $data );
	 }
		
?>

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool


User avatar
Newbie

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by keraknasi » Wed Dec 07, 2016 12:56 am

JNeuhoff wrote:I think this should work:

Code: Select all

<?php
class add_convert_coin_menu_ControllerCommonColumnLeft extends ControllerCommonColumnLeft {
	 public function preRender( $template_buffer, $template_name, &$data ) {
			if ($template_name != 'common/column_left.tpl') {
				 return parent::preRender( $template_buffer, $template_name, $data );
			}

			$this->load->language('common/column_left');

			if ($this->user->hasPermission('access', 'convert/coin')) {
				$convert_coin_menu = array(
					'name'     => $this->language->get('text_convert_coin'),
					'href'     => $this->url->link('convert/coin', 'token=' . $this->session->data['token'], true),
					'children' => array()
				);
				$sales_menu = null;
				foreach ($data['menus'] as $i=>$menu) {
					if ($menu['id']=='menu-sale') {
						$sales_menu = $menu;
						$sales_menu['children'][] = $convert_coin_menu;
						$data['menus'][$i] = $sales_menu;
						break;
					}
				}
				if (!$sales_menu) {
					$sales_menu = array(
						'id'       => 'menu-sale',
						'icon'	   => 'fa-shopping-cart', 
						'name'	   => $this->language->get('text_sale'),
						'href'     => '',
						'children' => array( $convert_coin_menu )
					);
					$data['menus'][] = $sales_menu;
				}
			}

			return parent::preRender( $template_buffer, $template_name, $data );
	 }
		
?>
nice, it works. thanks for you fast response to solve my problem

Newbie

Posts

Joined
Tue Nov 22, 2016 11:36 pm
Who is online

Users browsing this forum: Bing [Bot] and 12 guests