Jump to content
Sign in to follow this  
Praetorioan

[Решено] Рекомендуемые не видит id товаров.

Recommended Posts

Добрый день, у меня дефолтный шаблон версии 2.3.0.2. На главной есть стандартная секция "рекомендуемые" (featured), при нажатии на любой из товаров переходит на страницу "Товар не найден". Оно и не мудрено, ведь переходит он на ссылку следующего вида: http://site.ru/index.php?route=product/product&product_id=

Ума не приложу в чём может быть проблема. Подскажите, пожалуйста.

Share this post


Link to post
Share on other sites

Видимо не передается id - покажите контроллер

Share this post


Link to post
Share on other sites

перезапишите просто catalog/controller/extension/module/featured.php думаю должно помочь.

Share this post


Link to post
Share on other sites
4 часа назад, spectre сказал:

Видимо не передается id - покажите контроллер

<?php
class ControllerExtensionModuleFeatured extends Controller {
	public function index($setting) {
		$this->load->language('extension/module/featured');

		$data['heading_title'] = $this->language->get('heading_title');

		$data['text_tax'] = $this->language->get('text_tax');

		$data['button_cart'] = $this->language->get('button_cart');
		$data['button_wishlist'] = $this->language->get('button_wishlist');
		$data['button_compare'] = $this->language->get('button_compare');

		$this->load->model('catalog/product');

		$this->load->model('tool/image');

		$data['products'] = array();

		if (!$setting['limit']) {
			$setting['limit'] = 4;
		}

		if (!empty($setting['product'])) {
			$products = array_slice($setting['product'], 0, (int)$setting['limit']);

			foreach ($products as $product_id) {
				$product_info = $this->model_catalog_product->getProduct($product_id);

				if ($product_info) {
					if ($product_info['image']) {
						$image = $this->model_tool_image->resize($product_info['image'], $setting['width'], $setting['height']);
					} else {
						$image = $this->model_tool_image->resize('placeholder.png', $setting['width'], $setting['height']);
					}

					if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
						$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
					} else {
						$price = false;
					}

					if ((float)$product_info['special']) {
						$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
					} else {
						$special = false;
					}

					if ($this->config->get('config_tax')) {
						$tax = $this->currency->format((float)$product_info['special'] ? $product_info['special'] : $product_info['price'], $this->session->data['currency']);
					} else {
						$tax = false;
					}

					if ($this->config->get('config_review_status')) {
						$rating = $product_info['rating'];
					} else {
						$rating = false;
					}

					$data['products'][] = array(
						'product_id'  => $product_info['product_id'],
						'thumb'       => $image,
						'name'        => $product_info['name'],
						'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
						'price'       => $price,
						'special'     => $special,
						'tax'         => $tax,
						'rating'      => $rating,
						'fastorder'     => $this->load->controller('product/fastorder', $product_info = $this->model_catalog_product->getProduct( isset($result['product_id']) ? $result['product_id'] :'' )), // FastOrder
						'href'        => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
					);
				}
			}
		}

		if ($data['products']) {
			return $this->load->view('extension/module/featured', $data);
		}
	}
}

 

Share this post


Link to post
Share on other sites

вам быстрый заказ ломает все и перезаписывает product_info

Share this post


Link to post
Share on other sites

Сверил его со стандартным - у меня там только одно изменение: 

добавление подключения модуля fastorder

'fastorder'     => $this->load->controller('product/fastorder', $product_info = $this->model_catalog_product->getProduct( isset($result['product_id']) ? $result['product_id'] :'' )), // FastOrder

 

Share this post


Link to post
Share on other sites
7 минут назад, spectre сказал:

вам быстрый заказ ломает все и перезаписывает product_info

 

Да, вижу. странно. модуль не страдает багами, а тема у меня дефолтная, по идее должен был встать как следует. Можно как-нибудь руками его починить?

Share this post


Link to post
Share on other sites

Так, проблема решена. Я перепутал fastorder с другим модулем. От fastordera я вообще отказался. Я просто выпилил эту строку и, конечно, всё заработало.

Очередное спасибо @spectre !

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.