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

deezler

Newbie
  
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

1,017 profile views

deezler's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

4

Reputation

  1. Расположение можно поменять через Дизайн -> Макеты. А вот чтобы во всю ширину сделать, наверное, нужна тема, которая позволяет это делать. Или лезть в шаблоны.
  2. Надо попробовать. Доработки делали какие-то?
  3. Там, походу, автоматически ширина считается, исходя из количества баннеров. Вот тут /catalog/view/theme/default/template/module/carousel.tpl измените «items: 6» на 5 или меньше.
  4. Еще раз привет. Искал модули для того, чтобы адрес корзины был не кривой /index.php?route=checkout/cart, а просто /cart/ Единственное бесплатное решение на 2.2., которое сразу заработало — вот это http://www.opencart.com/index.php?route=extension/extension/info&extension_id=26068 Модуль состоит всего из одного файла, который переписывает файл /catalog/controller/startup/seo_url.php Все получилось круто, но две проблемы возникло: На несуществующих страницах перестала выводится ошибка 404, просто главную показывает с кодом 200. На конце всех ссылок сайта выводит .html. Подскажите, как можно эти проблемы решить? Вот код файла: <?php class ControllerStartupSeoUrl extends Controller { /*************************** ***** SeoUrl Functions ***** ***************************/ private $urlFriendly = array( 'common/home' => 'index', 'account/register' => 'create-account', 'account/login' => 'login', 'account/logout' => 'logout', 'account/newsletter' => 'newsletter', 'account/wishlist' => 'wishlist', 'account/order' => 'order-history', 'account/account' => 'my-account', 'account/forgotten' => 'forgot-password', 'account/download' => 'downloads', 'account/return' => 'returns', 'account/transaction' => 'transactions', 'account/password' => 'change-password', 'account/edit' => 'edit-account', 'account/address' => 'address-book', 'account/reward' => 'reward-points', 'account/return/add' => 'request-add', 'account/voucher' => 'voucher', 'information/contact' => 'contact', 'information/contact/success' => 'contact-success', 'information/sitemap' => 'sitemap', 'affiliate/register' => 'create-affiliate-account', 'affiliate/login' => 'affiliate-login', 'affiliate/logout' => 'affiliate-logout', 'affiliate/account' => 'affiliates', 'affiliate/edit' => 'edit-affiliate-account', 'affiliate/password' => 'change-affiliate-password', 'affiliate/payment' => 'affiliate-payment-options', 'affiliate/tracking' => 'ffiliate-tracking-code', 'affiliate/transaction' => 'affiliate-transactions', 'affiliate/forgotten' => 'affiliate-forgot-password', 'checkout/cart' => 'shopping-cart', 'checkout/checkout' => 'checkout', 'checkout/voucher' => 'gift-vouchers', 'product/special' => 'specials', 'product/manufacturer' => 'brands', 'product/compare' => 'compare-products', 'product/search' => 'search', ); public function getKeyFriendly($_route) { if( count($this->urlFriendly) > 0 ){ $key = array_search($_route, $this->urlFriendly); if($key && in_array($_route, $this->urlFriendly)){ return $key; } } return false; } public function getValueFriendly($route) { if( count($this->urlFriendly) > 0) { if(in_array($route, array_keys($this->urlFriendly))){ return '/'.$this->urlFriendly[$route]; } } return false; } /*************************** ***** SeoUrl Functions ***** ***************************/ public function index() { // Add rewrite to url class if ($this->config->get('config_seo_url')) { $this->url->addRewrite($this); } // Decode URL if (isset($this->request->get['_route_'])) { /* SeoUrl remove prefix (*.html) */ $this->request->get['_route_'] = explode('.', $this->request->get['_route_'], -1); $this->request->get['_route_'] = implode('.',$this->request->get['_route_']); /* SeoUrl remove prefix (*.html) */ $parts = explode('/', $this->request->get['_route_']); // remove any empty arrays from trailing if (utf8_strlen(end($parts)) == 0) { array_pop($parts); } foreach ($parts as $part) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'"); if ($query->num_rows) { $url = explode('=', $query->row['query']); if ($url[0] == 'product_id') { $this->request->get['product_id'] = $url[1]; } if ($url[0] == 'category_id') { if (!isset($this->request->get['path'])) { $this->request->get['path'] = $url[1]; } else { $this->request->get['path'] .= '_' . $url[1]; } } if ($url[0] == 'manufacturer_id') { $this->request->get['manufacturer_id'] = $url[1]; } if ($url[0] == 'information_id') { $this->request->get['information_id'] = $url[1]; } if ($query->row['query'] && $url[0] != 'information_id' && $url[0] != 'manufacturer_id' && $url[0] != 'category_id' && $url[0] != 'product_id') { $this->request->get['route'] = $query->row['query']; } } else { $this->request->get['route'] = 'error/not_found'; break; } } if (!isset($this->request->get['route'])) { if (isset($this->request->get['product_id'])) { $this->request->get['route'] = 'product/product'; } 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/info'; } elseif (isset($this->request->get['information_id'])) { $this->request->get['route'] = 'information/information'; } } /* SeoUrl getKeyFriendly */ if ($_key = $this->getKeyFriendly($this->request->get['_route_']) ) { $this->request->get['route'] = $_key; } /* SeoUrl getKeyFriendly */ if (isset($this->request->get['route'])) { return new Action($this->request->get['route']); } } } public function rewrite($link) { $url_info = parse_url(str_replace('&', '&', $link)); $url = ''; $data = array(); parse_str($url_info['query'], $data); foreach ($data as $key => $value) { if (isset($data['route'])) { if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'"); if ($query->num_rows && $query->row['keyword']) { $url .= '/' . $query->row['keyword']; unset($data[$key]); } } elseif ($key == 'path') { $categories = explode('_', $value); foreach ($categories as $category) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'"); if ($query->num_rows && $query->row['keyword']) { $url .= '/' . $query->row['keyword']; } else { $url = ''; break; } } unset($data[$key]); } /* SeoUrl getValueFriendly */ if( $_link = $this->getValueFriendly($data['route']) ) { $url .= $_link; unset($data[$key]); } /* SeoUrl getValueFriendly */ } } if ($url) { unset($data['route']); $query = ''; if ($data) { foreach ($data as $key => $value) { $query .= '&' . rawurlencode((string)$key) . '=' . rawurlencode((is_array($value) ? http_build_query($value) : (string)$value)); } if ($query) { $query = '?' . str_replace('&', '&', trim($query, '&')); } } /* SeoUrl add prefix (*.html) */ return $url_info['scheme'] . '://' . $url_info['host'] . (isset($url_info['port']) ? ':' . $url_info['port'] : '') . str_replace('/index.php', '', $url_info['path']) . $url . '.html' . $query; } else { return $link; } } } В первую очередь, я пробовал менять .html на / в этом блоке: /* SeoUrl add prefix (*.html) */ return $url_info['scheme'] . '://' . $url_info['host'] . (isset($url_info['port']) ? ':' . $url_info['port'] : '') . str_replace('/index.php', '', $url_info['path']) . $url . '.html' . $query; } else { return $link; } Но меняются только ссылки (что, кстати, тоже очень круто, потому что мы избавляемся от дублей), но вот страницы упорно открываются только с путем .html.
  5. Так в оригинале было :) Тут главное категории вывести. Я оформил так: <div class="catslist"><?php foreach ($catprod as $catp) { ?><span><a href="<?php echo $catp['href']; ?>"><?php echo $catp['name']; ?></a></span> <?php } ?></div> А в CSS запятые: .catslist span:after { content: ","; } .catslist span:last-child:after { content: ""; }
  6. Спасибо огромное! Шикарно получилось: ===== Продублирую решение, чтобы оно не затерялось. 1. В файле catalog/controller/product/product.php После строки $this->load->model('catalog/product'); Вставить $this->load->model('catalog/category'); $data['catprod'] = array(); $product_category = $this->model_catalog_product->getCategories($product_id); foreach ($product_category as $prodcat) { $category_info = $this->model_catalog_category->getCategory($prodcat['category_id']); if ($category_info) { $data['catprod'][] = array( 'name' => $category_info['name'], 'href' => $this->url->link('product/category', 'path=' . $category_info['category_id']) ); } } 2. Затем в шаблоне, например, в catalog/view/theme/*/template/product/product.tpl Перед <?php if ($manufacturer) { ?> Или другом месте вставить <span>Categories: </span><?php foreach ($catprod as $catp) { ?> <a href="<?php echo $catp['href']; ?>"><?php echo $catp['name']; ?></a> |<?php } ?><br />
  7. Привет. Хочу вывести все категории товара на странице этого товара. Не нашел полного решения под Opencart 2 ни в рунете, ни буржунете. Проверил решение для Opencart 1.5. По описанию — именно то, что надо, но не работает на 2.2, к сожалению. Получилось вывести название категорий без ссылок по инструкции. Но ссылку вывести никак не получается. Еще получилось вывести название категории и ссылку по инструкции отсюда. Но таким методом, как я понял, можно вывести только на одну категорию, как в хлебных крошках. Помогите, пожалуйста, сделать вывод ссылок на соответствующие категории.
×
×
  • 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.