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

Andrielll

Newbie
  
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Andrielll's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

0

Reputation

  1. Спасибо за помощь)
  2. Вот сам класс seo: <?php class ModelToolSeoUrl extends Model { public function rewrite($link, $action = '') { if (!$this->config->get('config_seo_url')) return $link; $url_query = parse_url(str_replace('&', '&', $link), PHP_URL_QUERY); $data = array(); parse_str($url_query, $data); $seo_url_postfix = ($this->config->get('config_seo_url_auto') == '1') ? '/' : ''; if (array_key_exists('product_id', $data)) { $url = $this->getProductSeoUrl($data['product_id']); if ($this->config->get('config_seo_url_replace')) { $url = str_replace(' ', '_', $url); } if (strpos($url, '&') === false) $url .= $seo_url_postfix; return rtrim(HTTP_SERVER, '/') . str_replace('&', '&', $url); } elseif (array_key_exists('path', $data)) { $parts = explode('_', $data['path']); $category_id = array_pop($parts); $path = $this->getPath($category_id); if ($path === false && $action == 'validate') return false; if ($data['path'] != $path) { $data['path'] = $path; $link = HTTP_SERVER . 'index.php?' . urldecode(http_build_query($data)); } } $url = ''; foreach ($data as $key => $value) { switch ($key) { case 'manufacturer_id': case 'information_id': $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'"); if ($query->num_rows) { $url .= '/' . $query->row['keyword']; unset($data[$key]); } break; case 'path': $seo_path = $this->getSeoPath($value); if (!$seo_path) return $link; $url .= $seo_path; unset($data[$key]); break; default: break; } } if (!$url) return $link; unset($data['route']); $query = sizeof($data) ? '?' . urldecode(http_build_query($data)) : ''; if ($this->config->get('config_seo_url_replace')) { $url = str_replace(' ', '_', $url); } $url = str_replace('&', '&', $url); return rtrim(HTTP_SERVER, '/') . $url . $seo_url_postfix . $query; } private function getPath($category_id) { $category_id = (int)$category_id; if ($category_id < 1) return false; $path = $this->cache->get('category.seo.path.' . $category_id . '.' . (int)$this->config->get('config_store_id')); if ($path === null) { $path = ''; $max_level = 30; $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 = $query->num_rows ? $query->row['path'] : false; $this->cache->set('category.seo.path.' . $category_id . '.' . (int)$this->config->get('config_store_id'), $path); } return $path; } private function getSeoPath($path) { $seo_path = $this->cache->get('category.seo.' . $path . '.' . (int)$this->config->get('config_store_id')); if ($seo_path === null) { $seo_path = ''; $categories = explode('_', $path); foreach ($categories as $category) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'"); if ($query->num_rows) { $seo_path .= '/' . $query->row['keyword']; } else { $seo_path = false; break; } } $this->cache->set('category.seo.' . $path . '.' . (int)$this->config->get('config_store_id'), $seo_path); } return $seo_path; } private function getProductSeoUrl($product_id) { $product_id = (int)$product_id; if ($product_id < 1) return false; $seo_url = $this->cache->get('product.seo.' . $product_id . '.' . (int)$this->config->get('config_store_id')); if ($seo_url === null) { $seo_url = false; $query = $this->db->query("SELECT IFNULL(p.main_category_id, p2c.category_id) AS category_id FROM " . DB_PREFIX . "product AS p JOIN " . DB_PREFIX . "product_to_category AS p2c USING (product_id) WHERE p.product_id = '" . (int)$product_id . "' LIMIT 1"); if ($query->num_rows) { $category_id = (int)$query->row['category_id']; if ($path = $this->getPath($category_id)) { $product_alias = ''; if ($seo_path = $this->getSeoPath($path)) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'product_id=" . $product_id . "'"); if ($query->num_rows) $product_alias = $query->row['keyword']; } if ($product_alias) { $seo_url = $seo_path . '/' . $product_alias; } else { $seo_url = '/index.php?route=product/product&path=' . $path . '&product_id=' . $product_id; } } } $this->cache->set('product.seo.' . $product_id . '.' . (int)$this->config->get('config_store_id'), $seo_url); } return $seo_url; } } ?>
  3. Здравствуйте, подобная тема уже есть на форуме, но там решение есть только для более поздних версий OpenCart. Нужно вместо: http://www.site.ru/Главная_категория1/Подкатегория1 http://www.site.ru/Главная_категория1/Подкатегория2 http://www.site.ru/Главная_категория1/Подкатегория3 Это: http://www.site.ru/Подкатегория1 http://www.site.ru/Подкатегория2 http://www.site.ru/Подкатегория3 Использую OpenCart 1.4.9.4 Заранее спасибо.
  4. Здравствуйте. Такая проблема, не открывается страница модулей, браузер выдает, что страница недоступна. Ошибка 330 (net::ERR_CONTENT_DECODING_FAILED): Неизвестная ошибка. В чем может быть проблема, не подскажите? Заранее спасибо. --------------------- Проблема решена.
  5. Здравствуйте, на этом сайте в классе oferta_text нужно разместить текст по всей длине рамки, примерно так: Я не особо разбираюсь в программировании, пишите попроще пожалуйста, заранее спасибо.
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.