See our FAQs for OpenCart 2.0 and OpenCart 1.5.x for more details.MrMagoo wrote:Probably I can't understand well how OE works.
Is there an exaustive guide to learn OE?
Thank you.
MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig
I experimented with composer a bit. Now i have a first approach to install opencart (including override engine) via composer. just use the following composer command to install opencart: composer create-project beyondit/opencart ./path/to/installation/directory
I had the idea to create a custom installer for override engine modules, which would simply allow one to install modules via composer, e.g.: composer require vendor/modulename.
Is anybody interessted in this approach? For now i will update the composer approach for all forthcoming releases, to be useable for anybody.
Checkout our extensions, or our open source projects
MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig
After purchasing an opencart template I was forced to download this extension in order to use the theme. As we all know refunds are nearly impossible with digital goods so I am stuck to figure this one out, or purchase another template. I am getting an error and am not able to pull up the website at all after installing this extension.
Error follows:
Notice: Array to string conversion in .../system/modification/system/engine/action.php on line 12
Has anyone come across this error? Is there a solution that can be offered?
3rd party OpenCart templates often tend to be in conflict with other extensions, Shoppica being one of the worst offenders in this.
MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig
I made the mistake of going to line 12 of the other file too which is a commental line.
I have attempted to do this from 3 fresh opencart installation and each time I have gotten this result BEFORE I activate or install a theme.
I am not using Shoppica, I am using Carera from Themeforest.net.
I guess what I am getting is that there is no help for this extension... as a developer you must remember that our programs only work on statistical guarantees. There will always be a situation where the perfect code for some reason just didn't work. I was just curious as to whether or not we could work together to figure this one out.
I have read the entire thread, I am not the first with a problem with this plug in. I followed the instructions listed exactly as they are here on the site. And your response to my post is very immature & lacking profession.
Code: Select all
<?php
/* ---------------------------------------------------------------------------------- */
/* OpenCart Action (with support for the Override Engine) */
/* */
/* Original file Copyright © 2012-2014 by Daniel Kerr (www.opencart.com) */
/* Modifications Copyright © 2014 by J.Neuhoff (www.mhccorp.com) */
/* */
/* This file is part of OpenCart. */
/* */
/* OpenCart is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* OpenCart is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with OpenCart. If not, see <http://www.gnu.org/licenses/>. */
/* ---------------------------------------------------------------------------------- */
Have you tried to do a refresh of your OCmod modifications in the admin backend after the Override Engine installation? You can do it at
admin > Extensions > Modifications > Refresh button
MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig
Also, I cleared my modifications in OC prior to installing Override Engine but after installing it I have not been able to access my site because of the error.
Have you ever experienced this error?
Line of code in question is
Code: Select all
$parts = explode('/', str_replace('../', '', (string)$route));
Attachments
/System/engine/action.php Line 12 is comment line no code - screenshot2.png (74.14 KiB) Viewed 3687 times
/System/Modifications/system/engine/action.php Line 12 is code - Screenshot.png (59.38 KiB) Viewed 3687 times
You must have installed the original OpenCart and also did the Refresh in the admin > Extensions > Modifications, and then you uploaded the Override Engine afterwards.
Try this: Manually, via FTP (or your local file explorer if testing on a local PC), remove all files and folders (except index.html) from your system/modification. Now you should be able to go into the admin > Extensions > Modifcations and do a Refresh, this will update the files and folders in system/modification with the Override Engine changes embedded in them, too, e.g. in the system/modification/system/engine/action.php.
MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig
Great for me, however. At least I can resell this theme and get my money back out of it now. I am intrigued by the override extension and look to experiment more with it for my own modifications to OC. Thanks again!
I followed it closely, as the examples in the readme.txt were want I wanted to do, namely introduce addtional product fields.
However, on creating my override I was getting a "Product not found" error in the front-end when visiting the URL for a valid product -- upon scratching my head for quite a while, I realised I'd taken the readme.txt examples a little too literally, and the model extension example was missing the following line at the end:
Code: Select all
return $product;
Code: Select all
<?php
class addon_x_ModelCatalogProduct extends ModelCatalogProduct {
/* override method */
public function getProduct($product_id) {
$product = parent::getProduct( $product_id );
if ($product) {
$sql = "SELECT myfield FROM `".DB_PREFIX.product` ";
$sql .= "WHERE product_id='".(int)$product_id."'";
$result = $this->db->query($sql);
$product['myfield'] = $result->row['myfield'];
} else {
$product['myfield'] = '';
}
}
}
?>
Code: Select all
<?php
class addon_x_ModelCatalogProduct extends ModelCatalogProduct {
/* override method */
public function getProduct($product_id) {
$product = parent::getProduct( $product_id );
if ($product) {
$sql = "SELECT myfield FROM `".DB_PREFIX.product` ";
$sql .= "WHERE product_id='".(int)$product_id."'";
$result = $this->db->query($sql);
$product['myfield'] = $result->row['myfield'];
} else {
$product['myfield'] = '';
}
return $product;
}
}
?>
Code: Select all
// modify template file
$template_buffer = str_replace(
'<?php echo $description; ?>',
'<?php echo $description; ?><br /><?php echo $text_myfield; ?>:<?php echo $myfield; ?>'
);
Code: Select all
// modify template file
$template_buffer = str_replace(
'<?php echo $description; ?>',
'<?php echo $description; ?><br /><?php echo $text_myfield; ?>:<?php echo $myfield; ?>',
$template_buffer
);
Thanks for a great (and free!) extension.
MHC Web Design
Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig
I am fairly new to open cart and I just installed the latest version of Open Cart. On the default theme a simple thing I want to do is add the slider to a new module position above the main navigation. I don't want to override any core files so I came across the override engine extension. I am just a little stuck on what files I need to copy over to the override folder (or is it not files I need to copy, but create new (override) files)?
Simply said I want to add a new module position and assign the homepage slider to this position and then call it in the header.tpl.
Best regards,
Joeri.
do i call language files from the oveeridden prerender function or is ok to call from the overridden getform function?
Code: Select all
class stock_ControllerCatalogProduct extends ControllerCatalogProduct {
protected function getForm() {
$data['heading_title'] = $this->language->get('heading_title');
$this->load->model('module/stock');
$data['entry_has_option'] = $this->language->get('entry_has_option');
$data['tab_stock'] = $this->language->get('tab_stock');
$this->response->setOutput($this->load->view('catalog/product_form.tpl', $data));
parent::getForm();
}
public function preRender( $template_buffer, $template_name, &$data ) {
switch ($template_name) {
case "catalog/product_form.tpl":
$search ='<li><a href="#tab-option" data-toggle="tab"><?php echo $tab_option; ?></a></li>';
$replace='<li><a href="#tab-stock" data-toggle="tab"><?php echo $tab_stock; ?></a></li> ';
$template_buffer = str_replace(
$search,
$replace,
$template_buffer
);
break;
}
return parent::preRender( $template_buffer, $template_name, $data );
}
Try this:
Code: Select all
class stock_ControllerProductProduct extends ControllerProductProduct {
/* overridden method, always called before the final rendering */
public function preRender( $template_buffer, $template_name, &$data ) {
if ($template_name != 'catalog/product_form.tpl') {
return parent::preRender( $template_buffer, $template_name, $data );
}
// add new controller variables
$this->load->model('module/stock');
$data['entry_has_option'] = $this->language->get('entry_has_option');
$data['tab_stock'] = $this->language->get('tab_stock');
// modify template file
// ... do whatever is needed to modify the product_form.tpl ....
$template_buffer = str_replace( .... );
// call parent method
return parent::preRender( $template_buffer, $template_name, $data );
}
}
product.php
// Additional Entry
$_['tab_stock'] = 'Stock Control';
/* overridden method, always called before the final rendering */
public function preRender( $template_buffer, $template_name, &$data ) {
if ($template_name != 'catalog/product_form.tpl') {
return parent::preRender( $template_buffer, $template_name, $data );
}
// add new controller variables
$this->load->model('module/stock');
$this->load->language('catalog/product');
$data['entry_has_option'] = $this->language->get('entry_has_option');
$data['tab_stock'] = $this->language->get('tab_stock');
// modify template file
// ... do whatever is needed to modify the product_form.tpl ....
$template_buffer = str_replace( .... );
// call parent method
return parent::preRender( $template_buffer, $template_name, $data );
}
but in the rendered view i get tab_stock as the string, its like it cannot get the value of $this->language->get('tab_stock'); because it doesnt exist in the current scope.
Users browsing this forum: No registered users and 8 guests