Jump to content
Sign in to follow this  
lid2pro

[Решено...] Не редактируется account/download

Recommended Posts

Здравствуйте,

 

в опенкарт есть такая страница, как "файлы для скачивания" в акке покупателя. Я хочу эту страницу изменить, т.е. разместить там прайсы т.д.. Редактирую файл catalog/view/theme/тема/template/account/download.tpl , и в дефолтной теме тоже. Но ничего не происходит, на выходе то же самое "У Вас не было заказов с файлами для скачивания!". Подскажите, пожалуйста, в каком направлении копать?

 

Я даже пробовал этот файл (catalog/view/theme/тема/template/account/download.tpl) переименовывать на download.tpl_ ничего не меняется, выводится то же самое "У Вас не было заказов с файлами для скачивания!"

 

Заранее благодарен.

Share this post


Link to post
Share on other sites

открой контроллер и посмотри когда и какой шаблон подгружается.

Share this post


Link to post
Share on other sites

открой контроллер и посмотри когда и какой шаблон подгружается.

Содержимое контроллера download.php

class ControllerAccountDownload extends Controller {

public function index() {

if (!$this->customer->isLogged()) {

$this->session->data['redirect'] = $this->url->link('account/download', '', 'SSL');

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

}

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

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

$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_downloads'),

'href' => $this->url->link('account/download', '', 'SSL'),

'separator' => $this->language->get('text_separator')

);

$this->load->model('account/download');

$download_total = $this->model_account_download->getTotalDownloads();

if ($download_total) {

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

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

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

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

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

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

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

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

if (isset($this->request->get['page'])) {

$page = $this->request->get['page'];

} else {

$page = 1;

}

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

$results = $this->model_account_download->getDownloads(($page - 1) * $this->config->get('config_catalog_limit'), $this->config->get('config_catalog_limit'));

foreach ($results as $result) {

if (file_exists(DIR_DOWNLOAD . $result['filename'])) {

$size = filesize(DIR_DOWNLOAD . $result['filename']);

$i = 0;

$suffix = array(

'B',

'KB',

'MB',

'GB',

'TB',

'PB',

'EB',

'ZB',

'YB'

);

while (($size / 1024) > 1) {

$size = $size / 1024;

$i++;

}

$this->data['downloads'][] = array(

'order_id' => $result['order_id'],

'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),

'name' => $result['name'],

'remaining' => $result['remaining'],

'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i],

'href' => $this->url->link('account/download/download', 'order_download_id=' . $result['order_download_id'], 'SSL')

);

}

}

$pagination = new Pagination();

$pagination->total = $download_total;

$pagination->page = $page;

$pagination->limit = $this->config->get('config_catalog_limit');

$pagination->text = $this->language->get('text_pagination');

$pagination->url = $this->url->link('account/download', 'page={page}', 'SSL');

$this->data['pagination'] = $pagination->render();

$this->data['continue'] = $this->url->link('account/account', '', 'SSL');

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/download.tpl')) {

$this->template = $this->config->get('config_template') . '/template/account/download.tpl';

} else {

$this->template = 'default/template/account/download.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());

} else {

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

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

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

$this->data['continue'] = $this->url->link('account/account', '', 'SSL');

$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . '/1.1 404 Not Found');

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {

$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';

} else {

$this->template = 'default/template/error/not_found.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());

}

}

public function download() {

if (!$this->customer->isLogged()) {

$this->session->data['redirect'] = $this->url->link('account/download', '', 'SSL');

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

}

$this->load->model('account/download');

if (isset($this->request->get['order_download_id'])) {

$order_download_id = $this->request->get['order_download_id'];

} else {

$order_download_id = 0;

}

$download_info = $this->model_account_download->getDownload($order_download_id);

if ($download_info) {

$file = DIR_DOWNLOAD . $download_info['filename'];

$mask = basename($download_info['mask']);

if (!headers_sent()) {

if (file_exists($file)) {

header('Content-Type: application/octet-stream');

header('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file)) . '"');

header('Expires: 0');

header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

header('Pragma: public');

header('Content-Length: ' . filesize($file));

if (ob_get_level()) ob_end_clean();

readfile($file, 'rb');

$this->model_account_download->updateRemaining($this->request->get['order_download_id']);

exit;

} else {

exit('Error: Could not find file ' . $file . '!');

}

} else {

exit('Error: Headers already sent out!');

}

} else {

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

}

}

}

?>

 

подгружает account/download.tpl насколько я понимаю, но при редактировании .tpl ничего не менятся

Share this post


Link to post
Share on other sites

зачем ты мне его показываешь?

вон черным-по-белому "если есть электронные товары - делаем то-то и берем шаблон download.tpl / если нет электронных товаров - берем шаблон not_found.tpl и подставляем своё сообщение".

и вообще - не трогай стандартный функционал, а добавляй свой раздел.

Share this post


Link to post
Share on other sites

Думаю правильней создать download_0file.tpl и написать :  

У Вас, нету файлов для скачивания. Приобрести файлы можно в <a href="index.php?route=product/category&path=61">каталоге</a>

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.