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

Forkintheass

Newbie
  
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

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

Forkintheass's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Reputation

  1. Коллеги, Сломал голову и перешерстил форумы - пока не смог найти решения. Не работает пагинация с поиском (без поиска работает) - проблема упоминается, но как её фиксить не совсем ясно. Суть такова: при поиске или фильтрации первую страницу код генерит правильно, а вот ссылки на пагинацию выдает неверные. Например, ссылка на страницу с поиском: /index.php?route=product/category&path=1&search=pink%20floyd А вот ссылки на пагинацию, которые я вижу на этой странице, выглядят так: <div class="pages"><ul class="pagination"><li class="active"><span>1</span></li> <li><a href="***/index.php?route=product/category&amp;path=1&amp;page=2">2</a></li> <li><a href="***/index.php?route=product/category&amp;path=1&amp;page=3">3</a></li> <li><a href="***/index.php?route=product/category&amp;path=1&amp;page=4">4</a></li> <li><a href="***/index.php?route=product/category&amp;path=1&amp;page=2">&gt;</a></li> <li><a href="***/index.php?route=product/category&amp;path=1&amp;page=4">&gt;|</a></li></ul> </div> при этом не совсем понятно даже какой контроллер генерит эти ссылки. Код с пагинацией есть и в oclayerednavigation.php: $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $base_url . 'index.php?route=product/category&path=' . $category_id . $url . '&amp;page={page}'; $data['pagination'] = $pagination->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next'); } $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $json['result_html'] = $this->load->view('extension/module/oclayerednavigation/occategoryfilter', $data); И в category.php: $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['pagination'] = $pagination->render(); $paginationOld = new Pagination(); $paginationOld->total = $product_total; $paginationOld->page = $page; $paginationOld->limit = $limit; $paginationOld->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}'); $data['link'] = $this->url->link('product/category', 'path=' . $this->request->get['path']); $data['paginationOld'] = $paginationOld->render(); $data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit)); // http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html if ($page == 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical'); } else { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical'); } if ($page > 1) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev'); } if ($limit && ceil($product_total / $limit) > $page) { $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next'); } $data['vinyl_states'] = $this->model_catalog_product->getVinylStates(); $data['cover_states'] = $this->model_catalog_product->getCoverStates(); $data['vinyl_types'] = $this->model_catalog_product->getVinylTypes(); $data['price_min'] = $this->model_catalog_product->getMinPrice(); $data['price_max'] = $this->model_catalog_product->getMaxPrice(); $data['year_min'] = $this->model_catalog_product->getMinYear(); $data['year_max'] = $this->model_catalog_product->getMaxYear(); $data['sort'] = $sort; $data['order'] = $order; $data['limit'] = $limit; $data['continue'] = $this->url->link('common/home'); $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $json = json_encode(['content' => $this->load->view('extension/module/oclayerednavigation/occategory', $data)]); $this->response->addHeader('Content-Type: application/json'); echo json_encode($json); die(); } $this->response->setOutput($this->load->view('product/category', $data)); Функция поиска в catalog\model\catalog\product.php выглядит вот так: (хотя может быть она к делу и не относится) public function mainSearch($term) { $products = $this->searchByProductName($term); $manufactures = $this->searchByManufacturer($term); $items = []; $this->load->model('tool/image'); foreach ($products as $product) { $id = $product['product_id']; $items[$id]['id'] = $id; $items[$id]['text'] = $product['name']; $items[$id]['type'] = 'product'; $items[$id]['manufacturer'] = $product['manufacturer']; if ($product['image']) { $image = $this->model_tool_image->resize($product['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } $items[$id]['image'] = $image; $items[$id]['link'] = $this->url->link('product/product', 'product_id=' . $id); } foreach ($manufactures as $manufacture) { $id = $manufacture['manufacturer_id']; $items[$id]['id'] = $id; $items[$id]['text'] = $manufacture['name']; $items[$id]['type'] = 'manufacturer'; if ($manufacture['image']) { $image = $this->model_tool_image->resize($manufacture['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } else { $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')); } $items[$id]['image'] = $image; $items[$id]['link'] = $this->url->link('product/category/index', 'path=' . MAIN_CATEGORY . '&filters[manufacturer]=' . $id); } return $items; Попытки отредактировать код линки для паджинации, добавив в него любое слово во всех из этих файлов не привел к тому, что я вижу изменения в source code веб-страницы после поиска. Может быть я не сбросил какие-то кэши? Или же я не те контроллеры открываю совсем. Ничего не понятно Подскажите, пожалуйста, что поправить. Разгадка, кажется, близко, но не могу нащупать. Спасибо!
×
×
  • 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.