Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Помогите вывести форму входа на главную страницу


Recommended Posts

Приветствую всех, на странице домен.ру/login/ выводится форма входа или предложение зарегистрироваться - стандартные.

 

Я хочу вывести ту же самую форму на главной странице, путем полной замены файлов в модуле "Аккаунт", которым не пользуюсь.

 

Внешний вид получается взял из default/template/account/login.tpl и поставил в файл default/template/module/account.tpl

 

Отображается нормально, но не взаимодействует с сайтом. Ввожу данные, страница обновляется, но в аккаунт не входит и уведомления не появляются.

 

Попробовал скопировать из controller/account/login.php в default/template/module/account.php - сайт не открывается.

Прошу помочь, как настроить верно?

 

Вот файл: login.php

class ControllerAccountLogin extends Controller {
private $error = array();

public function index() {
$this->load->model('account/customer');

// Login override for admin users
if (!empty($this->request->get['token'])) {
$this->customer->logout();
$this->cart->clear();

unset($this->session->data['wishlist']);
unset($this->session->data['shipping_address_id']);
unset($this->session->data['shipping_country_id']);
unset($this->session->data['shipping_zone_id']);
unset($this->session->data['shipping_postcode']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['payment_address_id']);
unset($this->session->data['payment_country_id']);
unset($this->session->data['payment_zone_id']);
unset($this->session->data['payment_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['comment']);
unset($this->session->data['order_id']);
unset($this->session->data['coupon']);
unset($this->session->data['reward']);
unset($this->session->data['voucher']);
unset($this->session->data['vouchers']);

$customer_info = $this->model_account_customer->getCustomerByToken($this->request->get['token']);

if ($customer_info && $this->customer->login($customer_info['email'], '', true)) {
// Default Addresses
$this->load->model('account/address');

$address_info = $this->model_account_address->getAddress($this->customer->getAddressId());

if ($address_info) {
if ($this->config->get('config_tax_customer') == 'shipping') {
$this->session->data['shipping_country_id'] = $address_info['country_id'];
$this->session->data['shipping_zone_id'] = $address_info['zone_id'];
$this->session->data['shipping_postcode'] = $address_info['postcode'];
}

if ($this->config->get('config_tax_customer') == 'payment') {
$this->session->data['payment_country_id'] = $address_info['country_id'];
$this->session->data['payment_zone_id'] = $address_info['zone_id'];
}
} else {
unset($this->session->data['shipping_country_id']);
unset($this->session->data['shipping_zone_id']);
unset($this->session->data['shipping_postcode']);
unset($this->session->data['payment_country_id']);
unset($this->session->data['payment_zone_id']);
}

$this->redirect($this->url->link('account/account', '', 'SSL'));
}
}

if ($this->customer->isLogged()) {
$this->redirect($this->url->link('account/account', '', 'SSL'));
}

$this->language->load('account/login');

$this->document->setTitle($this->language->get('heading_title'));

if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
unset($this->session->data['guest']);

// Default Shipping Address
$this->load->model('account/address');

$address_info = $this->model_account_address->getAddress($this->customer->getAddressId());

if ($address_info) {
if ($this->config->get('config_tax_customer') == 'shipping') {
$this->session->data['shipping_country_id'] = $address_info['country_id'];
$this->session->data['shipping_zone_id'] = $address_info['zone_id'];
$this->session->data['shipping_postcode'] = $address_info['postcode'];
}

if ($this->config->get('config_tax_customer') == 'payment') {
$this->session->data['payment_country_id'] = $address_info['country_id'];
$this->session->data['payment_zone_id'] = $address_info['zone_id'];
}
} else {
unset($this->session->data['shipping_country_id']);
unset($this->session->data['shipping_zone_id']);
unset($this->session->data['shipping_postcode']);
unset($this->session->data['payment_country_id']);
unset($this->session->data['payment_zone_id']);
}

// Added strpos check to pass McAfee PCI compliance test (http://forum.opencart.com/viewtopic.php?f=10&t=12043&p=151494#p151295)
if (isset($this->request->post['redirect']) && (strpos($this->request->post['redirect'], $this->config->get('config_url')) !== false || strpos($this->request->post['redirect'], $this->config->get('config_ssl')) !== false)) {
$this->redirect(str_replace('&', '&', $this->request->post['redirect']));
} else {
$this->redirect($this->url->link('account/account', '', 'SSL'));
}
}

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

$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home'),
'separator' => false
);

$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_account'),
'href' => $this->url->link('account/account', '', 'SSL'),
'separator' => $this->language->get('text_separator')
);

$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_login'),
'href' => $this->url->link('account/login', '', 'SSL'),
'separator' => $this->language->get('text_separator')
);

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

$this->data['text_new_customer'] = $this->language->get('text_new_customer');
$this->data['text_register'] = $this->language->get('text_register');
$this->data['text_register_account'] = $this->language->get('text_register_account');
$this->data['text_returning_customer'] = $this->language->get('text_returning_customer');
$this->data['text_i_am_returning_customer'] = $this->language->get('text_i_am_returning_customer');
$this->data['text_forgotten'] = $this->language->get('text_forgotten');

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

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

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

$this->data['action'] = $this->url->link('account/login', '', 'SSL');
$this->data['register'] = $this->url->link('account/register', '', 'SSL');
$this->data['forgotten'] = $this->url->link('account/forgotten', '', 'SSL');

// Added strpos check to pass McAfee PCI compliance test (http://forum.opencart.com/viewtopic.php?f=10&t=12043&p=151494#p151295)
if (isset($this->request->post['redirect']) && (strpos($this->request->post['redirect'], $this->config->get('config_url')) !== false || strpos($this->request->post['redirect'], $this->config->get('config_ssl')) !== false)) {
$this->data['redirect'] = $this->request->post['redirect'];
} elseif (isset($this->session->data['redirect'])) {
$this->data['redirect'] = $this->session->data['redirect'];

unset($this->session->data['redirect']);
} else {
$this->data['redirect'] = '';
}

if (isset($this->session->data['success'])) {
$this->data['success'] = $this->session->data['success'];

unset($this->session->data['success']);
} else {
$this->data['success'] = '';
}

if (isset($this->request->post['email'])) {
$this->data['email'] = $this->request->post['email'];
} else {
$this->data['email'] = '';
}

if (isset($this->request->post['password'])) {
$this->data['password'] = $this->request->post['password'];
} else {
$this->data['password'] = '';
}

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/login.tpl')) {
$this->template = $this->config->get('config_template') . '/template/account/login.tpl';
} else {
$this->template = 'default/template/account/login.tpl';
}

$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);

$this->response->setOutput($this->render());
}

protected function validate() {
if (!$this->customer->login($this->request->post['email'], $this->request->post['password'])) {
$this->error['warning'] = $this->language->get('error_login');
}

$customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);

if ($customer_info && !$customer_info['approved']) {
$this->error['warning'] = $this->language->get('error_approved');
}

if (!$this->error) {
return true;
} else {
return false;
}
}
}
?>

Вот файл: account.php

<?php  
class ControllerModuleAccount extends Controller {
	protected function index() {
		$this->language->load('module/account');
		
    	$this->data['heading_title'] = $this->language->get('heading_title');
    	
		$this->data['text_register'] = $this->language->get('text_register');
    	$this->data['text_login'] = $this->language->get('text_login');
		$this->data['text_logout'] = $this->language->get('text_logout');
		$this->data['text_forgotten'] = $this->language->get('text_forgotten');
		$this->data['text_account'] = $this->language->get('text_account');
		$this->data['text_edit'] = $this->language->get('text_edit');
		$this->data['text_password'] = $this->language->get('text_password');
		$this->data['text_address'] = $this->language->get('text_address');
		$this->data['text_wishlist'] = $this->language->get('text_wishlist');
		$this->data['text_order'] = $this->language->get('text_order');
		$this->data['text_download'] = $this->language->get('text_download');
		$this->data['text_return'] = $this->language->get('text_return');
		$this->data['text_transaction'] = $this->language->get('text_transaction');
		$this->data['text_newsletter'] = $this->language->get('text_newsletter');
		
		$this->data['logged'] = $this->customer->isLogged();
		$this->data['register'] = $this->url->link('account/register', '', 'SSL');
    	$this->data['login'] = $this->url->link('account/login', '', 'SSL');
		$this->data['logout'] = $this->url->link('account/logout', '', 'SSL');
		$this->data['forgotten'] = $this->url->link('account/forgotten', '', 'SSL');
		$this->data['account'] = $this->url->link('account/account', '', 'SSL');
		$this->data['edit'] = $this->url->link('account/edit', '', 'SSL');
		$this->data['password'] = $this->url->link('account/password', '', 'SSL');
		$this->data['address'] = $this->url->link('account/address', '', 'SSL');
		$this->data['wishlist'] = $this->url->link('account/wishlist');
		$this->data['order'] = $this->url->link('account/order', '', 'SSL');
		$this->data['download'] = $this->url->link('account/download', '', 'SSL');
		$this->data['return'] = $this->url->link('account/return', '', 'SSL');
		$this->data['transaction'] = $this->url->link('account/transaction', '', 'SSL');
		$this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL');

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/account.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/account.tpl';
		} else {
			$this->template = 'default/template/module/account.tpl';
		}
		
		$this->render();
	}
}
?>

P/s: прошу прощение, перепутал раздел, переместите.

Змінено користувачем pawok
Надіслати
Поділитися на інших сайтах


Створіть аккаунт або увійдіть для коментування

Ви повинні бути користувачем, щоб залишити коментар

Створити обліковий запис

Зареєструйтеся для отримання облікового запису. Це просто!

Зареєструвати аккаунт

Вхід

Уже зареєстровані? Увійдіть тут.

Вхід зараз
  • Зараз на сторінці   0 користувачів

    • Ні користувачів, які переглядиють цю сторінку
×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.