Post by oliwin » Mon Oct 30, 2017 7:00 am

I have copied the standard module Featured.. Juts chaneged name and mode/view/language files.

I did this in admin section. Then I created layout with this module, set route and enabled that.

When I tried to open page by route path like: index.php?route=portfolio I get an error: The page you requested cannot be found!

Where and how to configurate path for this module?

New member

Posts

Joined
Tue Jan 10, 2017 2:00 am

Post by IP_CAM » Mon Oct 30, 2017 7:09 am

in .../controller/whatever.php
change:

Code: Select all

<?php
class ControllerModuleFeatured extends Controller {
to:

Code: Select all

<?php
class ControllerModuleWhatever extends Controller {
in the catalog/controller/module/ and admin/controller/module/ Section.
---
If such Files would also exist in the i.E.: model/module/... Directory,
it would then look like:

Code: Select all

<?php
class ModelModuleWhatever extends Model {
Good Luck ;)
Ernie

Ernie's OpenCart v.1.5.6.5 LIGHT + OpenShop Admin v.1.75 Test Sites
http://www.ebikes.li - http://www.evelo.li - http://www.openshop.li
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by oliwin » Mon Oct 30, 2017 7:30 am

Thank you a lot! Seems only you can help in this forum. Can you explain me, why it returns me error, when content is loaded on the page?

Also there is not file `/controller/whatever.php` I use Open Cart 3

New member

Posts

Joined
Tue Jan 10, 2017 2:00 am

Post by oliwin » Mon Oct 30, 2017 7:33 am

This is my full code in front side:

<?php

Code: Select all

class ControllerExtensionModuleFeatured2 extends Controller {
	public function index($setting) {


		$this->load->language('extension/module/featured2');

		$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('theme_' . $this->config->get('config_theme') . '_product_description_length')) . '..',
						'price'       => $price,
						'special'     => $special,
						'tax'         => $tax,
						'rating'      => $rating,
						'href'        => $this->url->link('portfolio/portfolio', 'product_id=' . $product_info['product_id'])
					);
				}
			}
		}

		if ($data['products']) {

            //$this->response->setOutput($this->load->view('extension/module/featured2', $data));
			return $this->load->view('extension/module/featured2', $data);
		}
	}
}
It is shows conents but with error:

Image

Attachments

Screenshot_6.png

Screenshot_6.png (87.66 KiB) Viewed 185 times


New member

Posts

Joined
Tue Jan 10, 2017 2:00 am

Post by IP_CAM » Tue Oct 31, 2017 1:45 am

Well, whatever just meant, what ever you named the file ! :D
Ernie

Ernie's OpenCart v.1.5.6.5 LIGHT + OpenShop Admin v.1.75 Test Sites
http://www.ebikes.li - http://www.evelo.li - http://www.openshop.li
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 9 guests