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

deatlinko

Newbie
  
  • Posts

    23
  • Joined

  • Last visited

Everything posted by deatlinko

  1. Я как понял модули можно выводить только в home.tpl . Значения правильные прописал в "Макеты" и в footer.tpl указал <?php echo $column_right; ?> В контролере - footer.php прописал $data['column_right'] = $this->load->controller('common/column_right'); Но все равно почему-то не отображается модуль
  2. Здравствуйте, у меня Opencart 2.3.02, есть раздел Дизайн -> Баннер. Там я добавляю баннеры, но как их можно вывести картинки в footer в значение $column_right; ?
  3. Здравствуйте, не могу понять почему вместо <?php echo $shipping_address ?> пишется ФИО когда приходит пользователю письмо на почту о заказе....
  4. Пробовал установить но не идет т.к. у меня версия Ocstore Версия 1.5.5.1.2
  5. Ищю модуль вопрос-ответ на отдельную страницу, где юзер мог задать вопрос и администрация ответить на него. Версия Opencart 1.5.5.1.2
  6. Получилось, но не правильно выводит. Получается если нажимаю на новость то он показывает ссылку /lalala, как сделать чтобы отображал раздел? (/news/lalala) ? Вот файл seo_pro.php <?php class ControllerCommonSeoPro extends Controller { private $cache_data = null; public function __construct($registry) { parent::__construct($registry); $this->cache_data = $this->cache->get('seo_pro'); if (!$this->cache_data) { $query = $this->db->query("SELECT LOWER(`keyword`) as 'keyword', `query` FROM " . DB_PREFIX . "url_alias"); $this->cache_data = array(); foreach ($query->rows as $row) { $this->cache_data['keywords'][$row['keyword']] = $row['query']; $this->cache_data['queries'][$row['query']] = $row['keyword']; } $this->cache->set('seo_pro', $this->cache_data); } } public function index() { // Add rewrite to url class if ($this->config->get('config_seo_url')) { $this->url->addRewrite($this); } else { return; } // Decode URL if (!isset($this->request->get['_route_'])) { $this->validate(); } else { $route = $this->request->get['_route_']; unset($this->request->get['_route_']); $parts = explode('/', trim(utf8_strtolower($route), '/')); list($last_part) = explode('.', array_pop($parts)); array_push($parts, $last_part); $rows = array(); foreach ($parts as $keyword) { if (isset($this->cache_data['keywords'][$keyword])) { $rows[] = array('keyword' => $keyword, 'query' => $this->cache_data['keywords'][$keyword]); } } if (count($rows) == sizeof($parts)) { $queries = array(); foreach ($rows as $row) { $queries[utf8_strtolower($row['keyword'])] = $row['query']; } reset($parts); foreach ($parts as $part) { $url = explode('=', $queries[$part], 2); if ($url[0] == 'category_id') { if (!isset($this->request->get['path'])) { $this->request->get['path'] = $url[1]; } else { $this->request->get['path'] .= '_' . $url[1]; } } elseif (count($url) > 1) { $this->request->get[$url[0]] = $url[1]; } } } else { $this->request->get['route'] = 'error/not_found'; } if (isset($this->request->get['product_id'])) { $this->request->get['route'] = 'product/product'; if (!isset($this->request->get['path'])) { $path = $this->getPathByProduct($this->request->get['product_id']); if ($path) $this->request->get['path'] = $path; } } elseif (isset($this->request->get['path'])) { $this->request->get['route'] = 'product/category'; } elseif (isset($this->request->get['manufacturer_id'])) { $this->request->get['route'] = 'product/manufacturer/product'; } elseif (isset($this->request->get['information_id'])) { $this->request->get['route'] = 'information/information'; } elseif (isset($this->request->get['news_id'])) { $this->request->get['route'] = 'information/news'; } elseif (isset($this->request->get['news_category_id'])) { $this->request->get['route'] = 'categories/news'; } else { if (isset($queries[$parts[0]])) { $this->request->get['route'] = $queries[$parts[0]]; } } $this->validate(); if (isset($this->request->get['route'])) { return $this->forward($this->request->get['route']); } } } public function rewrite($link) { if (!$this->config->get('config_seo_url')) return $link; $seo_url = ''; $component = parse_url(str_replace('&', '&', $link)); $data = array(); parse_str($component['query'], $data); $route = $data['route']; unset($data['route']); switch ($route) { case 'product/product': if (isset($data['product_id'])) { $tmp = $data; $data = array(); if ($this->config->get('config_seo_url_include_path')) { $data['path'] = $this->getPathByProduct($tmp['product_id']); if (!$data['path']) return $link; } $data['product_id'] = $tmp['product_id']; if (isset($tmp['tracking'])) { $data['tracking'] = $tmp['tracking']; } } break; case 'product/category': if (isset($data['path'])) { $category = explode('_', $data['path']); $category = end($category); $data['path'] = $this->getPathByCategory($category); if (!$data['path']) return $link; } break; case 'product/product/review': case 'information/information/info': return $link; break; default: break; } if ($component['scheme'] == 'https') { $link = $this->config->get('config_ssl'); } else { $link = $this->config->get('config_url'); } $link .= 'index.php?route=' . $route; if (count($data)) { $link .= '&' . urldecode(http_build_query($data, '', '&')); } $queries = array(); foreach ($data as $key => $value) { switch ($key) { case 'product_id': case 'manufacturer_id': case 'category_id': case 'information_id': case 'news_id': case 'news_category_id': $queries[] = $key . '=' . $value; unset($data[$key]); $postfix = 1; break; case 'path': $categories = explode('_', $value); foreach ($categories as $category) { $queries[] = 'category_id=' . $category; } unset($data[$key]); break; default: break; } } if(empty($queries)) { $queries[] = $route; } $rows = array(); foreach($queries as $query) { if(isset($this->cache_data['queries'][$query])) { $rows[] = array('query' => $query, 'keyword' => $this->cache_data['queries'][$query]); } } if(count($rows) == count($queries)) { $aliases = array(); foreach($rows as $row) { $aliases[$row['query']] = $row['keyword']; } foreach($queries as $query) { $seo_url .= '/' . rawurlencode($aliases[$query]); } } if ($seo_url == '') return $link; $seo_url = trim($seo_url, '/'); if ($component['scheme'] == 'https') { $seo_url = $this->config->get('config_ssl') . $seo_url; } else { $seo_url = $this->config->get('config_url') . $seo_url; } if (isset($postfix)) { $seo_url .= trim($this->config->get('config_seo_url_postfix')); } else { $seo_url .= '/'; } $seo_url = trim($seo_url, '//'); if (count($data)) { $seo_url .= '?' . urldecode(http_build_query($data, '', '&')); } return $seo_url; } private function getPathByProduct($product_id) { $product_id = (int)$product_id; if ($product_id < 1) return false; static $path = null; if (!is_array($path)) { $path = $this->cache->get('product.seopath'); if (!is_array($path)) $path = array(); } if (!isset($path[$product_id])) { $query = $this->db->query("SELECT category_id FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . $product_id . "' ORDER BY main_category DESC LIMIT 1"); $path[$product_id] = $this->getPathByCategory($query->num_rows ? (int)$query->row['category_id'] : 0); $this->cache->set('product.seopath', $path); } return $path[$product_id]; } private function getPathByCategory($category_id) { $category_id = (int)$category_id; if ($category_id < 1) return false; static $path = null; if (!is_array($path)) { $path = $this->cache->get('category.seopath'); if (!is_array($path)) $path = array(); } if (!isset($path[$category_id])) { $max_level = 10; $sql = "SELECT CONCAT_WS('_'"; for ($i = $max_level-1; $i >= 0; --$i) { $sql .= ",t$i.category_id"; } $sql .= ") AS path FROM " . DB_PREFIX . "category t0"; for ($i = 1; $i < $max_level; ++$i) { $sql .= " LEFT JOIN " . DB_PREFIX . "category t$i ON (t$i.category_id = t" . ($i-1) . ".parent_id)"; } $sql .= " WHERE t0.category_id = '" . $category_id . "'"; $query = $this->db->query($sql); $path[$category_id] = $query->num_rows ? $query->row['path'] : false; $this->cache->set('category.seopath', $path); } return $path[$category_id]; } private function validate() { if (empty($this->request->get['route']) || $this->request->get['route'] == 'error/not_found') { return; } if (isset($this->request->server['HTTP_X_REQUESTED_WITH']) && strtolower($this->request->server['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { return; } if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) { $url = str_replace('&', '&', $this->config->get('config_ssl') . ltrim($this->request->server['REQUEST_URI'], '/')); $seo = str_replace('&', '&', $this->url->link($this->request->get['route'], $this->getQueryString(array('route')), 'SSL')); } else { $url = str_replace('&', '&', $this->config->get('config_url') . ltrim($this->request->server['REQUEST_URI'], '/')); $seo = str_replace('&', '&', $this->url->link($this->request->get['route'], $this->getQueryString(array('route')), 'NONSSL')); } if (rawurldecode($url) != rawurldecode($seo)) { header($this->request->server['SERVER_PROTOCOL'] . ' 301 Moved Permanently'); $this->response->redirect($seo); } } private function getQueryString($exclude = array()) { if (!is_array($exclude)) { $exclude = array(); } return urldecode(http_build_query(array_diff_key($this->request->get, array_flip($exclude)))); } } ?>
  7. Здравствуйте, не могу понять как сделать ЧПУ ссылки для новостей. SEO manager установлен. получается /news открывает новости, а если /news/lalala то он сразу делает редирект на /news?news_id=22
  8. Получается он у меня установлен http://pixs.ru/showimage/2016123023_9683176_24612472.png ?
  9. получается у меня два места на главной, в верху выводятся новости те которые находятся в ссылке /news А в низу должно выводиться 10 последних новостей, которые находятся в категориях (/news?news_category_id=1)
  10. Какой модуль подойдет? У меня получается модуль НОВОСТЬ+ где я добавляю новости, а так же в нем есть функция создать категорию, куда можно новость запихнуть. Я сделал чтобы новости выводило в одном месте - выводят те новости которые на главной (в новостях /news), А я хочу чтобы выводило только из категории к примеру (/news?news_category_id=1)
  11. Ну я поменял, сделал так $sql = "SELECT * FROM oc_news INNER JOIN oc_news_to_category WHERE oc_news_to_category.news_id = '1';"; $result = $this->db->query($sql)->rows; ошибок не выводит, и вообще не выводит ничего в том месте где я хотел...
  12. Выдает ошибку Notice: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''. DB_PREFIX .'news n INNER JOIN '. DB_PREFIX .'news_to_category n2c ON (n.id = ' at line 1 Error No: 1064 SELECT * FROM '. DB_PREFIX .'news n INNER JOIN '. DB_PREFIX .'news_to_category n2c ON (n.id = n2c.u = id) WHERE n2c.news_id = 1 in C:\AppServ\www\system\database\mysqliz.php on line 53
  13. Fatal error: Call to undefined method DB::queru() in C:\AppServ\www\catalog\view\theme\default\template\common\column_right.tpl on line 16
  14. здравствуйте, пытаюсь вывести из базы новости где категория равна 1 но мне выводит первую строку (image) а дальше ошибку пишет data/m145x145.jpgNotice: Undefined index: image in C:\AppServ\www\catalog\view\theme\default\template\common\column_right.tpl on line 21 Как можно вывести остальные? $result = $this->db->query("SELECT * FROM oc_news INNER JOIN oc_news_to_category WHERE oc_news_to_category.news_id = '1';"); foreach ($result as $res) { //print_r($v); echo $res['image']; }
  15. я как понимаю while в column_right.tpl не работает верно?
  16. Здравствуйте, не могу найти модуль или как это сделать. Имеется установленный НОВОСТИ+, где в нем выводятся новости /news, а так же есть в нем категории /news?news_category_id=10 Как можно вывести все новости из категории (?news_category_id=10 ) на главную? А то на главную выводит только новости из /news Opencart 1.5.5.1
×
×
  • 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.