Página 1 de 1

Modulo para Login

Enviado: 10 Nov 2011, 10:54
por shadow_d2
Olá pessoal,

Não estou conseguindo fazer aparecer o modulo no view...

Eu peguei um modulo para login, mas ele é para uma versao anterior do OC.
Estou atualizando aqui me baseando nos outros modulos.

Preciso colocar o modulo no header da pagina com um dropdown: http://teste.myhomestyle.com.br/
Se alguém puder me ajudar ficarei grato.

Segue o code:

admin->controller->module->login.php
Código: Selecionar todos
<?php
class ControllerModuleLogin extends Controller {
	private $error = array(); 
	
	public function index() {   
		$this->load->language('module/login');

		$this->document->setTitle($this->language->get('heading_title'));
		
		$this->load->model('setting/setting');
				
		if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validate())) {
			$this->model_setting_setting->editSetting('login', $this->request->post);		
					
			$this->session->data['success'] = $this->language->get('text_success');
						
			//$this->redirect((((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=extension/module'));
			$this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
		}
				
		$this->data['heading_title'] = $this->language->get('heading_title');

		$this->data['text_enabled'] = $this->language->get('text_enabled');
		$this->data['text_disabled'] = $this->language->get('text_disabled');
		$this->data['text_left'] = $this->language->get('text_left');
		$this->data['text_right'] = $this->language->get('text_right');
		
		$this->data['entry_position'] = $this->language->get('entry_position');
		$this->data['entry_status'] = $this->language->get('entry_status');
		$this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
		
		$this->data['button_save'] = $this->language->get('button_save');
		$this->data['button_cancel'] = $this->language->get('button_cancel');

		$this->data['tab_general'] = $this->language->get('tab_general');

 		if (isset($this->error['warning'])) {
			$this->data['error_warning'] = $this->error['warning'];
		} else {
			$this->data['error_warning'] = '';
		}

		$this->data['breadcrumbs'] = array();
  		//$this->document->breadcrumbs = array();

   		$this->data['breadcrumbs'][] = array(
				'href' 		=> $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
       		//'href'      => (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=common/home'),
       		'text'      => $this->language->get('text_home'),
      		'separator' => FALSE
   		);

   		$this->data['breadcrumbs'][] = array(
				'href' 		=> $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
       		//'href'      => (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=extension/module'),
       		'text'      => $this->language->get('text_module'),
      		'separator' => ' :: '
   		);
		
   		$this->data['breadcrumbs'][] = array(
				'href' 		=> $this->url->link('module/login', 'token=' . $this->session->data['token'], 'SSL'),
       		//'href'      => (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=module/login'),
       		'text'      => $this->language->get('heading_title'),
      		'separator' => ' :: '
   		);
		
		$this->data['action'] = $this->url->link('module/login', 'token=' . $this->session->data['token'], 'SSL');
		
		$this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

		/*$this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=module/login');
		
		$this->data['cancel'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=extension/module');*/

		if (isset($this->request->post['login_position'])) {
			$this->data['login_position'] = $this->request->post['login_position'];
		} else {
			$this->data['login_position'] = $this->config->get('login_position');
		}
		
		if (isset($this->request->post['login_status'])) {
			$this->data['login_status'] = $this->request->post['login_status'];
		} else {
			$this->data['login_status'] = $this->config->get('login_status');
		}
		
		if (isset($this->request->post['login_sort_order'])) {
			$this->data['login_sort_order'] = $this->request->post['login_sort_order'];
		} else {
			$this->data['login_sort_order'] = $this->config->get('login_sort_order');
		}				
		
		$this->load->model('design/layout');
		
		$this->data['layouts'] = $this->model_design_layout->getLayouts();

		$this->template = 'module/login.tpl';
		$this->children = array(
			'common/header',
			'common/footer',
			'common/footer'
		);
				
		$this->response->setOutput($this->render());

		/*$this->id       = 'content';
		$this->template = 'module/login.tpl';
		if (file_exists(DIR_SYSTEM . 'engine/action.php')) { //v1.4.0
            $this->children = array(
                'common/header',
                'common/footer'
            );
            $this->response->setOutput($this->render(TRUE));
        } elseif ($this->config->get('config_guest_checkout') != null) { //v1.3.4
            $this->children = array(
                'common/header',
                'common/menu',
                'common/footer'
            );
            $this->response->setOutput($this->render(TRUE));
        } else { //v1.3.2 or less
            $this->layout   = 'common/layout';
            $this->render();
        }*/
	}
	
	private function validate() {
		if (!$this->user->hasPermission('modify', 'module/login')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}
		
		if (!$this->error) {
			return TRUE;
		} else {
			return FALSE;
		}	
	}
}
?>
admin->view->template->module->login.tpl
Código: Selecionar todos
<?php echo $header; ?>
<div id="content">
	<div class="breadcrumb">
	  <?php foreach ($breadcrumbs as $breadcrumb) { ?>
	  <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
	  <?php } ?>
	</div>

	<?php if ($error_warning) { ?>
	<div class="warning"><?php echo $error_warning; ?></div>
	<?php } ?>

	<div class="box">
	  <div class="heading">
		 <h1><img src="view/image/shipping.png" /> <?php echo $heading_title; ?></h1>

		 <div class="buttons">
			<a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a>
			<a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a>
		 </div>
	  </div>
	<div class="content">
		<!--div class="tabs htabs"><a tab="#tab_general"><?php echo $tab_general; ?></a></div-->
	<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
	  <div id="tab_general" class="page">
		 <table class="form">
		 	<tr>
			  <td width="25%"><?php echo $entry_position; ?></td>
			  <td><select name="login_position">
					<?php if ($login_position == 'column_left') { ?>
					<option value="column_left" selected="selected"><?php echo $text_left; ?></option>
					<?php } else { ?>
					<option value="column_left"><?php echo $text_left; ?></option>
					<?php } ?>
					<?php if ($login_position == 'column_right') { ?>
					<option value="column_right" selected="selected"><?php echo $text_right; ?></option>
					<?php } else { ?>
					<option value="column_right"><?php echo $text_right; ?></option>
					<?php } ?>
				 </select>
				</td>
			</tr>
			<tr>
			  <td><?php echo $entry_status; ?></td>
			  <td><select name="login_status">
					<?php if ($login_status) { ?>
					<option value="1" selected="selected"><?php echo $text_enabled; ?></option>
					<option value="0"><?php echo $text_disabled; ?></option>
					<?php } else { ?>
					<option value="1"><?php echo $text_enabled; ?></option>
					<option value="0" selected="selected"><?php echo $text_disabled; ?></option>
					<?php } ?>
				 </select></td>
			</tr>
			<tr>
			  <td><?php echo $entry_sort_order; ?></td>
			  <td><input type="text" name="login_sort_order" value="<?php echo $login_sort_order; ?>" size="1" /></td>
			</tr>
		 </table>
	  </div>
	</form>
	</div>
	<!--script type="text/javascript"><!--
	$.tabs('.tabs a'); 
	//--></script-->
</div>
<?php echo $footer; ?>
catalog->controller->module->login.php
Código: Selecionar todos
<?php  
class ControllerModuleLogin extends Controller {
	protected function index() {
		$this->language->load('module/login');

      	$this->data['heading_title'] = $this->language->get('heading_title');
		
		$this->data['entry_email_address'] = $this->language->get('entry_email_address');
		$this->data['entry_password'] = $this->language->get('entry_password');
		
		$this->data['button_login'] = $this->language->get('button_login');
		$this->data['button_logout'] = $this->language->get('button_logout');
		$this->data['button_create'] = $this->language->get('button_create');
		
		//$this->data['action'] = (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/login');
		$this->data['action'] = $this->url->link('account/login', '', 'SSL');
 		
		$this->id       = 'login';
		
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/login.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/login.tpl';
		} else {
			$this->template = 'default/template/module/login.tpl';
		}

		//$this->template = $this->config->get('config_template') . 'module/login.tpl';
		/*if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/login.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/login.tpl';
        } elseif (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . 'module/login.tpl')) { //v1.3.2
				$this->template = $this->config->get('config_template') . 'module/login.tpl';
		} else {
            $this->template = 'default/template/module/login.tpl';
        }*/
		
		$this->render();
		
	}
}
?>
catalog->view->theme->default->template->module->login.tpl
Código: Selecionar todos
<!--?php if (!$this->customer->isLogged()) { ?-->
<div class="box">
  <div class="top"><img src="catalog/view/theme/default/image/icon_user.png" alt="" /><?php echo $heading_title; ?></div>
  <div class="middle" style="text-align: left;">
	
	<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="module_login"> 
	<b><?php echo $entry_email_address; ?></b><br />
    <span style="text-align: left;"><input type="text" name="email" /></span>
    <br />
    <b><?php echo $entry_password; ?></b><br />
    <input type="password" name="password" />
        <br />
    <div style="float:left; text-align: right;"><a href="<?php echo (((HTTPS_SERVER) ? HTTPS_SERVER : HTTP_SERVER) . 'index.php?route=account/create');?>" class="button"><span><?php echo $button_create; ?></span></a></div>
    <div style="float:left; text-align: right;"><a onclick="$('#module_login').submit();" class="button"><span><?php echo $button_login; ?></span></a></div>
    <br style="clear:both;"/>
    </form>
  </div>
	
  <script type="text/javascript"><!--
  $('#module_login input').keydown(function(e) {
	  if (e.keyCode == 13) {
		  $('#module_login').submit();
	  }
  });
  //--></script>
  <div class="bottom">&nbsp;</div>
</div>
<!--?php } ?-->

Re: Modulo para Login

Enviado: 11 Nov 2011, 18:16
por clebersandri
Alguem consegui por o módulo de loguin nas laterais da versão 1.5.1.2?
Se alguem conseguiu, como se faz?