如果我改变语言文件中的行,登录页面的OpenCart文本不会改变



我运行一个openart商店1.5.6.4与vqmod安装。我从openart安装了xml,以便在到达我的商店之前强制登录。所以这是一个封闭的商店。我在css中定制了登录页面以隐藏所有菜单栏,并将语言选择器从商店"复制"到登录页面。它正在工作,但从那时起,从连接的语言文件的语言文本不再被识别,登录页面文本就像"entry_password"。但是在语言文件夹/文件中,我正确地连接了它们。你有什么建议来解决这个问题吗?

是的,我可以直接把它们写进我的登录。但是那样的话我就只有一种语言可用了。我试图通过vqmod管理器卸载所有vqmod xml,并得到相同的结果。看起来语言没有正确加载,但我真的不知道为什么。

这是我的登录名。目录/视图/主题/默认/模板/帐户中的TPL:

<?php echo $header; ?>
<style>
INLINE CSS
</style>
<div id="banner">
    <center><img src="BANNER URL" alt="header" /></center><br/>
</div>
<?php if ($success) { ?>
<div class="success">Login erfolgreich</div>
<?php } ?>
<?php if ($error_warning) { ?>
<div class="warning">Login fehlgeschlagen</div>
<?php } ?>
<div id="content">
  <div class="login-content">
    <div class="left">
      <h2><?php echo $text_new_customer; ?></h2>
      <div class="content">
        <p><b><?php echo $text_register; ?></b></p>
        <p><?php echo $text_register_account; ?></p>
        <a href="<?php echo $register; ?>" class="button"><?php echo $button_continue; ?></a></div>
    </div>
    <div class="right">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
        <div id="language_selector">Sprache | Language<br>
          <img src="image/flags/de.png" alt="Deutsch" title="Deutsch" onclick="$('input[name='language_code']').attr('value', 'de'); $(this).parent().parent().submit();">
          <img src="image/flags/gb.png" alt="English" title="English" onclick="$('input[name='language_code']').attr('value', 'en'); $(this).parent().parent().submit();">
          <img src="image/flags/nl.png" alt="Nederlands" title="Nederlands" onclick="$('input[name='language_code']').attr('value', 'nl'); $(this).parent().parent().submit();">
          <input type="hidden" name="language_code" value="">
          <input type="hidden" name="redirect" value="http://MYDOMAIN/opencart/index.php?route=account/login">
        </div>
        <div class="content">
          <h2>Login</h2>
          <b>E-Mail:</b><br />
          <input type="text" name="email" value="<?php echo $email; ?>" />
          <br />
          <br />
          <b>Password</b><br />
          <input type="password" name="password" value="<?php echo $password; ?>" />
          <br />
          <a href="<?php echo $forgotten; ?>"><?php echo $text_forgotten; ?></a><br />
          <br />
          <input type="submit" value="<?php echo $button_login; ?>" class="button" />
          <?php if ($redirect) { ?>
          <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
          <?php } ?>
        </div>
      </form>
    </div>
  </div>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$('#login input').keydown(function(e) {
    if (e.keyCode == 13) {
        $('#login').submit();
    }
});
//--></script> 
<?php echo $footer; ?>

我想改变div类的内容,以便使h2和b字段在多语言通过从语言php文件读取出来:

<div class="content">
<h2><?php echo $text_login; ?></h2>
<b><?php echo $entry_email; ?></b><br />
<input type="text" name="email" value="<?php echo $email; ?>" />
<br />
<br />
<b><?php echo $entry_password; ?></b><br />
<input type="password" name="password" value="<?php echo $password; ?>" />
<br />
<a href="<?php echo $forgotten; ?>"><?php echo $text_forgotten; ?></a><br />
<br />
<input type="submit" value="<?php echo $button_login; ?>" class="button" />
<?php if ($redirect) { ?>
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
<?php } ?>
</div>

这是一个语言文件login.php的例子:(位于/catalog/language/english/account/)

<?php
// Heading 
$_['heading_title']                = 'Account Login';
// Text
$_['text_account']                 = 'Account';
$_['text_login']                   = 'Login';
$_['text_new_customer']            = 'New Customer';
$_['text_register']                = 'Register Account';
$_['text_register_account']        = 'By creating an account you will be able to shop faster, be up to date on an order's status, and keep track of the orders you have previously made.';
$_['text_returning_customer']      = 'Returning Customer';
$_['text_i_am_returning_customer'] = 'I am a returning customer';
$_['text_forgotten']               = 'Forgotten Password';
// Entry
$_['entry_email']                  = 'E-Mail Address:';
$_['entry_password']               = 'Password:';
// Error
$_['error_login']                  = 'Warning: No match for E-Mail Address     and/or Password.';
$_['error_approved']               = 'Warning: Your account requires approval before you can login.'; 
?>

这是我的控制器文件login.php的例子,它应该连接$entry_email, $entry_password和$text_login到活动的语言文件(英语语言文件见上文)。它位于/catalog/controller/account

中。
<?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('common/home')); 
        }
    }       
    if ($this->customer->isLogged()) {  
        $this->redirect($this->url->link('common/home'));
    }
    $this->language->load('account/account');
    $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('&amp;', '&', $this->request->post['redirect']));
        } else {
            $this->redirect($this->url->link('common/home')); 
        }
    }
    $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;
    }
}
}
?>

我已经试过了:—替换login。使用原始默认登录的TPL。TPL(目录/视图/主题/默认/模板/帐户)-从vqmod管理器中删除所有vqmod xml。

提前感谢您的帮助。

language-file login.php

$_['text_email1']                 = 'Email Address';
$_['text_pass1']                 = 'Password';

controller-file login.php

$this->data['email1'] = $this->language->get('text_email1');
 $this->data['pass1'] = $this->language->get('text_pass1');

Login.tpl

<div class="content">
          <h2><?php echo $text_login ?></h2>
          <b><?php echo $email1 ?></b><br />
          <input type="text" name="email" value="<?php echo $email; ?>" />
          <br />
          <br />
          <b> <?php echo $pass1 ?> </b><br />
          <input type="password" name="password" value="<?php echo $password; ?>" />
          <br />
          <a href="<?php echo $forgotten; ?>"><?php echo $text_forgotten; ?></a><br />
          <br />
          <input type="submit" value="<?php echo $button_login; ?>" class="button" />
          <?php if ($redirect) { ?>
          <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
          <?php } ?>
        </div>

在语言和控制器文件中添加代码,并以此更改div类内容

最新更新