Page 1 of 1
How to make extension abailable in front side?
Posted: Mon Oct 30, 2017 7:00 am
by oliwin
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?
Re: How to make extension abailable in front side?
Posted: Mon Oct 30, 2017 7:09 am
by IP_CAM
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
Re: How to make extension abailable in front side?
Posted: Mon Oct 30, 2017 7:30 am
by oliwin
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
Re: How to make extension abailable in front side?
Posted: Mon Oct 30, 2017 7:33 am
by oliwin
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:

Re: How to make extension abailable in front side?
Posted: Tue Oct 31, 2017 1:45 am
by IP_CAM
Well,
whatever just meant,
what ever you named the file !
Ernie