Location: PHPKode > projects > HikaShop > back/controllers/menus.php
<?php
/**
 * @package		HikaShop for Joomla!
 * @version		1.4.3
 * @author		hikashop.com
 * @copyright	(C) 2010 HIKARI SOFTWARE. All rights reserved.
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php
class MenusController extends hikashopController{
	var $toggle = array();
	var $type='menus';
	function __construct(){
		parent::__construct();
		$this->modify[]='add_module';
	}
	function add_module(){
		$id = hikashop::getCID('id');
		$name = 'menu_'.$id;
		$config =& hikashop::config();
		$params = $config->get($name);
		if($params['content_type']=='category'&&empty($params['modules'])){
			$default_params = $config->get('default_params');
			$default_params['content_type'] = 'product';
			$default_params['layout_type']='div';
			$default_params['content_synchronize']='1';
			if($default_params['columns']==1){
				$default_params['columns']=3;
			}
			$module = null;
			$module->hikashop_params = $default_params;
			$module->title = 'Product listing for category listing menu '.$id;
			$module->published=0;
			$module->position='left';
			$module->ordering=0;
			$module->module='mod_hikashop';
			$module->client_id=0;
			$class = hikashop::get('class.modules');
			$module_id = $class->save($module);
			if(!empty($module_id)){
				$configData=null;
				$params['modules']=$module_id;
				$configData->$name = $params;
				if($config->save($configData)){
					$config->set($name,$params);
					$app =& JFactory::getApplication();
					$app->enqueueMessage('HIKASHOP_SUCC_SAVED');
				}
			}
		}
		$this->listing();
	}
}
Return current item: HikaShop