<modification>
	<name>TMD Header Module</name>
	<version>2.x.x.x</version>
	<code>#COHMF011</code>
	<author>TMD(opencartextensions.in)</author>
	<link>http://opencartextensions.in/</link>
	
	<file path="admin/language/*/common/menu.php">
		 <operation error="skip">
			<search><![CDATA[// Text]]></search>
			<add position="after"><![CDATA[
			// HeaderManu
			$_['text_menu']                  = 'Menu';
			$_['text_headermenu']            = 'TMD Header Menu';
			]]></add>
		</operation>
	</file>
	<file path="admin/controller/common/menu.php">
		 <operation error="skip">
			<search><![CDATA[$data['home'] = $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true);]]></search>
			<add position="after"><![CDATA[
			/////////HedaerMenu 
			$data['text_headermenu'] = $this->language->get('text_headermenu');
		    $data['text_menu'] = $this->language->get('text_menu'); 
			$data['headermenu'] = $this->url->link('catalog/headermenu', 'token=' . $this->session->data['token'], true);
			///////// HedaerMenu
			]]></add>
		</operation>
	</file>
	
	<file path="admin/view/template/common/menu.tpl">
		 <operation error="skip">
			<search><![CDATA[<li id="system"><a class="parent"><i class="fa fa-cog fa-fw"></i> <span><?php echo $text_system; ?></span></a>]]></search>
			<add position="before"><![CDATA[<li><a class="parent"><i class="fa fa-share-alt fa-fw"></i><span><?php echo $text_menu; ?><span></a>
	 <ul>
      <li><a href="<?php echo $headermenu; ?>"><?php echo $text_headermenu; ?></a></li>
	  </ul>
  </li>]]></add>
		</operation>
	
	</file>	
	<file path="admin/language/*/common/column_left.php">
		<operation error="skip">
			<search ><![CDATA[// Text]]></search>
			<add position="after"><![CDATA[
			// HeaderMenu
			$_['text_menu']                  = 'Menu';
			$_['text_headermenu']            = 'TMD Header Menu';
			]]></add>
		</operation>
	</file>
	
	<file path="admin/controller/common/column_left.php">
		<operation error="skip">
			<search><![CDATA[// System]]></search>
			<add position="before"><![CDATA[
			/* Header menu */						
			$headermenus = array();
		
			if ($this->user->hasPermission('access', 'catalog/headermenu')) {		
				$headermenus[] = array(
					'name'	   => $this->language->get('text_headermenu'),
					'href'     => $this->url->link('catalog/headermenu', 'token=' . $this->session->data['token'], true),
					'children' => array()		
				);					
			}	
					
			if ($headermenus) {					
				$data['menus'][] = array(
					'id'       => 'menu-megafooter',
					'icon'	   => 'fa fa-share-alt fa-fw', 
					'name'	   => $this->language->get('text_menu'),
					'href'     => '',
					'children' => $headermenus
				);		
			}
			
			/* Header menu */	]]></add>
		</operation>
	</file>
	
	<file path="catalog/controller/common/header.php">
		<operation>
			<search><![CDATA[
				foreach ($categories as $category) {]]></search>
			<add position="before"><![CDATA[$data['headermenus'] = array();
		$this->load->model('catalog/headermenu');
		$data['headermenu'] =$this->model_catalog_headermenu->getHeadermenu();]]></add>
		</operation>
	</file>
	<file path="catalog/view/theme/*/template/common/header.tpl">
		<operation>
			<search><![CDATA[<?php if ($categories) { ?>]]></search>
			<add position="replace"><![CDATA[]]></add>
		</operation>
		<operation>
			<search><![CDATA[<?php foreach ($categories as $category) { ?>]]></search>
			<add position="repalce"><![CDATA[
			<?php foreach($headermenu as $header){?> 
			<li class="dropdown"><a class="dropdown-toggle" href="<?php echo $header['link'] ?>"><?php echo $header['title']; ?></a>
			<?php if($header['sub_title']){?>
				<div class="dropdown-menu">	
				<div class="dropdown-inner">
				<ul class="list-unstyled">
				<?php foreach($header['sub_title'] as $subtitle){ ?>
				<li>
					<?php if(isset($subtitle['href'])){?>					
					<a href="<?php echo $subtitle['href']; ?>"><?php echo $subtitle['title']; ?></a>
					<?php }else{?>
					<a href="<?php echo $subtitle['link']?>"><?php echo $subtitle['title']; ?></a>	
					<?php } ?>
					<?php if($header['sub_title']){?>
				
				<ul>
				<?php foreach($subtitle['sub_title'] as $subtitle){ ?>
				<li>
					<?php if(isset($subtitle['href'])){?>					
					<a href="<?php echo $subtitle['href']; ?>"><?php echo $subtitle['title']; ?></a>
					<?php }else{?>
					<a href="<?php echo $subtitle['link']?>"><?php echo $subtitle['title']; ?></a>	
					<?php } ?>
			</li>
				<?php }?>
					
				</ul>				
				<?php }?>	
			</li>
				<?php }?>
				</ul>				
				</div>
				</div>
				
				<?php }?>		
			</li>			
			<?php  }?>
			<?php if ($categories) { ?>
			<?php foreach ($categories as $category) { ?>
		]]></add>
		</operation>
		<operation>
			<search><![CDATA[<li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>]]></search>
			<add position="replace" offset="7"><![CDATA[
			 <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></li>
        <?php } ?>
        <?php } ?>
        <?php } ?>
      </ul>
    </div>
  </nav>
</div>
			]]></add>
		</operation>
	</file>

</modification>