But now I installed the AutomatedNewsletter 1.6 module by iSenselabs, when I want to create a new template i'm getting the following error:
Notice: Undefined offset: 1 in /home/puchshopte/domains/puchshop.de/public_html/test/system/library/variable_stream.php on line 66
Notice: Undefined offset: 1 in /home/puchshopte/domains/puchshop.de/public_html/test/system/library/variable_stream.php on line 87
I contacted iSenselabs but they said we have to contact the developer of the variable_stream.php, so of the override engine.
Can you help us?
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Trying to apply an override to a view, outside of the default template.
Folder structure is correct as far as I can see. Docu doesn't mention amendment of views, only model, controller and language files.
Is it as simple placing a .tpl in the correct folder structure of override/override_name/catalog/view/theme/theme_name/template/product/product.tpl
Thanks!
Manager de eCommerces dedicados a la venta de repuestos para electrodomésticos. Somos distrubuidores, especializados en venta al particular y también mayoristas.
Templates can only be modified in the controller, in the overridden method preRender. See FAQ at http://www.mhccorp.com/opencart/override-engine-oc2 or in the readme.txt file.matthew123 wrote:Hi all
Trying to apply an override to a view, outside of the default template.
Folder structure is correct as far as I can see. Docu doesn't mention amendment of views, only model, controller and language files.
Is it as simple placing a .tpl in the correct folder structure of override/override_name/catalog/view/theme/theme_name/template/product/product.tpl
Thanks!
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
When the Override Engine extends a class, the original parent class is possibly first modified by VQmod, before being included.spanishdude wrote:How can I install vQmod with override engine?
Before installing the Override Engine, you should clear the modifications cache via the admin backend at Extensions > Modifications,
You can then simply install our integrated VQmod, or the external VQmod.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Is this correct?
That is, I can't extend the Cart class using the override engine, right?
Actually you can! For example, on one of our web sites we use a special free item shipping extension which needed an extended Cart class, like this:budgetneon wrote:Took a look at this for extending the cart, but it appears that you're not fronting system/library/cart.php in the same way that you are doing for other base classes.
Is this correct?
That is, I can't extend the Cart class using the override engine, right?
- override
- shipping_free_item
- system
- library
- cart.php
- library
- system
- shipping_free_item
Code: Select all
<?php
class shipping_free_item_Cart extends Cart {
// overridden method
public function __construct($registry) {
parent::__construct($registry);
$this->log = $registry->get('log');
$this->config = $registry->get('config');
}
// overriden method
public function getWeight() {
$weight = parent::getWeight();
.....
}
return $weight;
}
.....
}
?>
I will likely make this override engine module a requirement for our page cache module. As of opencart 2.1.x, opencart no longer maintains a cart session variable, which we depended on to tell if the cart was empty or not. Long story, but because it's a page cache, it runs before the opencart engine, so we need a generic non-opencart method to check if the cart is empty of not. This override engine sounds like the cleanest way to restore the cart session variable.
If I make the override engine a dependency, I would like to be able to programmatically check that the override engine is installed+active...so we can show an error on our module status page if it's not. What's the best way to do that...hopefully in a way that it won't change in the future?
I usually check for the existence of a factory class instance, e.g.budgetneon wrote: If I make the override engine a dependency, I would like to be able to programmatically check that the override engine is installed+active...so we can show an error on our module status page if it's not. What's the best way to do that...hopefully in a way that it won't change in the future?
Code: Select all
if (!empty($this->factory)) {
// Override Engine is installed
}
Code: Select all
if ($this->cart->hasProducts()) {
// cart is not empty
}
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Perfect, thank you.JNeuhoff wrote: I usually check for the existence of a factory class instance, e.g.
Code: Select all
if (!empty($this->factory)) { // Override Engine is installed }
Not in a pagecache, no. The idea is that a page cache would be as lean as possible....specifically not running any opencart code, at all, when a request comes in. That was possible prior to opencart 2.1.x, but not after.JNeuhoff wrote:
BTW.: Can't you just use
to check whether the cart is empty or not?Code: Select all
if ($this->cart->hasProducts()) { // cart is not empty }
We modify the top of the index.php file for opencart, and if we're serving a cached page out, we return() before any opencart code is run. That makes a page served from cache very lightweight...no database calls at all, etc. (https://github.com/budgetneon/v2pagecac ... stallation)
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Just to follow up on your question you posted in the comments section of the Override Engine extension:theme wrote:How to use override-engine for opencart-2-2-0-0
Opencart 2.2.0.0 doesn't use the config_theme setting any more, hence the $this->config->get('config_theme') call will only get you a NULL. Normally I use this kind of code for what you are trying to accomplish:theme wrote: I have installed new open cart version 2.2.0.0. Then added override engine for 2.2.0.0.
I have declare new variable in /override/test1/controller/common/header.phpCode: Select all
<?php class test1_ControllerCommonHeader extends ControllerCommonHeader { public function preRender( $template_buffer, $template_name, &$data ) { if ($template_name != $this->config->get('config_template').'/template/common/header.tpl') { return parent::preRender( $template_buffer, $template_name, $data ); } $this->load->language( 'common/header' ); $data['text_menu'] = $this->language->get( 'text_menu' ); // call parent method return parent::preRender( $template_buffer, $template_name, $data ); } } ?>
Code: Select all
<?php
class test1_ControllerCommonHeader extends ControllerCommonHeader {
public function preRender( $template_buffer, $template_name, &$data ) {
// only modify if controller uses the 'header.tpl' template
if (!$this->endsWith( $template_name, '/template/common/header.tpl' )) {
return parent::preRender( $template_buffer, $template_name, $data );
}
// new text_menu variable
$this->load->language( 'common/header' );
$data['text_menu'] = $this->language->get( 'text_menu' );
// call parent method
return parent::preRender( $template_buffer, $template_name, $data );
}
private function endsWith( $haystack, $needle ) {
if (strlen( $haystack ) < strlen( $needle )) {
return false;
}
return (substr( $haystack, strlen($haystack)-strlen($needle), strlen($needle) ) == $needle);
}
}
?>
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
JNeuhoff wrote:URL please? Where in OpenCart extensions?straightlight wrote:Already did.
UPDATE: 2 weeks later, and still no reply from straightlight, I think his improved version simply doesn't exist
Are you kidding me??? I just went through the whole 14 pages anxiously hoping to se the Url link and......nothing.
Oh well, maybe next year....
Over 95% of all computer problems can be traced back to the interface between the keyboard and the chair...
(when i click on add module button in layout form in position drop down middle_left options are added, but for previously added layout positions, in positions drop down (middle_left) is not added
Code: Select all
$str_search=array('<?php if ($layout_module[\'position\'] == \'column_right\') { ?><option value="column_right" selected="selected"><?php echo $text_column_right; ?></option><?php } else { ?><option value="column_right"><?php echo $text_column_right; ?></option><?php } ?>','html += \' <option value="column_right"><?php echo $text_column_right; ?></option>\';');
$str_replace=array('<?php if ($layout_module[\'position\'] == \'column_right\') { ?>
<option value="column_right" selected="selected"><?php echo $text_column_right; ?></option>
<?php } else { ?>
<option value="column_right"><?php echo $text_column_right; ?></option>
<?php } ?>
<?php if ($layout_module[\'position\'] == \'middle_left\') { ?>
<option value="middle_left" selected="selected"><?php echo $text_middle_left; ?></option>
<?php } else { ?>
<option value="middle_left"><?php echo $text_middle_left; ?></option>
<?php } ?>','html += \' <option value="column_right"><?php echo $text_column_right; ?></option>\';
html += \' <option value="middle_left"><?php echo $text_middle_left; ?></option>\';');
$template_buffer = str_replace($str_search,$str_replace,$template_buffer);
Use the modifier helper class instead, like this:
Code: Select all
// modify the the template, to add support for the 'middle_left' option
$this->load->helper( 'modifier' );
$search = '<option value="column_right"><?php echo $text_column_right; ?></option>';
$offset = 1;
$index = 1;
$add = <<<'EOT'
<?php if ($layout_module['position'] == 'column_middle') { ?>
<option value="column_middle" selected="selected"><?php echo $text_column_middle; ?></option>
<?php } else { ?>
<option value="column_middle"><?php echo $text_column_middle; ?></option>
<?php } ?>
EOT;
$template_buffer = Modifier::modifyStringBuffer( $template_buffer, $search, $add, 'after', $offset, $index );
$search = '<option value="column_right"><?php echo $text_column_right; ?></option>';
$offset = 0;
$index = 2;
$add = <<<'EOT'
html += ' <option value="column_right"><?php echo $text_column_right; ?></option>';
EOT;
$template_buffer = Modifier::modifyStringBuffer( $template_buffer, $search, $add, 'after', $offset, $index );
I have one more issue. I want to give link for related products, of product where all related products will be displayed of particular product. I have created link & added new function info() as bellow in override/creta/catalog/controller/product/product.php
Code: Select all
public function preRender( $template_buffer, $template_name, &$data ) {
if (!$this->endsWith( $template_name, '/template/product/product.tpl' )) {
return parent::preRender( $template_buffer, $template_name, $data );
}
$data['related_list']= $this->url->link('product/product/info', 'product_id=' . $product_id);
return parent::preRender( $template_buffer, $template_name, $data );
}
public function info($pro_id){
$data['products'] = array();
$this->response->setOutput($this->load->view('product/related_list.tpl', $data));
}
Users browsing this forum: No registered users and 71 guests