Re: How to create/duplicate a module?
Posted: Mon Jun 13, 2011 4:34 pm
Alice, are you talking to me? I dont quite understand your reply if so. Otherwise no one else has posted in this thread for months!!
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
deevooneh wrote: I then did a find replace for "authorizenet_aim" in the file and replaced with "authorizenet_aim_chase".
After i did this, "Authorize Net (chase)" shows up as a module however when I click install, it takes me to a blank page and does not install.
Can someone please help? what am i doing wrong?
Thanks!
The underline is most likely the cause of your issueQphoria wrote: 5c. For modules that use underscores (i.e. pp_standard) You must ensure that the class name at the top of the controller & model files does NOT have this _ after doing the replace all.
Correct: class ControllerPaymentPPStandard extends
Incorrect: class ControllerPaymentPP_Standard extends
Appeared to me the same erroreNgage wrote:I've the newest opencart version and I followed this guide to dublicate a module.
I've now dublicated the moduble cod, to cop.
But when I try to check out in the webshop I get this error:
Notice: Undefined index: code in C:\webs\Utv\shop1\catalog\view\theme\default\template\checkout\payment.tpl on line 9
payment.cpl
line 8 <tr>
line 9 <td style="width: 1px;"><?php if ($payment_method['code'] == $code || !$code) { ?>
line 10 <?php $code = $payment_method['code']; ?>
Anyone knows what's wrong?
Thanks!
I have found the solutionZaboor wrote:Appeared to me the same erroreNgage wrote:I've the newest opencart version and I followed this guide to dublicate a module.
I've now dublicated the moduble cod, to cop.
But when I try to check out in the webshop I get this error:
Notice: Undefined index: code in C:\webs\Utv\shop1\catalog\view\theme\default\template\checkout\payment.tpl on line 9
payment.cpl
line 8 <tr>
line 9 <td style="width: 1px;"><?php if ($payment_method['code'] == $code || !$code) { ?>
line 10 <?php $code = $payment_method['code']; ?>
Anyone knows what's wrong?
Thanks!
Code: Select all
'cope' => 'cop',
Code: Select all
'code' => 'cop',
Code: Select all
<?php
class ControllerModuleInformation extends Controller {
private $error = array();
public function index() {
$this->load->language('module/information_footer');
$this->document->title = $this->language->get('heading_title');
$this->load->model('setting/setting');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && ($this->validate())) {
$this->model_setting_setting->editSetting('information_footer', $this->request->post);
$this->session->data['success'] = $this->language->get('text_success');
$this->redirect(HTTPS_SERVER . 'index.php?route=extension/module&token=' . $this->session->data['token']);
}
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_enabled'] = $this->language->get('text_enabled');
$this->data['text_left'] = $this->language->get('text_left');
$this->data['text_right'] = $this->language->get('text_right');
$this->data['text_disabled'] = $this->language->get('text_disabled');
$this->data['entry_position'] = $this->language->get('entry_position');
$this->data['entry_status'] = $this->language->get('entry_status');
$this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=common/home&token=' . $this->session->data['token'],
'text' => $this->language->get('text_home'),
'separator' => FALSE
);
$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=extension/module&token=' . $this->session->data['token'],
'text' => $this->language->get('text_module'),
'separator' => ' :: '
);
$this->document->breadcrumbs[] = array(
'href' => HTTPS_SERVER . 'index.php?route=module/information_footer&token=' . $this->session->data['token'],
'text' => $this->language->get('heading_title'),
'separator' => ' :: '
);
$this->data['action'] = HTTPS_SERVER . 'index.php?route=module/information_footer&token=' . $this->session->data['token'];
$this->data['cancel'] = HTTPS_SERVER . 'index.php?route=extension/module&token=' . $this->session->data['token'];
if (isset($this->request->post['information_position'])) {
$this->data['information_footer_position'] = $this->request->post['information_footer_position'];
} else {
$this->data['information_footer_position'] = $this->config->get('information_footer_position');
}
if (isset($this->request->post['information_status'])) {
$this->data['information_footer_status'] = $this->request->post['information_footer_status'];
} else {
$this->data['information_footer_status'] = $this->config->get('information_footer_status');
}
if (isset($this->request->post['information_sort_order'])) {
$this->data['information_footer_sort_order'] = $this->request->post['information_footer_sort_order'];
} else {
$this->data['information_footer_sort_order'] = $this->config->get('information_footer_sort_order');
}
$this->template = 'module/information_footer.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
private function validate() {
if (!$this->user->hasPermission('modify', 'module/information_footer')) {
$this->error['warning'] = $this->language->get('error_permission');
}
if (!$this->error) {
return TRUE;
} else {
return FALSE;
}
}
}
?>
sash_007 wrote:hello i tried ur method for making information_footer module but when i try to install it i get this error
Fatal error: Class 'ControllerModuleinformationfooter' not found in D:\wamp\www\opencart\admin\controller\extension\module.php on line 134
me using opencart 1.4.9.5 and tested on wamp
i guess i need to change some thing inside those files too to make it work?
this is the php file within admin\controller\module\information_footer.phpCode: Select all
<?php class ControllerModuleInformation extends Controller { private $error = array(); [/quote] Maybe you should change ControllerModuleInformation in the code into ControllerModuleInformationfooter?
yeswebpr wrote:Hi, does this guide still work for v1.5.1.3?