Community Forums

How to create/duplicate a module?

Support for mods, payments, shipping, totals, modules, and languages in OpenCart v1.x

Re: How to create/duplicate a module?

Postby channelcommerce » Thu May 13, 2010 10:39 am

Thanks for the detailed reply but I am looking to achieve a different function from that.

I require a 2nd category menu to get all the necessary data from the standard categories but I need to clone the module in order to change the controller code to return the list data in the right format for a header menu.

I'm going to delete what I did earlier and try again. I beleive the issue is the admin fields it is saving the settings in are the same, so when I have my cloned module which is modified to allow for a 'Header' position it overwrites the value in the original Category module settings too.
channelcommerce
 
Posts: 46
Joined: Mon Apr 12, 2010 3:46 pm

Re: How to create/duplicate a module?

Postby Xsecrets » Thu May 13, 2010 11:31 am

that would be correct. it stores the settings according to the input name field into the settings database table, so when you are duplicating it you will need to change all the input fields to have names unique to your new module.
Xsecrets
 
Posts: 5026
Joined: Sat Oct 24, 2009 2:51 pm
Location: FL US

Re: How to create/duplicate a module?

Postby channelcommerce » Thu May 13, 2010 11:40 am

OK, i'm pretty certain i've got the Admin side fixed now, I hadn't replaced the category variables which store the position value.

Onto the Store side, well I have called my cloned module headermenu:

in catalog/controller/module/headermenu.php i've made changes to the class name, the language file and template
Code: Select all
<?php  
class ControllerModuleHeaderMenu extends Controller 
{
    protected $category_id = 0;
    protected $path = array();
    
    protected function index
() {
        $this->language->load('module/headermenu');
        
        $this
->data['heading_title'] = $this->language->get('heading_title');
        
        $this
->load->model('catalog/category');
        $this->load->model('tool/seo_url');
        
        if 
(isset($this->request->get['path'])) {
            $this->path = explode('_', $this->request->get['path']);
            
            $this
->category_id = end($this->path);
        }
        
        $this
->data['category'] = $this->getCategories(0);
                                                
        $this
->id = 'category';

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/headermenu.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/module/headermenu.tpl';
        } else {
            $this->template = 'default/template/module/headermenu.tpl';
        }
        
        $this
->render();
      }
 


I've created a language file with the heading title set to Header Manu.

I've created a copy of the category.tpl and renamed that to headermenu.tpl

Finally I copied the category.php and changed the top line of the new catalog/model/catalog/headermenu.php
Code: Select all
<?php
class ModelCatalogHeaderMenu extends Model {


Now, in my store, my original Categories box has the title Header Menu and at the botton of the left column which is currently where i'm trying to get this menu at first I have an error:

Notice: Undefined variable: headermenu in D:\www\opencart\catalog\view\theme\default\template\common\column_left.tpl on line 3

Any suggestions? Like I say, I don't want to change the model, just the controller and view so I can display a different version of the category menu with the original on my site.
channelcommerce
 
Posts: 46
Joined: Mon Apr 12, 2010 3:46 pm

Re: How to create/duplicate a module?

Postby Xsecrets » Thu May 13, 2010 1:18 pm

did you create a headermenu language file?
you are calling
Code: Select all
$this->language->load('module/headermenu'); 

but if you don't have a catalog/language/yourlanguage/module/headermenu.php file then none of the language variables will be set.
Xsecrets
 
Posts: 5026
Joined: Sat Oct 24, 2009 2:51 pm
Location: FL US

Re: How to create/duplicate a module?

Postby channelcommerce » Fri May 14, 2010 4:07 am

Yes I have created the language file, thats the other strange problem i'm having. The original category box is showing the heading 'Header Menu'.

Update: I found the line I had missed. I had to change the id of the module in catalog/controller/module/headermenu.php
Code: Select all
$this->id = 'headermenu'; 


I'm going to document this now before I forget!

Edit: Got this working and the reason why I was doing it is not in the Contributions section:
viewtopic.php?f=23&t=14674
channelcommerce
 
Posts: 46
Joined: Mon Apr 12, 2010 3:46 pm

Information Dublicate Module (not showing in Catalog)

Postby NatureGlass » Mon May 17, 2010 2:13 pm

Hello there,
I have also duplicate a Module (information)
I’m trying to make a Recipes Module
I did all as instructed, I also duplicate in mySQL, "information, information_description, information_to_store" to "recipes, recipes_description, recipes_to_store"
It installs and show's to my shop

but in admin panel at dropdown menu Catalog is not showing my new module "Recipes" like Information, so I can't change the infos, only thru SQL

So, What I’m missing?!?

I have also attached my module if someone can help!
Thanks
Attachments
Recipes Module.rar
This is a dublicated Information Module to recipes module
(20.36 KiB) Downloaded 347 times
NatureGlass
 
Posts: 9
Joined: Mon May 17, 2010 1:59 pm

Re: Information Dublicate Module (not showing in Catalog)

Postby JNeuhoff » Mon May 17, 2010 4:13 pm

NatureGlass wrote:....
So, What I’m missing?!?
....


Have you made sure your admin/view/template/common/header.tpl contains an entry for recipes?
J.Neuhoff - MHC Web Design

Override Engine (V6.3) for OpenCart 1.5.x.x and Override Engine (V6.4) for OpenCart 2.0
allowing extensions to override and modify core methods, language files and templates (see also FAQ)

VQMod for OpenCart 2.0
a dynamic modification system for core files, controlled by XML-specifications
User avatar
JNeuhoff
 
Posts: 2532
Joined: Tue Dec 04, 2007 2:38 pm

Re: Information Dublicate Module (not showing in Catalog)

Postby NatureGlass » Mon May 17, 2010 8:07 pm

Thanks man!I forgot is Case Sensitive in there! :P
NatureGlass
 
Posts: 9
Joined: Mon May 17, 2010 1:59 pm

Re: How to create/duplicate a module?

Postby gergovprint » Sun May 23, 2010 10:40 am

Qphoria wrote:Yes. The same concept applies from the first post.
1. admin/controller/module/category.php
2. admin/language/english/module/category.php
3. admin/view/template/module/category.tpl
4. catalog/controller/module/category.php
5. catalog/language/english/module/category.php
6. catalog/view/theme/default/template/module/category.tpl


I try to duplicate YouTube module 2 times, I have 2 different vieo movie, but not awarded. In the Administrative Panel was released after I click Install to install the module, but when pressed nothing happens EDIT. Where wrong, below I show what I do if someone is being read, let me help, I'll be grateful 3 days now to try and accomplish nothing. Thanks

Copy all files
1. admin/controller/module/s_youtube.php
2. admin/language/english/module/s_youtube.php
3. admin/view/template/module/s_youtube.tpl
4. catalog/controller/module/s_youtube.php
5. catalog/language/english/module/s_youtube.php
6. catalog/view/theme/default/template/module/s_youtube.tpl

Rename to
1. admin/controller/module/reklama1.php
2. admin/language/english/module/reklama1.php
3. admin/view/template/module/reklama1.tpl
4. catalog/controller/module/reklama1.php
5. catalog/language/english/module/reklama1.php
6. catalog/view/theme/default/template/module/reklama1.tpl

=========================================================
1.OPEN - admin/controller/module/s_youtube.php
Code: Select all
<?php
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################
class ControllerModuleSyoutube extends Controller {            
   private $error = array();
   
   public function index() {   
      $this->load->language('module/s_youtube');

      $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('s_youtube', $this->request->post);      
               
         $this->session->data['success'] = $this->language->get('text_success');
                  
         $this->redirect($this->url->https('extension/module'));
      }
            
      $this->data['heading_title'] = $this->language->get('heading_title');

      $this->data['text_enabled'] = $this->language->get('text_enabled');
      $this->data['text_disabled'] = $this->language->get('text_disabled');
      $this->data['text_left'] = $this->language->get('text_left');
      $this->data['text_right'] = $this->language->get('text_right');
      
      $this->data['entry_code'] = $this->language->get('entry_code');
      $this->data['entry_help'] = $this->language->get('entry_help');
      $this->data['entry_version_status'] = $this->language->get('entry_version_status');
      $this->data['entry_author'] = $this->language->get('entry_author');
      $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');

      $this->data['tab_general'] = $this->language->get('tab_general');

       if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
      } else {
         $this->data['error_warning'] = '';
      }
      if (isset($this->error['sort_order'])) {
         $this->data['error_sort_order'] = $this->error['sort_order'];
      } else {
         $this->data['error_sort_order'] = '';
      }
      if (isset($this->error['code'])) {
         $this->data['error_code'] = $this->error['code'];
      } else {
         $this->data['error_code'] = '';
      }
      
         $this->document->breadcrumbs = array();

         $this->document->breadcrumbs[] = array(
             'href'      => $this->url->https('common/home'),
             'text'      => $this->language->get('text_home'),
            'separator' => FALSE
         );

         $this->document->breadcrumbs[] = array(
             'href'      => $this->url->https('extension/module'),
             'text'      => $this->language->get('text_module'),
            'separator' => ' :: '
         );
      
         $this->document->breadcrumbs[] = array(
             'href'      => $this->url->https('module/s_youtube'),
             'text'      => $this->language->get('heading_title'),
            'separator' => ' :: '
         );
      
      $this->data['action'] = $this->url->https('module/s_youtube');
      
      $this->data['cancel'] = $this->url->https('extension/module');

      
      if (isset($this->request->post['s_youtube_position'])) {
         $this->data['s_youtube_position'] = $this->request->post['s_youtube_position'];
      } else {
         $this->data['s_youtube_position'] = $this->config->get('s_youtube_position');
      }
      
      if (isset($this->request->post['s_youtube_status'])) {
         $this->data['s_youtube_status'] = $this->request->post['s_youtube_status'];
      } else {
         $this->data['s_youtube_status'] = $this->config->get('s_youtube_status');
      }
      
      
      if (isset($this->request->post['s_youtube_sort_order'])) {
         $this->data['s_youtube_sort_order'] = $this->request->post['s_youtube_sort_order'];
      } else {
         $this->data['s_youtube_sort_order'] = $this->config->get('s_youtube_sort_order');
      }            
      if (isset($this->request->post['s_youtube_code'])) {
         $this->data['s_youtube_code'] = $this->request->post['s_youtube_code'];
      } else {
         $this->data['s_youtube_code'] = $this->config->get('s_youtube_code');
      }            
      
      $this->template = 'module/s_youtube.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/s_youtube')) {
         $this->error['warning'] = $this->language->get('error_permission');
      }
      if (!$this->request->post['s_youtube_sort_order']) {
         $this->error['sort_order'] = $this->language->get('error_sort_order');
      }
      if (!$this->request->post['s_youtube_code']) {
         $this->error['code'] = $this->language->get('error_code');
      }
      
      if (!$this->error) {
         return TRUE;
      } else {
         return FALSE;
      }   
   }



}
?>


FIND ALL FILES "s_youtube" AND REPLACE TO "reklama"
1.SAVE TO - admin/controller/module/reklama.php
Code: Select all
<?php
#############################################################################
#  ?????????? www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  ??? Somsak2004 ?????? 29 ?????? 2553                                                                                                               #
#############################################################################
# ?????????????????                                                                                                                                            #
# Unitedsme.com : ??????????????????????????????? ??????? ???? Linux                                                                             #
# Net-LifeStyle.com : ???????????????????????????????? ??????? ???? Linux                                                           #
# SiamWebThai.com : SEO ??????? ??????????????????? ?????? ????????????? / ?????????????? ???????? Google          #
#############################################################################
class ControllerModuleSyoutube extends Controller {            
   private $error = array();
   
   public function index() {   
      $this->load->language('module/reklama');

      $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('reklama', $this->request->post);      
               
         $this->session->data['success'] = $this->language->get('text_success');
                  
         $this->redirect($this->url->https('extension/module'));
      }
            
      $this->data['heading_title'] = $this->language->get('heading_title');

      $this->data['text_enabled'] = $this->language->get('text_enabled');
      $this->data['text_disabled'] = $this->language->get('text_disabled');
      $this->data['text_left'] = $this->language->get('text_left');
      $this->data['text_right'] = $this->language->get('text_right');
      
      $this->data['entry_code'] = $this->language->get('entry_code');
      $this->data['entry_help'] = $this->language->get('entry_help');
      $this->data['entry_version_status'] = $this->language->get('entry_version_status');
      $this->data['entry_author'] = $this->language->get('entry_author');
      $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');

      $this->data['tab_general'] = $this->language->get('tab_general');

       if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
      } else {
         $this->data['error_warning'] = '';
      }
      if (isset($this->error['sort_order'])) {
         $this->data['error_sort_order'] = $this->error['sort_order'];
      } else {
         $this->data['error_sort_order'] = '';
      }
      if (isset($this->error['code'])) {
         $this->data['error_code'] = $this->error['code'];
      } else {
         $this->data['error_code'] = '';
      }
      
         $this->document->breadcrumbs = array();

         $this->document->breadcrumbs[] = array(
             'href'      => $this->url->https('common/home'),
             'text'      => $this->language->get('text_home'),
            'separator' => FALSE
         );

         $this->document->breadcrumbs[] = array(
             'href'      => $this->url->https('extension/module'),
             'text'      => $this->language->get('text_module'),
            'separator' => ' :: '
         );
      
         $this->document->breadcrumbs[] = array(
             'href'      => $this->url->https('module/reklama'),
             'text'      => $this->language->get('heading_title'),
            'separator' => ' :: '
         );
      
      $this->data['action'] = $this->url->https('module/reklama');
      
      $this->data['cancel'] = $this->url->https('extension/module');

      
      if (isset($this->request->post['reklama_position'])) {
         $this->data['reklama_position'] = $this->request->post['reklama_position'];
      } else {
         $this->data['reklama_position'] = $this->config->get('reklama_position');
      }
      
      if (isset($this->request->post['reklama_status'])) {
         $this->data['reklama_status'] = $this->request->post['reklama_status'];
      } else {
         $this->data['reklama_status'] = $this->config->get('reklama_status');
      }
      
      
      if (isset($this->request->post['reklama_sort_order'])) {
         $this->data['reklama_sort_order'] = $this->request->post['reklama_sort_order'];
      } else {
         $this->data['reklama_sort_order'] = $this->config->get('reklama_sort_order');
      }            
      if (isset($this->request->post['reklama_code'])) {
         $this->data['reklama_code'] = $this->request->post['reklama_code'];
      } else {
         $this->data['reklama_code'] = $this->config->get('reklama_code');
      }            
      
      $this->template = 'module/reklama.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/reklama')) {
         $this->error['warning'] = $this->language->get('error_permission');
      }
      if (!$this->request->post['reklama_sort_order']) {
         $this->error['sort_order'] = $this->language->get('error_sort_order');
      }
      if (!$this->request->post['reklama_code']) {
         $this->error['code'] = $this->language->get('error_code');
      }
      
      if (!$this->error) {
         return TRUE;
      } else {
         return FALSE;
      }   
   }



}
?>



2. OPEN - admin/language/english/module/s_youtube.php
Code: Select all
<?php
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################

// Heading
$_['heading_title']    = 'Youtube';

// Text
$_['text_module']      = 'Modules';
$_['text_success']     = 'Success: You have modified module Youtube!';
$_['text_left']        = 'Left';
$_['text_right']       = 'Right';

// Entry
$_['entry_position']   = 'Position:';
$_['entry_status']     = 'Status:';
$_['entry_code']     = 'Code:';
$_['entry_sort_order'] = 'Sort Order:';
$_['entry_version_status']   = 'Credits:';
$_['entry_author']        = 'Author Details:';
$_['entry_help']        = '<br /> *** (sample) See URL in top-right  then you see black code after v= <br /> http://www.youtube.com/watch?v=<b>BA7fdSkp8ds</b> enter code is BA7fdSkp8ds ';
// Error
$_['error_permission'] = 'Warning: You do not have permission to modify module Youtube!';
$_['error_sort_order']       = 'Please enter position!';
$_['error_code']       = 'Please enter code of youtube!';
?>


FIND ALL FILES "s_youtube" AND REPLACE TO "reklama"
2.SAVE TO - admin/language/english/module/reklama.php
Code: Select all
<?php
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################

// Heading
$_['heading_title']    = 'Reklama';

// Text
$_['text_module']      = 'Modules';
$_['text_success']     = 'Success: You have modified module Youtube!';
$_['text_left']        = 'Left';
$_['text_right']       = 'Right';

// Entry
$_['entry_position']   = 'Position:';
$_['entry_status']     = 'Status:';
$_['entry_code']     = 'Code:';
$_['entry_sort_order'] = 'Sort Order:';
$_['entry_version_status']   = 'Credits:';
$_['entry_author']        = 'Author Details:';
$_['entry_help']        = '<br /> *** (sample) See URL in top-right  then you see black code after v= <br /> http://www.youtube.com/watch?v=<b>BA7fdSkp8ds</b> enter code is BA7fdSkp8ds ';
// Error
$_['error_permission'] = 'Warning: You do not have permission to modify module Youtube!';
$_['error_sort_order']       = 'Please enter position!';
$_['error_code']       = 'Please enter code of youtube!';
?>
gergovprint
 
Posts: 68
Joined: Wed Apr 28, 2010 9:03 am

Re: How to create/duplicate a module?

Postby gergovprint » Sun May 23, 2010 10:41 am

PART-2



3. OPEN - admin/view/template/module/s_youtube.tpl
Code: Select all
<?php echo $header; ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('view/image/module.png');"><?php echo $heading_title; ?></h1>
    <div class="buttons"><a onclick="$('#form').submit();" class="button"><span><?php echo $button_save; ?></span></a><a onclick="location='<?php echo $cancel; ?>';" class="button"><span><?php echo $button_cancel; ?></span></a></div>
  </div>
  <div class="content">
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
  <div id="tab_general" class="page">
    <table class="form">
    <tr>
        <td><?php echo $entry_position; ?></td>
        <td><select name="s_youtube_position">
            <?php if ($s_youtube_position == 'left') { ?>
            <option value="left" selected="selected"><?php echo $text_left; ?></option>
            <?php } else { ?>
            <option value="left"><?php echo $text_left; ?></option>
            <?php } ?>
            <?php if ($s_youtube_position == 'right') { ?>
            <option value="right" selected="selected"><?php echo $text_right; ?></option>
            <?php } else { ?>
            <option value="right"><?php echo $text_right; ?></option>
            <?php } ?>
          </select></td>
      </tr>
      <tr>
        <td><?php echo $entry_status; ?></td>
        <td><select name="s_youtube_status">
            <?php if ($s_youtube_status) { ?>
            <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
            <option value="0"><?php echo $text_disabled; ?></option>
            <?php } else { ?>
            <option value="1"><?php echo $text_enabled; ?></option>
            <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
            <?php } ?>
          </select></td>
      </tr>


      <tr>
        <td><?php echo $entry_sort_order; ?></td>
        <td><input type="text" name="s_youtube_sort_order" value="<?php echo $s_youtube_sort_order; ?>" size="1" />
   <?php if ($error_sort_order) { ?>
           <div class="error"><?php echo $error_sort_order; ?></div>
        <?php } ?>
   </td>
      </tr>     
     
      <tr>
        <td><?php echo $entry_code; ?></td>
        <td><input type="text" name="s_youtube_code" value="<?php echo $s_youtube_code; ?>" size="10" />
   <?php echo $entry_help; ?>
   <?php if ($error_code) { ?>
           <div class="error"><?php echo $error_code; ?></div>
        <?php } ?>
   </td>
      </tr>

      <tr>
        <td style="vertical-align: middle;"><?php echo $entry_version_status ?></td>
   <td style="vertical-align: middle;"><a href="http://www.siamopencart.com/">SiamOpencart.com</a></td>
      </tr>
      <tr>
        <td><?php echo $entry_author; ?></td>
        <td>Somsak2004<br />
        Email: <a href="mailto:sanma2001@hotmail.com">sanma2001@hotmail.com</a><br />
       Web: <a href="http://www.somsak2004.com/">http://www.somsak2004.net/</a><br />
   </td>
    </table>
  </div>
</form>
<script type="text/javascript"><!--
$.tabs('.tabs a');
//--></script>
<?php echo $footer; ?>


FIND ALL FILES "s_youtube" AND REPLACE TO "reklama"
3.SAVE TO - admin/view/template/module/reklama.tpl

Code: Select all
<?php echo $header; ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('view/image/module.png');"><?php echo $heading_title; ?></h1>
    <div class="buttons"><a onclick="$('#form').submit();" class="button"><span><?php echo $button_save; ?></span></a><a onclick="location='<?php echo $cancel; ?>';" class="button"><span><?php echo $button_cancel; ?></span></a></div>
  </div>
  <div class="content">
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
  <div id="tab_general" class="page">
    <table class="form">
    <tr>
        <td><?php echo $entry_position; ?></td>
        <td><select name="reklama_position">
            <?php if ($reklama_position == 'left') { ?>
            <option value="left" selected="selected"><?php echo $text_left; ?></option>
            <?php } else { ?>
            <option value="left"><?php echo $text_left; ?></option>
            <?php } ?>
            <?php if ($reklama_position == 'right') { ?>
            <option value="right" selected="selected"><?php echo $text_right; ?></option>
            <?php } else { ?>
            <option value="right"><?php echo $text_right; ?></option>
            <?php } ?>
          </select></td>
      </tr>
      <tr>
        <td><?php echo $entry_status; ?></td>
        <td><select name="reklama_status">
            <?php if ($reklama_status) { ?>
            <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
            <option value="0"><?php echo $text_disabled; ?></option>
            <?php } else { ?>
            <option value="1"><?php echo $text_enabled; ?></option>
            <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
            <?php } ?>
          </select></td>
      </tr>


      <tr>
        <td><?php echo $entry_sort_order; ?></td>
        <td><input type="text" name="reklama_sort_order" value="<?php echo $reklama_sort_order; ?>" size="1" />
   <?php if ($error_sort_order) { ?>
           <div class="error"><?php echo $error_sort_order; ?></div>
        <?php } ?>
   </td>
      </tr>     
     
      <tr>
        <td><?php echo $entry_code; ?></td>
        <td><input type="text" name="reklama_code" value="<?php echo $reklama_code; ?>" size="10" />
   <?php echo $entry_help; ?>
   <?php if ($error_code) { ?>
           <div class="error"><?php echo $error_code; ?></div>
        <?php } ?>
   </td>
      </tr>

      <tr>
        <td style="vertical-align: middle;"><?php echo $entry_version_status ?></td>
   <td style="vertical-align: middle;"><a href="http://www.siamopencart.com/">SiamOpencart.com</a></td>
      </tr>
      <tr>
        <td><?php echo $entry_author; ?></td>
        <td>Somsak2004<br />
        Email: <a href="mailto:sanma2001@hotmail.com">sanma2001@hotmail.com</a><br />
       Web: <a href="http://www.somsak2004.com/">http://www.somsak2004.net/</a><br />
   </td>
    </table>
  </div>
</form>
<script type="text/javascript"><!--
$.tabs('.tabs a');
//--></script>
<?php echo $footer; ?>


4. OPEN - catalog/controller/module/s_youtube.php
Code: Select all
<?php 
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################
class ControllerModuleSyoutube  extends Controller {      

   protected function index() {

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

         $this->data['heading_title'] = $this->language->get('heading_title');
         $this->data['youtube_extension'] = $this->language->get('youtube_extension');
      

        $this->data['code']= html_entity_decode($this->config->get('s_youtube_code'), ENT_QUOTES);

      $this->id = 's_youtube';

      if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/s_youtube.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/module/s_youtube.tpl';
      } else {
         $this->template = 'default/template/module/s_youtube.tpl';
      }
      $this->render();
   }
}
?>


FIND ALL FILES "s_youtube" AND REPLACE TO "reklama"
4.SAVE TO - catalog/controller/module/reklama.php
Code: Select all
<?php 
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################
class ControllerModuleSyoutube  extends Controller {      

   protected function index() {

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

         $this->data['heading_title'] = $this->language->get('heading_title');
         $this->data['youtube_extension'] = $this->language->get('youtube_extension');
      

        $this->data['code']= html_entity_decode($this->config->get('reklama_code'), ENT_QUOTES);

      $this->id = 'reklama';

      if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/reklama.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/module/reklama.tpl';
      } else {
         $this->template = 'default/template/module/reklama.tpl';
      }
      $this->render();
   }
}
?>


5. OPEN - catalog/language/english/module/s_youtube.php
Code: Select all
<?php
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################
// Heading
$_['heading_title']  = 'Movie';
$_['youtube_extension']  = '&hl=en_US&fs=1&';
?>


5.SAVE TO - catalog/language/english/module/reklama.php
Code: Select all
<?php
#############################################################################
#  ภาษาไทยจาก www.siamopencart.com ,www.thaiopencart.com                                                                             #
#  โดย Somsak2004 วันที่ 29 มกราคม 2553                                                                                                               #
#############################################################################
# โดยการสนับสนุนจาก                                                                                                                                            #
# Unitedsme.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์ จดโดเมน ระบบ Linux                                                                             #
# Net-LifeStyle.com : ผู้ให้บริการเช่าพื้นที่เว็บไซต์์ จดโดเมน ระบบ Linux                                                           #
# SiamWebThai.com : SEO ขั้นเทพ โปรโมทเว็บขั้นเซียน ออกแบบ พัฒนาเว็บไซต์ / ตามความต้องการ และถูกใจ Google          #
#############################################################################
// Heading
$_['heading_title']  = 'Movie';
$_['youtube_extension']  = '&hl=en_US&fs=1&';
?>



6. OPEN -catalog/view/theme/default/template/module/s_youtube.tpl
Code: Select all
<div class="box">
  <div class="top"><img src="catalog/view/theme/default/image/icon-youtube.gif" alt="" /><?php echo $heading_title; ?></div>
  <div class="middle" style="text-align: center;">
   <object width="160" height="115"><param name="movie" value="http://www.youtube.com/v/<?php echo $code; ?><?php echo $youtube_extension; ?>"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<?php echo $code; ?><?php echo $youtube_extension; ?>" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="160" height="115"></embed></object>
  </div>
  <div class="bottom">&nbsp;</div>
</div>



6.SAVE TO - catalog/view/theme/default/template/module/reklama.tpl
Code: Select all
<div class="box">
  <div class="top"><img src="catalog/view/theme/default/image/icon-youtube.gif" alt="" /><?php echo $heading_title; ?></div>
  <div class="middle" style="text-align: center;">
   <object width="160" height="115"><param name="movie" value="http://www.youtube.com/v/<?php echo $code; ?><?php echo $youtube_extension; ?>"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<?php echo $code; ?><?php echo $youtube_extension; ?>" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="160" height="115"></embed></object>
  </div>
  <div class="bottom">&nbsp;</div>
</div>
gergovprint
 
Posts: 68
Joined: Wed Apr 28, 2010 9:03 am

Re: How to create/duplicate a module?

Postby deeve » Fri May 28, 2010 3:18 am

Hi Q,

I'm attempting to duplicate the default Free Shipping mod in 1.3.4 & notice there is no

catalog/view/theme/default/template file

or indeed a

catalog/controller/shipping file.

Is this correct & therefore only 5 files to change to clone this mod?

Thanks.
deeve
 
Posts: 274
Joined: Tue Oct 20, 2009 3:31 am

Re: How to create/duplicate a module?

Postby Qphoria » Fri May 28, 2010 8:31 am

correct
ImageImage
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 19191
Joined: Mon Jul 21, 2008 2:02 pm
Donate to Qphoria

Re: How to create/duplicate a module?

Postby gergovprint » Sun May 30, 2010 4:32 am

Qphoria wrote:correct


... To have done all this as I describe it but nothing happened, however, the problem otherwise
gergovprint
 
Posts: 68
Joined: Wed Apr 28, 2010 9:03 am

Re: How to create/duplicate a module?

Postby channelcommerce » Mon Jun 07, 2010 3:40 am

gergovprint wrote:
I try to duplicate YouTube module 2 times, I have 2 different vieo movie, but not awarded. In the Administrative Panel was released after I click Install to install the module, but when pressed nothing happens EDIT. Where wrong, below I show what I do if someone is being read, let me help, I'll be grateful 3 days now to try and accomplish nothing. Thanks


In the first line (of code) in admin/controller/module/reklama.php

change
Code: Select all
class ControllerModuleSyoutube extends Controller {            


to
Code: Select all
class ControllerModuleReklama extends Controller {            


I haven't checked everything else you have done but that jumped out immediately and would stop it from working.
channelcommerce
 
Posts: 46
Joined: Mon Apr 12, 2010 3:46 pm

Re: How to create/duplicate a module?

Postby freejoe » Wed Jun 23, 2010 12:07 am

I want to add another catagory module ,but after many many times ,it still can not solve.
I add the popupcatagory module, when I intall and enable it ,I see it in front page,but cannot find it in admin-Category,
and I add sub-category and products,they appeared at catagory and popupcatagory same time.
I want a new module like the catagory,and can add new sub-catagory and product at the admin-catagory page.
like:
Attachments
111.JPG
111.JPG (6.13 KiB) Viewed 6920 times
freejoe
 
Posts: 3
Joined: Mon Jun 21, 2010 3:11 am

Re: How to create/duplicate a module?

Postby Moggin » Wed Jun 23, 2010 10:19 am

freejoe wrote:I want to add another catagory module ,but after many many times ,it still can not solve.
I add the popupcatagory module, when I intall and enable it ,I see it in front page,but cannot find it in admin-Category,
and I add sub-category and products,they appeared at catagory and popupcatagory same time.
I want a new module like the catagory,and can add new sub-catagory and product at the admin-catagory page.
like:


freejoe, is this the kind of thing you want: http://theqdomain.com/ocstore/opencart_ ... _box_clone
Moggin
 
Posts: 1079
Joined: Tue May 04, 2010 3:56 pm

Re: How to create/duplicate a module?

Postby Joxe » Tue Aug 17, 2010 10:27 am

Hello,

I was trying to duplicate a shipping module (flat rate) based on this topic. The example given by Q in first post is for a payment module but for a shipping module some files are missing, such as catalog/controller/shipping/... and catalog/view/theme/default/template/shipping/... So I ignored them and managed to get a flat rate2 module. I installed it alright but after editing it I get the following error page:
Error: Could not load language shipping/flat22!Warning: Cannot modify header information - headers already sent by (output started at /home/xxxx/public_html/system/library/language.php:30) in /home/xxxx/public_html/system/engine/controller.php on line 27

What did I do wrong? :-\

EDIT: Got it! It was because of that 'flat22? instead of 'flat2'... misstaping ;D
v. 1.4.9.6 & v. 1.5.5.1
Joxe
 
Posts: 227
Joined: Tue Apr 27, 2010 5:12 pm

Re: How to create/duplicate a module?

Postby joshuapete2010 » Mon Sep 20, 2010 6:01 am

Excellent show! Thanks for sharing. Keep the good work...
Check out this San Diego house for sale service
joshuapete2010
 
Posts: 1
Joined: Mon Sep 20, 2010 5:54 am

Re: How to create/duplicate a module?

Postby vincrixfo » Tue Sep 28, 2010 10:52 pm

Really thanks a lot buddy ...

this helps me a lot for duplicating payments ....
User avatar
vincrixfo
 
Posts: 7
Joined: Tue Sep 28, 2010 10:13 pm
Location: India

Re: How to create/duplicate a module?

Postby polloyeah » Thu Nov 11, 2010 12:08 pm

i'm trying to duplicate featured module in 1.4.9.1 but when edit the module this show me a blank page... someone did it?

Thank you!
polloyeah
 
Posts: 2
Joined: Thu Nov 11, 2010 11:58 am

PreviousNext

Return to Extension Support

Who is online

Users browsing this forum: No registered users and 3 guests

Hosted by Arvixe Web Hosting