Jump to content
Sign in to follow this  
Rex4r

Изменение цены в соответствии с курсом валюты

Recommended Posts

Делаю магазин на ocStore 1.5.5.1. Опыт работы с опенкартом у меня небольшой. Буду рад подсказкам.

 

Задача такова:

на сайте 2 валюты: рубли и $

клиент хочет указывать цену товара в $ (чтобы цена в рублях менялась в соответствии с курсом), но при этом изначально цены на сайте должны быть в рублях (с возможностью переключения на $)

 

Пробовал делать через js, но это была плохая идея))

Share this post


Link to post
Share on other sites
 

 

У меня в этом файле код другой.

 

Вот мой /controller/module/currency.php

<?php  
class ControllerModuleCurrency extends Controller {
protected function index() {
if (isset($this->request->post['currency_code'])) {
$this->currency->set($this->request->post['currency_code']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);
if (isset($this->request->post['redirect'])) {
$this->redirect($this->request->post['redirect']);
} else {
$this->redirect($this->url->link('common/home'));
}
}
$this->language->load('module/currency');
$this->data['text_currency'] = $this->language->get('text_currency');
if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
$connection = 'SSL';
} else {
$connection = 'NONSSL';
}
$this->data['action'] = $this->url->link('module/currency', '', $connection);
$this->data['currency_code'] = $this->currency->getCode(); 
$this->load->model('localisation/currency');
$this->data['currencies'] = array();
$results = $this->model_localisation_currency->getCurrencies(); 
foreach ($results as $result) {
if ($result['status']) {
$this->data['currencies'][] = array(
'title'        => $result['title'],
'code'         => $result['code'],
'symbol_left'  => $result['symbol_left'],
'symbol_right' => $result['symbol_right'] 
);
}
}
if (!isset($this->request->get['route'])) {
$this->data['redirect'] = $this->url->link('common/home');
} else {
$data = $this->request->get;
unset($data['_route_']);
$route = $data['route'];
unset($data['route']);
$url = '';
if ($data) {
$url = '&' . urldecode(http_build_query($data, '', '&'));
} 
$this->data['redirect'] = $this->url->link($route, $url, $connection);
} 
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/currency.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/currency.tpl';
} else {
$this->template = 'default/template/module/currency.tpl';
}
$this->render();
}
}
?>

что-то я не пойму где тут изменить надо...

 

изменил 5 строку

$this->currency->set($this->request->post['currency_code']);

на

$this->set('RUB')

валюту поменял на рубли, но не дает поменять валюту на $

Share this post


Link to post
Share on other sites

перечитайте какой файл надо редактировать.

Share this post


Link to post
Share on other sites

оу... заработался... невнимательно прочитал  :oops:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.