有人可以回答我关于我如何将货币与开放式购物车中的语言联系起来?我的意思是
如果我改变语言,那个国家的货币也会发生变化。我在所有地方搜索,但我没有找到。任何人都有这样的经历吗?
感谢。
答案 0 :(得分:2)
你需要修改controller / common / header.php
if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['language_code'])) {
$this->session->data['language'] = $this->request->post['language_code'];
if (isset($this->request->post['redirect'])) {
$this->redirect($this->request->post['redirect']);
} else {
$this->redirect($this->url->link('common/home'));
}
}
这样的事情:
if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['language_code'])) {
$this->session->data['language'] = $this->request->post['language_code'];
$this->currency->set($this->request->post['currency_code']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
if (isset($this->request->post['redirect'])) {
$this->redirect($this->request->post['redirect']);
} else {
$this->redirect($this->url->link('common/home'));
}
}
我知道答案在StackOverflow中,但我再也找不到了。
现在..你需要修改模板header.tpl:
<form name="language" action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
<div id="language">
<img src="image/flags/se.png" alt="Svenska" title="Svenska" onclick="$('input[name=\'language_code\']').attr('value', 'se'); $('input[name=\'currency_code\']').attr('value', 'SEK'); $(this).parent().parent().submit();" />
<img src="image/flags/dk.png" alt="Danish" title="Danish" onclick="$('input[name=\'language_code\']').attr('value', 'da').submit(); $(this).parent().parent().submit();" />
<img src="image/flags/gb.png" alt="English" title="English" onclick="$('input[name=\'language_code\']').attr('value', 'en').submit(); $('input[name=\'currency_code\']').attr('value', 'GBP').submit(); $(this).parent().parent().submit();" />
<input type="hidden" name="language_code" value="" />
<input type="hidden" name="currency_code" value="" />
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
</div>
</form>
最诚挚的问候,