Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

SmarttSC

Newbie
  
  • Posts

    1
  • Joined

  • Last visited

SmarttSC's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter

Recent Badges

0

Reputation

  1. Возможно, кому то пригодится. Сделал вывод главной категории на странице товара OpenCart 2.3. - В файле catalog/controller/product/product.php После строки $this->load->model('catalog/product'); Вставил //вывод главной категории на странице товара// $this->load->model('catalog/category'); $data['catproduct'] = array(); if (isset($this->request->get['path'])) { $path = ''; $parts = explode('_', (string)$this->request->get['path']); $category_id = (int)array_pop($parts); foreach ($parts as $path_id) { if (!$path) { $path = $path_id; } else { $path .= '_' . $path_id; } $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { $data['catproduct'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $path) ); } } $category_info = $this->model_catalog_category->getCategory($category_id); if ($category_info) { $url = ''; if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $data['catproduct'][] = array( 'text' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url) ); } } - в файле catalog/view/theme/*/template/product/product.tpl в нужном месте <span class="desc_title">Категория: </span><?php foreach ($catproduct as $catp) { ?> <a href="<?php echo $catp['href']; ?>"><?php echo $catp['text']; ?></a><?php } ?> Решение для главной категории взял по аналогии с вывода breadcrumbs. Может не совсем верно, но заработало правильно.
Guest
×
  • Create New...

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.