<repo_name>krainet/ps_resources<file_sep>/ps_modules/modules_src/shopimultitabs/classes/ShopimultitabContent.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

class ShopimultitabContent extends ObjectModel
{
	public $id;
	
	public $id_product;
	public $content;
	public $id_shopimultitab;
	public $categories;
	public $global;
	
	public $content_text;
	
	/**
	 * @see ObjectModel::$definition
	 */
	public static $definition = array(
		'table' => 'shopimultitab_content',
		'primary' => 'id_shopimultitab_content',
		'multilang' => true,
		'fields' => array(
			'id_product' =>		array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => true),
			'content' =>			array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 255),
			'id_shopimultitab' =>		array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt', 'required' => true),
			'categories' =>		array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
			'global' =>		array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
			
			'content_text' =>	array('type' => self::TYPE_HTML, 'lang' => true),
		)
	);
	
	public	function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
	{
		parent::__construct($id, $id_lang, $id_shop);
	}

	public function add($autodate = true, $null_values = false)
	{
		$context = Context::getContext();
		$id_shop = $context->shop->id;
		$res = parent::add($autodate, $null_values);
		
		$res &= Db::getInstance()->execute('
			INSERT INTO `'._DB_PREFIX_.'shopimultitab_content_shop` (`id_shop`, `id_shopimultitab_content`)
			VALUES('.(int)$id_shop.', '.(int)$this->id.')'
		);
		return $res;
	}

	public function delete()
	{
		$res = true;
		$res &= Db::getInstance()->execute('
			DELETE FROM `'._DB_PREFIX_.'shopimultitab_content_shop`
			WHERE `id_shopimultitab_content` = '.(int)$this->id
		);
		$res &= parent::delete();
		return $res;
	}
	
	public static function checkExist($id_shopimultitab, $id_product)
	{
		$return = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
			SELECT *
			FROM '._DB_PREFIX_.'shopimultitab_content
			WHERE id_shopimultitab = '.(int)$id_shopimultitab.' AND id_product = '.(int)($id_product) );
		return ($return ? true : false);
	}
	
	public static function getContents($id_shopimultitab = null, $id_product = null, $global = null)
	{
		$context = Context::getContext();
		$id_shop = $context->shop->id;
		$id_lang = $context->language->id;
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT hs.`id_shopimultitab_content` as id_shopimultitab_content, hss.`content`, hss.`id_product`, hss.`id_shopimultitab`,
					   hssl.`content_text`, hss.categories, hss.global
			FROM '._DB_PREFIX_.'shopimultitab_content_shop hs
			LEFT JOIN '._DB_PREFIX_.'shopimultitab_content hss ON (hs.id_shopimultitab_content = hss.id_shopimultitab_content)
			LEFT JOIN '._DB_PREFIX_.'shopimultitab_content_lang hssl ON (hss.id_shopimultitab_content = hssl.id_shopimultitab_content)
			WHERE (id_shop = '.(int)$id_shop.')
			AND hssl.id_lang = '.(int)$id_lang.($id_shopimultitab ? ' AND hss.`id_shopimultitab` = '.(int)$id_shopimultitab : '').($id_product ? ' AND hss.`id_product` = '.(int)$id_product : '')
			.($global ? ' AND hss.global = 1' : '')
			);
	}
	
	public static function getContent($id_shopimultitab, $id_product)
	{
		if (!$id_shopimultitab || !$id_product)
			return array();
		$context = Context::getContext();
		$id_shop = $context->shop->id;
		$id_lang = $context->language->id;
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
			SELECT hs.`id_shopimultitab_content` as id_shopimultitab_content, hss.`content`, hss.`id_product`, hss.`id_shopimultitab`,
					   hssl.`content_text`
			FROM '._DB_PREFIX_.'shopimultitab_content_shop hs
			LEFT JOIN '._DB_PREFIX_.'shopimultitab_content hss ON (hs.id_shopimultitab_content = hss.id_shopimultitab_content)
			LEFT JOIN '._DB_PREFIX_.'shopimultitab_content_lang hssl ON (hss.id_shopimultitab_content = hssl.id_shopimultitab_content)
			WHERE (id_shop = '.(int)$id_shop.')
			AND hssl.id_lang = '.(int)$id_lang.' AND hss.`id_shopimultitab` = '.(int)$id_shopimultitab.($id_product ? ' AND hss.`id_product` = '.(int)$id_product : '')
			);
	}

}
<file_sep>/ps_modules/modules_src/shopimultitabs/libs/Helper.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

class HelperShopiMultiTab {
	public static $hookAssign = array('displayRightColumn','displayLeftColumn','displayHome','displayTop','displayFooter');
	public static function getFolderAdmin()
	{
		$folders = array('cache','classes','config','controllers','css','docs','download','img','js','localization','log','mails',
		'modules','override','themes','tools','translations','upload','webservice','.','..');
		$handle = opendir(_PS_ROOT_DIR_);
		if (!$handle)
		{
			return false;
		}
		while (false !== ($folder = readdir($handle)))
		{
			if (is_dir(_PS_ROOT_DIR_ .'/'. $folder))
			{
				if (!in_array($folder, $folders))
				{
					$folderadmin = opendir(_PS_ROOT_DIR_ .'/'. $folder);
					if (!$folderadmin) 
						return $folder;
					while (false !== ($file = readdir($folderadmin)))
					{ 
						if (is_file(_PS_ROOT_DIR_ .'/'.  $folder.'/'.$file) && ($file == 'header.inc.php'))
						{
							return $folder;
						}
					}
				}
			}
		}
		return $false;
	}
	/**
	* get modules
	* this
	*/
	public static function getModules()
	{
		//global $hookAssign;
		$notModule = array( SHOPI_MULTITAB_MODULE_NAME );
		$where = '';
		if (count($notModule) == 1)
		{
			$where = ' WHERE m.`name` <> \''.$notModule[0].'\' AND active = 1';
		}
		elseif (count($notModule) > 1)
		{
			$where = ' WHERE m.`name` NOT IN (\''.implode("','",$notModule).'\') AND active = 1';
		}
		
		$id_shop = Context::getContext()->shop->id;
		
		$modules = Db::getInstance()->ExecuteS('
		SELECT m.*
		FROM `'._DB_PREFIX_.'module` m
		JOIN `'._DB_PREFIX_.'module_shop` ms ON (m.`id_module` = ms.`id_module` AND ms.`id_shop` = '.(int)($id_shop).')
		'.$where );
		if (!$modules)
			return array();
		$return = array();
		foreach ($modules as $module)
		{
			$moduleInstance = Module::getInstanceByName($module['name']);
			$m_module = '';
			foreach (self::$hookAssign as $hook)
			{
				$retro_hook_name = Hook::getRetroHookName($hook);
				if (is_callable(array($moduleInstance, 'hook'.ucfirst($hook))) || is_callable(array($moduleInstance, 'hook'.ucfirst($retro_hook_name))))
					$m_module = $module;
			}
			if ($m_module)
				$return[] = $m_module;
		}
		return $return;
	}
	/**
	* get modules
	* 
	*/
	public static function getModuleByName( $name )
	{
		return Db::getInstance()->getRow('
		SELECT m.*
		FROM `'._DB_PREFIX_.'module` m
		JOIN `'._DB_PREFIX_.'module_shop` ms ON (m.`id_module` = ms.`id_module` AND ms.`id_shop` = '.(int)(Context::getContext()->shop->id).')
		WHERE m.`name` = \''.$name.'\'');
	}
	/**
	* get Hooks in module 
	* 
	*/
	public static function getHooksByModuleName( $name )
	{
		//global $hookAssign;
		if(!$name)
			return array();
		$moduleInstance = Module::getInstanceByName( $name );
		//echo "<pre>".print_r($moduleInstance,1); die;
		$hooks = array();
		foreach( self::$hookAssign as $hook)
		{
			$retro_hook_name = Hook::getRetroHookName($hook);
			if (is_callable(array($moduleInstance, 'hook'.ucfirst($hook))) || is_callable(array($moduleInstance, 'hook'.ucfirst($retro_hook_name))))
			{
				$hooks[] = $hook;
			}
		}
		$results = self::getHookByArrName( $hooks );
		return $results;
	}
	/**
	* get Hook by Name
	*
	*/
	public static function getHookByName($name)
	{
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
		SELECT *
		FROM `'._DB_PREFIX_.'hook` 
		WHERE `name` = \''.$name.'\'');
	}
	/**
	* get Hook by name array
	*	
	*/
	public static function getHookByArrName($arrName)
	{
		$result = Db::getInstance()->ExecuteS('
		SELECT `id_hook`, `name`
		FROM `'._DB_PREFIX_.'hook` 
		WHERE `name` IN (\''.implode("','",$arrName).'\')');
		return $result ;
	}
	
	public static function execModule( $values )
	{
		$result = '';
		if ($values )
		{
			$arrItems = explode(':',$values); 
			if (count($arrItems) == 2)
			{
				$shopimodule = self::getModuleByName( $arrItems[0] );
				$shopihook = self::getHookByName( $arrItems[1] );
				if ($shopimodule && $shopihook)
				{
					$array = array();
					$array['id_hook']   = $shopihook['id_hook'];
					$array['module'] 	= $shopimodule['name'];
					$array['id_module'] = $shopimodule['id_module'];
					if ($array['module'] && $array['id_module'] && $array['id_hook'])
						$result = self::hookExec( $shopihook['name'], array(), $shopimodule['id_module'], $array);
					/* delete module hook
					self::DeleteModuleHook( $shopimodule['id_module'], $shopihook['id_hook'] );
					*/
				}
			}
		}
		return $result;
	}
	

	public static function hookExec($hook_name, $hookArgs = array(), $id_module = NULL, $array = array())
	{
		if ((!empty($id_module) AND !Validate::isUnsignedId($id_module)) OR !Validate::isHookName($hook_name))
			die(Tools::displayError());
		
		$context = Context::getContext();
        if (!isset($hookArgs['cookie']) || !$hookArgs['cookie'])
			$hookArgs['cookie'] = $context->cookie;
		if (!isset($hookArgs['cart']) || !$hookArgs['cart'])
			$hookArgs['cart'] = $context->cart;
        
		if ($id_module && $id_module != $array['id_module'])
			return ;
		if (!($moduleInstance = Module::getInstanceByName($array['module'])) || !$moduleInstance->active)
			return ;
		$retro_hook_name = Hook::getRetroHookName($hook_name);
		
		$hook_callable = is_callable(array($moduleInstance, 'hook'.$hook_name));
		$hook_retro_callable = is_callable(array($moduleInstance, 'hook'.$retro_hook_name));
		
		$output = '';
		if (($hook_callable || $hook_retro_callable) && Module::preCall($moduleInstance->name))
		{
			if ($hook_callable)
				$output = $moduleInstance->{'hook'.$hook_name}($hookArgs);
			else if ($hook_retro_callable)
				$output = $moduleInstance->{'hook'.$retro_hook_name}($hookArgs);
		}
		return $output;
	}
}
?><file_sep>/ps_modules/modules_src/extrainfo/readme.txt
Extra Info Module

This module adds an extra product information tab among the product tabs in the product page.

Data field names are adjusted and modified by a request of book seller and can be change easily by editing extratabContents.tpl

Current modifications are presented below:

Author field : uses product reference info
ISBN field : uses EAN13 info
Item code field : uses UPC info

Compatible with Prestashop version 1.4.x

Contact: <EMAIL>

P.S: Module is free of charge, can be distributed or modified without permission of the coder.<file_sep>/ps_modules/modules_src/shopimultitabs/classes/Shopimultitab.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

class Shopimultitab extends ObjectModel
{
	public $id;
	
	public $position;
	public $active;
	public $date_add;
	public $date_upd;
	
	public $title;
	
	/**
	 * @see ObjectModel::$definition
	 */
	public static $definition = array(
		'table' => 'shopimultitab',
		'primary' => 'id_shopimultitab',
		'multilang' => true,
		'fields' => array(
			'active' =>			array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
			'position' =>		array('type' => self::TYPE_INT, 'validate' => 'isunsignedInt'),
			
			'title' =>			array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255),
		)
	);
	
	public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
	{
		parent::__construct($id, $id_lang, $id_shop);
	}

	public function add($autodate = true, $null_values = false)
	{
		$context = Context::getContext();
		$id_shop = $context->shop->id;
		$this->position = $this->getLastPosition();
		
		$res = parent::add($autodate, $null_values);
		
		$res &= Db::getInstance()->execute('
			INSERT INTO `'._DB_PREFIX_.'shopimultitab_shop` (`id_shop`, `id_shopimultitab`)
			VALUES('.(int)$id_shop.', '.(int)$this->id.')'
		);
		return $res;
	}

	public function delete()
	{
		$res = true;
		$res &= $this->reOrderPositions();

		$res &= Db::getInstance()->execute('
			DELETE FROM `'._DB_PREFIX_.'shopimultitab_shop`
			WHERE `id_shopimultitab` = '.(int)$this->id
		);
		$contents = ShopimultitabContent::getContents($this->id);
		if ($contents)
			foreach ($contents as $content)
			{
				$obj = new ShopimultitabContent((int)$content['id_shopimultitab_content']);
				$res &= $obj->delete();
			}
		$res &= parent::delete();
		return $res;
	}
	
	public static function getLastPosition()
	{
		return (Db::getInstance()->getValue('SELECT MAX(l.position)+1 FROM `'._DB_PREFIX_.'shopimultitab` l'));
	}
	
	public function reOrderPositions()
	{
		$id_shopimultitab = $this->id;
		$context = Context::getContext();
		$id_shop = $context->shop->id;

		$max = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT MAX(hss.`position`) as position
			FROM `'._DB_PREFIX_.'shopimultitab` hss, `'._DB_PREFIX_.'shopimultitab_shop` hs
			WHERE hss.`id_shopimultitab` = hs.`id_shopimultitab` AND hs.`id_shop` = '.(int)$id_shop
		);

		if ((int)$max == (int)$id_shopimultitab)
			return true;

		$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT hss.`position` as position, hss.`id_shopimultitab` as id_shopimultitab
			FROM `'._DB_PREFIX_.'shopimultitab` hss
			LEFT JOIN `'._DB_PREFIX_.'shopimultitab_shop` hs ON (hss.`id_shopimultitab` = hs.`id_shopimultitab`)
			WHERE hs.`id_shop` = '.(int)$id_shop.' AND hss.`position` > '.(int)$this->position
		);

		foreach ($rows as $row)
		{
			$current_tab = new Shopimultitab($row['id_shopimultitab']);
			$current_tab->position;
			$current_tab->update();
			unset($current_tab);
		}

		return true;
	}
	
	public static function getTabs($active = null)
	{
		$context = Context::getContext();
		$id_shop = $context->shop->id;
		$id_lang = $context->language->id;
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT hs.`id_shopimultitab` as id_shopimultitab,
					   hss.`position`, hss.`active`,
					   hssl.`title`
			FROM '._DB_PREFIX_.'shopimultitab_shop hs
			LEFT JOIN '._DB_PREFIX_.'shopimultitab hss ON (hs.id_shopimultitab = hss.id_shopimultitab)
			LEFT JOIN '._DB_PREFIX_.'shopimultitab_lang hssl ON (hss.id_shopimultitab = hssl.id_shopimultitab)
			WHERE (id_shop = '.(int)$id_shop.')
			AND hssl.id_lang = '.(int)$id_lang.
			($active ? ' AND hss.`active` = 1' : ' ').'
			ORDER BY hss.position'
			);
	}

}
<file_sep>/README.md
# ps_resources
A set of PS 1.6 resources (modules and themes)
<file_sep>/ps_modules/modules_src/shopimultitabs/install/sql.tables.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

$query = "
CREATE TABLE IF NOT EXISTS `_DB_PREFIX_shopimultitab` (
  `id_shopimultitab` int(11) NOT NULL AUTO_INCREMENT,
  `position` int(11) NOT NULL,
  `active` tinyint(1) NOT NULL,
  `date_add` datetime NOT NULL,
  `date_upd` datetime NOT NULL,
  PRIMARY KEY (`id_shopimultitab`)
) ENGINE=_MYSQL_ENGINE_  DEFAULT CHARSET=utf8 ;

CREATE TABLE IF NOT EXISTS `_DB_PREFIX_shopimultitab_lang` (
  `id_shopimultitab` int(11) NOT NULL DEFAULT '0',
  `title` varchar(50) DEFAULT NULL,
  `id_lang` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_shopimultitab`,`id_lang`)
) ENGINE=_MYSQL_ENGINE_ DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `_DB_PREFIX_shopimultitab_shop` (
  `id_shopimultitab` int(11) NOT NULL,
  `id_shop` int(11) NOT NULL,
  PRIMARY KEY (`id_shopimultitab`,`id_shop`)
) ENGINE=_MYSQL_ENGINE_ DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `_DB_PREFIX_shopimultitab_content` (
  `id_shopimultitab_content` int(11) NOT NULL AUTO_INCREMENT,
  `id_product` int(11) NOT NULL,
  `content` text NOT NULL,
  `id_shopimultitab` int(11) NOT NULL,
  `categories` varchar(255) DEFAULT NULL,
  `global` tinyint(1) NOT NULL,
  PRIMARY KEY (`id_shopimultitab_content`)
) ENGINE=_MYSQL_ENGINE_  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `_DB_PREFIX_shopimultitab_content_lang` (
  `id_shopimultitab_content` int(11) NOT NULL,
  `id_lang` int(11) NOT NULL,
  `content_text` text NOT NULL,
  PRIMARY KEY (`id_shopimultitab_content`,`id_lang`)
) ENGINE=_MYSQL_ENGINE_ DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `_DB_PREFIX_shopimultitab_content_shop` (
  `id_shopimultitab_content` int(11) NOT NULL,
  `id_shop` int(11) NOT NULL,
  PRIMARY KEY (`id_shopimultitab_content`,`id_shop`)
) ENGINE=_MYSQL_ENGINE_ DEFAULT CHARSET=utf8;
";
<file_sep>/ps_modules/modules_src/extrainfo/extrainfo.php
<?php

class extrainfo extends Module
{
	function __construct()
	{
		$this->name = 'extrainfo';
		$this->tab = 'front_office_features';
		$this->version = 1.0;
		$this->author = 'Caglar';
		$this->need_instance = 0;

		parent::__construct(); // The parent construct is required for translations

		$this->displayName = $this->l('Extra Info');
		$this->description = $this->l('Adds an extra product info tab on product page.<br />(www.cepparca.com | by Caglar)');
	}

	function install()
	{
        if (parent::install() == false 
				OR $this->registerHook('productTab') == false
				OR $this->registerHook('productTabContent') == false)
			return (false);
		return (true);
	}

	/**
	* Returns module content
	*
	* @param array $params Parameters
	* @return string Content
	*/

	function hookProductTab($params)
	{
		global $smarty, $cookie;
		return $this->display(__FILE__, 'extratab.tpl');

	}
    
	public function hookProductTabContent($params)
    {
		global $smarty, $cookie, $link;
		/* Product informations */
		$product = new Product((int)Tools::getValue('id_product'), false, (int)$cookie->id_lang);

		$smarty->assign(array(
			'product' => $product
		));	
		
		return ($this->display(__FILE__, 'extratabContents.tpl'));
	}	

}

?><file_sep>/ps_modules/modules_src/shopimultitabs/form.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

if (!defined('_PS_VERSION_'))
	exit;
	
	$tabs = Shopimultitab::getTabs();
	$types = array('html' => 'Html', 'module' => 'Module');
	$str = '';
	if ($tabs)
	{
		$id_product = Tools::getValue('id_product');
		foreach ($tabs as $tab)
		{
			$tabContent = ShopimultitabContent::getContent($tab['id_shopimultitab'], $id_product);
			$str .= '<div id="product-tab-content-shopi-tab-'.$tab['id_shopimultitab'].'" class="product-tab-content shopi-product-tab-content panel" style="display:none">';
			if ($tabContent)
				$obj = new ShopimultitabContent($tabContent['id_shopimultitab_content']);
			else
				$obj = new ShopimultitabContent();
				
			
			$str .= '
			<div class="form-group">
			<label class="control-label col-lg-3">Content Text:</label>
			<div class="col-lg-9">';
			$languages = Language::getLanguages(false);
			$id_lang_default = (int)Configuration::get('PS_LANG_DEFAULT');
			foreach ($languages as $language)
			{
				$str .= '
				<div class="translatable-field row lang-'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $id_lang_default ? 'block' : 'none').';">
					<div class="col-lg-9">
						<textarea class="rte" id="shopicontent_text_'.$tab['id_shopimultitab'].'_'.$language['id_lang'].'" name="shopicontent_text_'.$tab['id_shopimultitab'].'_'.$language['id_lang'].'" cols="30" row="5">'.htmlentities((isset($obj->content_text[$language['id_lang']]) ? $obj->content_text[$language['id_lang']] : ''), ENT_COMPAT, 'UTF-8').'</textarea>
					</div>';

					$str .= '
					<div class="col-lg-2">
						<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
							'.$language['iso_code'].'
							<i class="icon-caret-down"></i>
						</button>
						<ul class="dropdown-menu">';
							foreach ($languages as $lang)
								$str .= '<li><a href="javascript:hideOtherLanguage('.$lang['id_lang'].');" tabindex="-1">'.$lang['name'].'</a></li>';
							
					$str .= '
						</ul>
					</div>';
				$str .= '
				</div>';
			}

			$str .= '</div>';
			$str .= '</div>';
			
			$str .= '
			<div class="form-group">
			<label class="control-label col-lg-3">Modules:</label>
			<div class="col-lg-9">
			';
			/* MODULE */
			/* Submenu Modules */
			$hookoptions = '';
			$shopimodule = '';
			$shopihook = '';
			if ($obj->content)
			{
				$arrmodulehook = explode(':', $obj->content);
				if (count($arrmodulehook) == 2)
				{
					$shopimodule = $arrmodulehook[0];
					$shopihook = $arrmodulehook[1];
				}
				$hookAssign = HelperShopiMultiTab::getHooksByModuleName($shopimodule);
				foreach ($hookAssign as $hook)
					$hookoptions .= '<option value="'.$hook['name'].'"'.((isset($shopihook) && Tools::strtolower($shopihook) == Tools::strtolower($hook['name'])) ? ' selected="selected"' : '').'>'.$hook['name'].'</option>';    
				
			}
			$modules = HelperShopiMultiTab::getModules();
	        	$options = '';
			foreach ($modules as $module)
				$options .= '<option value="'.$module['name'].'"'.((isset($shopimodule) && $shopimodule == $module['name']) ? ' selected="selected"' : '').'>'.$module['name'].'</option>';    
			
			$str .= '
					<div class="menu_type_modules">
						<div class="shopi-header">
							<input type="hidden" value="'.$obj->id.'" name="id_shopimultitab_content_'.$tab['id_shopimultitab'].'" class="id_shopimultitab_content"/>
							<input type="hidden" value="'.$tab['id_shopimultitab'].'" name="id_shopimultitab_'.$tab['id_shopimultitab'].'" class="id_shopimultitab"/>
							<div class="shopi-left">
								<label class="labelmodule">Modules:</label>
								<select class="shopimodule" name="shopimodule_'.$tab['id_shopimultitab'].'">
									<option value=""> --- Choose module --- </option>'.$options.'
								</select>
							</div>
							<div class="shopi-right">
								<label class="labelhook">Override hooks:</label>
								<select class="shopihook" name="shopihook_'.$tab['id_shopimultitab'].'" id="shopihook-'.$tab['id_shopimultitab'].'">
									<option value=""> --- Choose hook --- </option>'.$hookoptions.'
								</select>
							</div>
						</div>
					</div>';
						
			
			$str .= '</div>';
			$str .= '</div>';

			$str .= '
			<div class="form-group">
			<label class="control-label col-lg-3">Global Block:</label>
			<div class="col-lg-9">';
			$str .= '<input type="checkbox" value="1" name="global_'.$tab['id_shopimultitab'].'" '.($obj->global ? 'checked="checked"' : '').'>';
			$str .= '</div>';
			$str .= '</div>';
			$str .= '
			<div class="form-group">
				<div class="col-lg-9 col-lg-offset-3">
					<div class="alert alert-info">
						This option will allow to display this block on other products that are associated with selected categories (you can select categories below) 
					</div>
				</div>
			</div>
			';
			$str .= '
			<div class="form-group">
			<label class="control-label col-lg-3">Categories ID:</label>
			<div class="col-lg-9">';
			$str .= '<input type="text" name="categories_'.$tab['id_shopimultitab'].'" value="'.$obj->categories.'"> 
				<p>Example: 1,2,3</p>
				';
			$str .= '</div>';
			$str .= '</div>';
			/* END MODULE */
			$str .= '
			<div class="panel-footer">
				<a class="btn btn-default" href="index.php?controller=AdminProducts&amp;token=<PASSWORD>"><i class="process-icon-cancel"></i> Cancel</a>
				<button class="btn btn-default pull-right" name="submitAddproduct" type="submit"><i class="process-icon-save"></i> Save</button>
				<button class="btn btn-default pull-right" name="submitAddproductAndStay" type="submit"><i class="process-icon-save"></i> Save and stay</button>
			</div>
			';
			$str .= '</div>';
		}
		
		$iso = Language::getIsoById((int)(Context::getContext()->language->id));
		$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
		$adminfolder = HelperShopiMultiTab::getFolderAdmin();
		$ad = __PS_BASE_URI__.$adminfolder;
		$str .= '
		<script type="text/javascript">	
			var iso = \''.$isoTinyMCE.'\' ;
			var pathCSS = \''._THEME_CSS_DIR_.'\' ;
			var ad = \''.$ad.'\' ;
			tinySetup();
		</script>
		<script type="text/javascript">
			jQuery(document).ready(function($){
				$(\'.shopimodule\').change(function(){
					var module_name = $(this).find(\'option:selected\').val();
					var id_shopimultitab = $(this).parent().parent().find(\'.id_shopimultitab\').val();
					if(module_name){
						$.ajax({
							type: "POST",
							url: "'._MODULE_DIR_.'shopimultitabs/ajax.php?secure_key='.Tools::encrypt('shopimultitabs').'",
							data: "module_name="+module_name+"&task=gethook",
							success: function(data){
								select_innerHTML(document.getElementById("shopihook-" + id_shopimultitab),data);
							}
						});
					}
				});
			});
			function select_innerHTML(objeto,innerHTML){
				objeto.innerHTML = ""
				var selTemp = document.createElement("micoxselect")
				var opt;
				selTemp.id="micoxselect1"
				document.body.appendChild(selTemp)
				selTemp = document.getElementById("micoxselect1")
				selTemp.style.display="none"
				if(innerHTML.toLowerCase().indexOf("<option")<0){//se não é option eu converto
					innerHTML = "<option>" + innerHTML + "</option>"
				}
				innerHTML = innerHTML.toLowerCase().replace(/<option/g,"<span").replace(/<\/option/g,"</span")
				selTemp.innerHTML = innerHTML
				
				for(var i=0;i<selTemp.childNodes.length;i++){
			  var spantemp = selTemp.childNodes[i];
			  
					if(spantemp.tagName){     
						opt = document.createElement("OPTION")
				
			   if(document.all){ //IE
				objeto.add(opt)
			   }else{
				objeto.appendChild(opt)
			   }
			   //getting attributes
			   for(var j=0; j<spantemp.attributes.length ; j++){
				var attrName = spantemp.attributes[j].nodeName;
				var attrVal = spantemp.attributes[j].nodeValue;
				if(attrVal){
				 try{
				  opt.setAttribute(attrName,attrVal);
				  opt.setAttributeNode(spantemp.attributes[j].cloneNode(true));
				 }catch(e){}
				}
			   }
			   //getting styles
			   /*
			   if(spantemp.style){
				for(var y in spantemp.style){
				 try{opt.style[y] = spantemp.style[y];}catch(e){}
				}
			   }
			   */
			   //value and text
			   opt.value = spantemp.getAttribute("value")
			   opt.text = spantemp.innerHTML
			   //IE
			   opt.selected = spantemp.getAttribute(\'selected\');
			   //opt.className = spantemp.className;
			  }
			 }
			 document.body.removeChild(selTemp)
			 selTemp = null
			}
		</script>';
	}<file_sep>/ps_modules/modules_src/extrainfo/tr.php
<?php

global $_MODULE;
$_MODULE = array();
$_MODULE['<{extrainfo}prestashop>extrainfo_bfc328668da4835003808cdff4a09f5f'] = 'Ekstra Ürün Bilgi Sekmesi';
$_MODULE['<{extrainfo}prestashop>extrainfo_51ab1a6afddda78a3479c84c42e7ccb4'] = 'Ürün sayfası sekmelerine ekstra bilgi sekmesi ekler (www.cepparca.com | Kodlayan Caglar)';
$_MODULE['<{extrainfo}prestashop>extratab_bfc328668da4835003808cdff4a09f5f'] = 'EKSTRA BİLGİ';
$_MODULE['<{extrainfo}prestashop>extratabcontents_49ee3087348e8d44e1feda1917443987'] = 'Adı';
$_MODULE['<{extrainfo}prestashop>extratabcontents_a517747c3d12f99244ae598910d979c5'] = 'Yazar & Çizer';
$_MODULE['<{extrainfo}prestashop>extratabcontents_bc67a1507258a758c3a31e66d7ceff8f'] = 'Tedarikçi Referansı';
$_MODULE['<{extrainfo}prestashop>extratabcontents_9609dddf3618cff8f67b7829e6fc575e'] = 'ISBN';
$_MODULE['<{extrainfo}prestashop>extratabcontents_7608203603437f0513ba8203a2d39a4f'] = 'Ürün Kodu';
<file_sep>/ps_modules/modules_src/krmodule/display.php
<?php
/**
 * Created by Develjitsu.com.
 * User: <NAME>
 * Date: 18/08/16
 * Time: 17:56
 */

class krmoduledisplayModuleFrontController extends ModuleFrontController
{
    public function initContent()
    {
        parent::initContent();
        $this->setTemplate('display.tpl');
    }
}<file_sep>/ps_modules/modules_src/shopimultitabs/shopimultitabs.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

if (!defined('_PS_VERSION_'))
	exit;
include_once(dirname(__FILE__).'/defines.php');
include_once(dirname(__FILE__).'/classes/Shopimultitab.php');
include_once(dirname(__FILE__).'/classes/ShopimultitabContent.php');
include_once(dirname(__FILE__).'/libs/Helper.php');
class ShopiMultiTabs extends Module
{
	private $_html = '';
	public $base_config_url;
	public $tabcontent;
	
	public function __construct()
	{
		$this->name = 'shopimultitabs';
		$this->tab = 'front_office_features';
		$this->version = '2.0.0';
		$this->author = 'ShopiTheme';
		$this->module_key = '<KEY>';
		$this->secure_key = Tools::encrypt($this->name);
		$this->bootstrap = true;

		parent::__construct();
		$this->base_config_url = AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getValue('token');
		$this->displayName = $this->l('Shopi Multiple Tabs In Product Module');
		$this->description = $this->l('Shopi Multiple Product Tab Module');
	}
	
	public function install()
	{
		/* Adds Module */
		if (parent::install() && $this->registerHook('displayBackOfficeFooter') && $this->registerHook('actionProductSave') && $this->registerHook('actionProductDelete')
			&& $this->registerHook('displayBackOfficeHeader')
			&& $this->registerHook('displayProductTab') && $this->registerHook('displayProductTabContent') && $this->_installTradDone())
		{
			

			$shops = Shop::getContextListShopID();
			$shop_groups_list = array();

			/* Setup each shop */
			foreach ($shops as $shop_id)
			{
				$shop_group_id = (int)Shop::getGroupFromShop($shop_id, true);

				if (!in_array($shop_group_id, $shop_groups_list))
					$shop_groups_list[] = $shop_group_id;

				/* Sets up configuration */
				Configuration::updateValue('SHOPITYPE_TAB', '16', false, $shop_group_id, $shop_id);
				
			}

			/* Sets up Shop Group configuration */
			if (count($shop_groups_list))
				foreach ($shop_groups_list as $shop_group_id)
					Configuration::updateValue('SHOPITYPE_TAB', '16', false, $shop_group_id);

			/* Sets up Global configuration */
			Configuration::updateValue('SHOPITYPE_TAB', '16');

			return true;
		}
		return false;
	}
	
	private function _installTradDone()
	{
		$query = '';
		require_once(dirname(__FILE__).'/install/sql.tables.php');
	 	$error = true;
		if (isset($query) && !empty($query))
		{
			if (!($data=Db::getInstance()->ExecuteS( "SHOW TABLES LIKE '"._DB_PREFIX_."shopimultitab'" )))
			{
				$query = str_replace( '_DB_PREFIX_', _DB_PREFIX_, $query );
				$query = str_replace( '_MYSQL_ENGINE_', _MYSQL_ENGINE_, $query );
				$db_data_settings = preg_split("/;\s*[\r\n]+/",$query);
				foreach ($db_data_settings as $query)
				{
					$query = trim($query);
					if (!empty($query))
						if (!Db::getInstance()->Execute($query))
							$error = false;
				}
			}
		} 
		return $error;
	}
	/**
	 * @see Module::uninstall()
	 */
	public function uninstall()
	{
		/* Deletes Module */
		if (parent::uninstall())
			return true;
		return false;
	}

	public function getContent()
	{
		$errors = array();
		$this->_html .= $this->headerHTML();
		$this->_html .= '<h2>'.$this->displayName.'.</h2>';
		$shop_context = Shop::getContext();
		if (Tools::isSubmit('submitSettings'))
		{
			$shop_groups_list = array();
			$shops = Shop::getContextListShopID();

			foreach ($shops as $shop_id)
			{
				$shop_group_id = (int)Shop::getGroupFromShop($shop_id, true);

				if (!in_array($shop_group_id, $shop_groups_list))
					$shop_groups_list[] = $shop_group_id;

				$res = Configuration::updateValue('SHOPITYPE_TAB', (int)Tools::getValue('SHOPITYPE_TAB'), false, $shop_group_id, $shop_id);
			}

			/* Update global shop context if needed*/
			switch ($shop_context)
			{
				case Shop::CONTEXT_ALL:
					$res = Configuration::updateValue('SHOPITYPE_TAB', (int)Tools::getValue('SHOPITYPE_TAB'));
					if (count($shop_groups_list))
					{
						foreach ($shop_groups_list as $shop_group_id)
							$res = Configuration::updateValue('SHOPITYPE_TAB', (int)Tools::getValue('SHOPITYPE_TAB'), false, $shop_group_id);
					}
					break;
				case Shop::CONTEXT_GROUP:
					if (count($shop_groups_list))
					{
						foreach ($shop_groups_list as $shop_group_id)
							$res = Configuration::updateValue('SHOPITYPE_TAB', (int)Tools::getValue('SHOPITYPE_TAB'), false, $shop_group_id);
					}
					break;
			}

		}
		if (Tools::isSubmit('submitSaveTab'))
		{
			$id_default_language = (int)Configuration::get('PS_LANG_DEFAULT');
			$title_default = Tools::getValue('title_'.$id_default_language);
			if ($title_default)
				if (Tools::getValue('id_shopimultitab'))
				{
					if (Validate::isLoadedObject($obj = new Shopimultitab((int)Tools::getValue('id_shopimultitab'))))
					{
						$obj->active = Tools::getValue('active_tab');
						$languages = Language::getLanguages(false);
						foreach ($languages as $language)
							if (Tools::getValue('title_'.$language['id_lang']) != '')
								$obj->title[$language['id_lang']] = Tools::getValue('title_'.$language['id_lang']);
						if (!$obj->update())
							$errors[] = $this->l('Tabs could not be updated');
					}
					else
						$errors[] = $this->l('Tabs could not be updated');
				}
				else
				{
					$obj = new Shopimultitab();
					$obj->active = Tools::getValue('active_tab');
					$languages = Language::getLanguages(false);
					foreach ($languages as $language)
						if (Tools::getValue('title_'.$language['id_lang']) != '')
							$obj->title[$language['id_lang']] = Tools::getValue('title_'.$language['id_lang']);
					if (!$obj->add())
						$errors[] = $this->l('Tabs could not be create');
				}
			else
				$errors[] = $this->l('You have to enter title for default language');

			if (count($errors))
				$this->_html .= $this->displayError(implode('<br />', $errors));
			else
				Tools::redirectAdmin($this->base_config_url);
		}
		elseif (Tools::getIsset('changeStatus'))
		{
			$obj = new Shopimultitab((int)Tools::getValue('id_shopimultitab'));
			if ($obj->active == 0)
				$obj->active = 1;
			else
				$obj->active = 0;
			$res = $obj->update();
			
			$this->_html .= ($res ? $this->displayConfirmation($this->l('Status updated')) : $this->displayError($this->l('Status could not be updated')));
		}
		elseif (Tools::getIsset('deleteTab'))
		{
			$obj = new Shopimultitab((int)Tools::getValue('id_shopimultitab'));
			$res = $obj->delete();
			if (!$res)
				$this->_html .= $this->displayError('Could not delete');
			else
				$this->_html .= $this->displayConfirmation($this->l('Tab deleted'));
		}
		if (Tools::getIsset('addTab'))
			$this->_html .= $this->_displayForm();
		else
		{
			$this->_html .= $this->renderForm();
			$this->_html .= $this->_displayList();
		}

		return $this->_html;
	}
	
	public function contentTabs($id_product)
	{
		$str = '';
		require_once ( dirname(__FILE__).'/form.php' );
		
		return $str;
	}
	
	public function strHook($module_name)
	{
		$hooks = HelperShopiMultiTab::getHooksByModuleName( $module_name );
		$options = '';
		if (!empty($hooks))
			foreach ($hooks as $hook)
				$options .= '<option value="'.$hook['name'].'">'.$hook['name'].'</option>';
		
		return $options;
	}
	
	public function renderForm()
	{
		$this->context->controller->addJS( ($this->_path).'views/js/config.js' );
		$types = array(
			0 => array('value' => '15', 'name' => $this->l('Like default tabs in PrestaShop 1.5')),
            1 => array('value' => '16', 'name' => $this->l('Like default tabs in PrestaShop 1.6')),
		);
		$img15 = _MODULE_DIR_.$this->name.'/views/img/15.png';
		$img16 = _MODULE_DIR_.$this->name.'/views/img/16.png';
		$fields_form = array(
			'form' => array(
				'legend' => array(
					'title' => $this->l('Settings'),
					'icon' => 'icon-cogs'
				),
				'input' => array(
					array(
                        'type' => 'select',
                        'label' => $this->l('Type of tabs:'),
                        'name' => 'SHOPITYPE_TAB',
                        'options' => array(
                            'query' => $types,
                            'id' => 'value',
                            'name' => 'name'
                        ),
                        'desc' => '<br><div class="shopitype shopitype_15"><img src="'.$img15.'" alt="15"/></div>
                        		<div class="shopitype shopitype_16"><img src="'.$img16.'" alt="16"/></div>'
                    )
				),
				'submit' => array(
					'title' => $this->l('Save'),
				)
			),
		);

		$helper = new HelperForm();
		$helper->show_toolbar = false;
		$helper->table = $this->table;
		$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
		$helper->default_form_language = $lang->id;
		$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
		$this->fields_form = array();

		$helper->identifier = $this->identifier;
		$helper->submit_action = 'submitSettings';
		$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
		$helper->token = Tools::getAdminTokenLite('AdminModules');
		$helper->tpl_vars = array(
			'fields_value' => $this->getConfigFieldsValues(),
			'languages' => $this->context->controller->getLanguages(),
			'id_language' => $this->context->language->id
		);

		return $helper->generateForm(array($fields_form));
	}

	public function getConfigFieldsValues()
	{
		$id_shop_group = Shop::getContextShopGroupID();
		$id_shop = Shop::getContextShopID();

		return array(
			'SHOPITYPE_TAB' => Tools::getValue('SHOPITYPE_TAB', Configuration::get('SHOPITYPE_TAB', null, $id_shop_group, $id_shop)),
		);
	}

	public function _displayList()
	{
		$obj = new Shopimultitab();
		$tabs = $obj->getTabs();
		foreach ($tabs as $key => $slide)
			$tabs[$key]['status'] = $this->displayStatus($slide['id_shopimultitab'], $slide['active']);

		$this->context->smarty->assign(
			array(
				'link' => $this->context->link,
				'tabs' => $tabs
			)
		);

		return $this->display(__FILE__, 'list.tpl');
	}

	public function _displayForm()
	{
		$fields_form = array(
			'form' => array(
				'legend' => array(
					'title' => $this->l('Tab information'),
					'icon' => 'icon-cogs'
				),
				'input' => array(
					array(
						'type' => 'text',
						'label' => $this->l('Tab Title'),
						'name' => 'title',
						'lang' => true,
					),
					array(
						'type' => 'switch',
						'label' => $this->l('Enabled'),
						'name' => 'active_tab',
						'is_bool' => true,
						'values' => array(
							array(
								'id' => 'active_on',
								'value' => 1,
								'label' => $this->l('Yes')
							),
							array(
								'id' => 'active_off',
								'value' => 0,
								'label' => $this->l('No')
							)
						),
					),
				),
				'submit' => array(
					'title' => $this->l('Save'),
				)
			),
		);

		if (Tools::isSubmit('id_shopimultitab') && $this->slideExists((int)Tools::getValue('id_shopimultitab')))
		{
			$slide = new Shopimultitab((int)Tools::getValue('id_shopimultitab'));
			$fields_form['form']['input'][] = array('type' => 'hidden', 'name' => 'id_shopimultitab');
		}

		$helper = new HelperForm();
		$helper->show_toolbar = false;
		$helper->table = $this->table;
		$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
		$helper->default_form_language = $lang->id;
		$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
		$this->fields_form = array();
		$helper->module = $this;
		$helper->identifier = $this->identifier;
		$helper->submit_action = 'submitSaveTab';
		$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
		$helper->token = Tools::getAdminTokenLite('AdminModules');
		$language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
		$helper->tpl_vars = array(
			'base_url' => $this->context->shop->getBaseURL(),
			'language' => array(
				'id_lang' => $language->id,
				'iso_code' => $language->iso_code
			),
			'fields_value' => $this->getAddFieldsValues(),
			'languages' => $this->context->controller->getLanguages(),
			'id_language' => $this->context->language->id
		);

		return $helper->generateForm(array($fields_form));
	}

	public function displayStatus($id_shopimultitab, $active)
	{
		$title = ((int)$active == 0 ? $this->l('Disabled') : $this->l('Enabled'));
		$img = ((int)$active == 0 ? 'disabled.gif' : 'enabled.gif');
		$html = '<a href="'.AdminController::$currentIndex.
				'&configure='.$this->name.'
				&token='.Tools::getAdminTokenLite('AdminModules').'
				&changeStatus&id_shopimultitab='.(int)$id_shopimultitab.'" title="'.$title.'"><img src="'._PS_ADMIN_IMG_.''.$img.'" alt="" /></a>';
		return $html;
	}

	public function getAddFieldsValues()
	{
		$fields = array();

		if (Tools::isSubmit('id_shopimultitab') && $this->slideExists((int)Tools::getValue('id_shopimultitab')))
		{
			$slide = new Shopimultitab((int)Tools::getValue('id_shopimultitab'));
			$fields['id_shopimultitab'] = (int)Tools::getValue('id_shopimultitab', $slide->id);
		}
		else
			$slide = new Shopimultitab();

		$fields['active_tab'] = Tools::getValue('active_tab', $slide->active);
		$fields['has_picture'] = true;

		$languages = Language::getLanguages(false);

		foreach ($languages as $lang)
			$fields['title'][$lang['id_lang']] = Tools::getValue('title_'.(int)$lang['id_lang'], $slide->title[$lang['id_lang']]);

		return $fields;
	}

	public function slideExists($id_shopimultitab)
	{
		$req = 'SELECT hs.`id_shopimultitab`
				FROM `'._DB_PREFIX_.'shopimultitab` hs
				WHERE hs.`id_shopimultitab` = '.(int)$id_shopimultitab;
		$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req);

		return ($row);
	}
	
	public function headerHTML()
	{
		if (Tools::getValue('controller') != 'AdminModules' && Tools::getValue('configure') != $this->name)
			return;

		$this->context->controller->addJqueryUI('ui.sortable');
		/* Style & js for fieldset 'slides configuration' */
		$html = '<script type="text/javascript">
			$(function() {
				var $myTabs = $("#tabs");
				$myTabs.sortable({
					opacity: 0.6,
					cursor: "move",
					update: function() {
						var order = $(this).sortable("serialize") + "&task=updatePosition";
						$.post("'.$this->context->shop->physical_uri.$this->context->shop->virtual_uri.'modules/'.$this->name.'/ajax.php?secure_key='.$this->secure_key.'", order);
						}
					});
				$myTabs.hover(function() {
					$(this).css("cursor","move");
					},
					function() {
					$(this).css("cursor","auto");
				});
			});
		</script>';

		return $html;
	}

	public function hookdisplayBackOfficeHeader()
	{
		return '<link href="'._MODULE_DIR_.$this->name.'/views/css/admin.css" rel="stylesheet" type="text/css" media="all" />';
	}
	
	public function hookactionProductSave($params)
	{
		$tabs = Shopimultitab::getTabs();
		$languages = Language::getLanguages(false);
		$content = array();
		if (!$tabs)
			return true;
		foreach ($tabs as $tab)
		{
			$content_text = array();
			foreach ($languages as $lang)
				$content_text[$lang['id_lang']] = Tools::getValue('shopicontent_text_'.$tab['id_shopimultitab'].'_'.$lang['id_lang']);
			
			if (Tools::getValue('id_shopimultitab_content_'.$tab['id_shopimultitab']))
				$obj = new ShopimultitabContent((int)Tools::getValue('id_shopimultitab_content_'.$tab['id_shopimultitab']));
			else
				$obj = new ShopimultitabContent();
			$obj->id_shopimultitab = $tab['id_shopimultitab'];
			$obj->id_product = $params['id_product'];
			$obj->content_text = $content_text;
			$obj->categories = Tools::getValue('categories_'.$tab['id_shopimultitab']);
			$obj->global = (int)Tools::getValue('global_'.$tab['id_shopimultitab']);

			$shopimodule = Tools::getValue('shopimodule_'.$tab['id_shopimultitab'], '');
			$shopihook = Tools::getValue('shopihook_'.$tab['id_shopimultitab'], '');
			if ($shopimodule && $shopihook)
				$obj->content = $shopimodule.':'.$shopihook;
			
			if (Tools::getValue('id_shopimultitab_content_'.$tab['id_shopimultitab']))
				$obj->update();
			else
				if (!(ShopimultitabContent::checkExist( $tab['id_shopimultitab'], $params['id_product'] )))
					$obj->add();
		}
	}
	
	public function hookactionProductDelete($params)
	{
		if (!$params['id_product'])
			return '';
		$shopicontent = ShopimultitabContent::getContents(null, $params['id_product']);
		if (!$shopicontent)
			return '';
		foreach ($shopicontent as $content)
		{
			$obj = new ShopimultitabContent($content['id_shopimultitab_content']);
			$obj->delete();
		}
	}
	
	public function hookdisplayBackOfficeFooter()
	{
		$this->context->smarty->assign(array(
			'back_url' => _MODULE_DIR_.$this->name.'/ajax.php?secure_key='.$this->secure_key,
			'shopi_id_product' => (int)Tools::getValue('id_product')
		));
		if (Tools::strtolower(Tools::getValue('controller')) == Tools::strtolower('adminproducts'))
			return $this->display(__FILE__, 'backofficefooter.tpl' );
		return '';
	}

	public function getGlobalContent($global_contents, $categories)
	{
		if ($global_contents)
		{
			foreach ($global_contents as $global_content)
			{
				$gcategories = $global_content['categories'];
				if ($gcategories)
				{
					$gcategories = explode(',', $gcategories);
					foreach ($gcategories as $id_category)
						if (in_array($id_category, $categories))
							return $global_content;
				}
			}
		}
		return false;
	}

	public function hookdisplayProductTab()
	{
		if (!$this->tabcontent)
		{
			$id_product = (int)(Tools::getValue('id_product'));
			$tabs = Shopimultitab::getTabs( true );
			if (!$tabs)
				return '';
			foreach ($tabs as &$tab)
			{
				$categories = Product::getProductCategories($id_product);
				$global_contents = ShopimultitabContent::getContents($tab['id_shopimultitab'], null, true);
				$content = $this->getGlobalContent($global_contents, $categories);
				if (!$content)
					$content = ShopimultitabContent::getContent($tab['id_shopimultitab'], $id_product);
				if ($content)
				{
					$content['module'] = HelperShopiMultiTab::execModule($content['content']);
					if ($content['module'] || $content['content_text'])
						$tab['contenttab'] = $content;
				}
			}
			$this->tabcontent = $tabs;
		}
		if (!$this->tabcontent) 
			return '';
		$this->context->smarty->assign(array(
			'shopimultitabs_tabs' => $this->tabcontent
		));
		
		if (Configuration::get('SHOPITYPE_TAB') == 15)
            return $this->display(__FILE__, 'producttabs.tpl');
        else
            return $this->display(__FILE__, 'producttabs16.tpl');
	}
	
	public function hookdisplayProductTabContent()
	{
		$this->context->controller->addCSS( ($this->_path).'views/css/style.css', 'all' );
		if (!$this->tabcontent)
		{
			$tabs = Shopimultitab::getTabs( true );
			if (!$tabs) 
				return '';
			$id_product = Tools::getValue('id_product');
			foreach ($tabs as &$tab)
			{
				$categories = Product::getProductCategories($id_product);
				$global_contents = ShopimultitabContent::getContents($tab['id_shopimultitab'], null, true);
				$content = $this->getGlobalContent($global_contents, $categories);
				if (!$content)
					$content = ShopimultitabContent::getContent($tab['id_shopimultitab'], $id_product);
				if ($content)
				{
					$content['module'] = HelperShopiMultiTab::execModule($content['content']);
					if ($content['module'] || $content['content_text'])
						$tab['contenttab'] = $content;
				}
			}
			$this->tabcontent = $tabs;
		}
		if (!$this->tabcontent)
			return '';
		$this->context->smarty->assign(array(
			'shopimultitabs_tabs' => $this->tabcontent
		));

		if (Configuration::get('SHOPITYPE_TAB') == 15)
            return $this->display(__FILE__, 'producttabscontent.tpl');
        return '';
	}
	
	
}
<file_sep>/ps_modules/modules_src/shopimultitabs/ajax.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

include_once('../../config/config.inc.php');
include_once('../../init.php');
include_once( dirname(__FILE__).'/shopimultitabs.php' );
$obj = new shopimultitabs();

if (Tools::getValue('secure_key') == $obj->secure_key && Tools::getValue('task') == 'tab')
{
	$tabs = Shopimultitab::getTabs();
	$str = '';
	if ($tabs)
	{
		foreach ($tabs as $tab)
			$str .= '<a class="list-group-item shopi-tab-row" href="javascript:void(0)" id="link-shopi-tab-'.$tab['id_shopimultitab'].'" rel="shopi-tab-'.$tab['id_shopimultitab'].'">'.$tab['title'].'</a>';
	}
	die($str);
}
if (Tools::getValue('secure_key') == $obj->secure_key && Tools::getValue('task') == 'content')
{
	$id_product = Tools::getValue('id_product');
	$str = $obj->contentTabs($id_product);
	die('<script type="text/javascript" src="'._MODULE_DIR_.$obj->name.'/views/js/general.js"></script>'.$str);
}
if (Tools::getValue('secure_key') == $obj->secure_key && Tools::getValue('task') == 'updatePosition')
{
	
	$tabs = Tools::getValue('tabs');
	foreach ($tabs as $position => $id_shopimultitab)
	{
		$res = Db::getInstance()->execute('
			UPDATE `'._DB_PREFIX_.'shopimultitab` SET `position` = '.(int)$position.'
			WHERE `id_shopimultitab` = '.(int)$id_shopimultitab
		);
	}
}
if (Tools::getValue('secure_key') == $obj->secure_key && Tools::getValue('task') == 'gethook')
{
	$module_name = Tools::getValue('module_name');
	$str = $obj->strHook($module_name);
	die($str);
}
<file_sep>/ps_modules/modules_src/shopimultitabs/defines.php
<?php
/**
 *  Shopi Multiple Tabs In Product Module
 *
 * @author    ShopiTheme;
 * @copyright Copyright (C) October 2013 prestabrain.com <@emai:<EMAIL>>;
 * @license   GNU General Public License version 2;
 */

define('SHOPI_MULTITAB_MODULE_NAME', 'shopimultitabs');
<file_sep>/ps_modules/modules_src/shopimultitabs/Readme.md
# Shopi Multiple Product Tab Module

## About

Shopi Multiple Product Tab Module, extra tab


