任何人都可以回答我關於如何將貨幣與開放購物車中的語言聯繫起來嗎?我的意思是打開購物車的語言和貨幣
如果我改變語言該國家的貨幣也改變。我在所有地方搜索,但我沒有找到。任何人都可以有這樣的經歷嗎?
謝謝。
任何人都可以回答我關於如何將貨幣與開放購物車中的語言聯繫起來嗎?我的意思是打開購物車的語言和貨幣
如果我改變語言該國家的貨幣也改變。我在所有地方搜索,但我沒有找到。任何人都可以有這樣的經歷嗎?
謝謝。
您需要修改控制器/通用/ 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>
最好的問候,
你試圖將兩個在前端結合?例如客戶只需選擇contry並自動選擇貨幣? – CarpeNoctumDC 2012-03-07 02:23:25
你確實是我想要的。 – mutahir 2012-03-21 14:06:03
什麼版本的OpenCart?您基本上需要編輯控制器以同時更改這兩個值......如果您只處理兩種貨幣,則可以對這些對進行硬編碼。如果不是,則還需要創建一個語言到貨幣的組合表...讓我知道什麼版本的OC,以及您使用多少種語言 – CarpeNoctumDC 2012-03-22 05:00:08