Community Forums

How to create/duplicate a module?

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

R: How to create/duplicate a module?

Postby madimar » Sat Mar 03, 2012 8:01 am

Hmm, maybe you missed to adapt also catalog/model category into brand?
M

Sent from my DesireHD.
User avatar
madimar
 
Posts: 989
Joined: Thu Sep 24, 2009 10:27 am

Re: How to create/duplicate a module?

Postby kisist1 » Mon Mar 05, 2012 6:22 pm

// Problems with duplicateing payment methode. OC v1.5.1.3

I duplicated a few shipping methode with succes, but when I tried to duplicate payment methode I got error messeges.

Error in payment.php at line 134, when I tried to install on the admin syte
and error in one other file at line 40 if im correct, but I can't remember wich file was it.

I think the problem might be that the original payment methode use database, becouse the original payment methode is "bank trandfer" and its use the database to send one unique messege what I can edit in the admin syte.

Could someone PRO user duplicate this payment methode 3 or 4 times for me? :) PLEASE!! :)

I hope I was clear and I'm sorry for my english.
kisist1
 
Posts: 3
Joined: Sat Feb 25, 2012 2:20 pm

Re: How to create/duplicate a module?

Postby snappyfish » Sun Mar 18, 2012 10:06 pm

Followed this guide to duplicate "cash on delivery" But I get this error below in 1.5.2.1 at the checkout.

Code: Select all
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 9
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 10
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 11
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 11
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 15


Do I need to do anything with the copied files for 1.5.2.1?

Thanks.
snappyfish
 
Posts: 100
Joined: Wed Apr 13, 2011 8:36 pm

Re: How to create/duplicate a module?

Postby mandamexico » Wed Mar 21, 2012 4:11 am

@snappyfish

I get that exact same problem when duplicating COD too. I am pretty sure it has to do with the new layout of 1.5.2.1 however, after lots and lots of troubleshooting and searching the forum I have not come up with a solution.

EDIT: seems its in the catalog/model/payment folder for the payment gateway

Find:
Code: Select all
            $method_data = array(
              'id'         => 'cod',
              'title'      => $this->language->get('text_title'),


Change to:
Code: Select all
            $method_data = array(
              'code'         => 'cod',
              'title'      => $this->language->get('text_title'),


Regards,

Christian
My Extensions

Donate - If I ever helped you.
User avatar
mandamexico
 
Posts: 134
Joined: Mon Jun 29, 2009 2:14 am
Location: Los Angeles, CA

Re: How to create/duplicate a module?

Postby bobwhite » Thu Mar 29, 2012 6:30 pm

I gave up with module duplication.
I just downloaded manufacturer's module from here: http://www.opencart.com/index.php?route ... on_id=4145
modified from combo to list and it is doing job for me.
Thank you all for you comments and sujestions.
Bob
User avatar
bobwhite
 
Posts: 39
Joined: Thu Jan 26, 2012 12:20 am

Re: How to create/duplicate a module?

Postby SinekSekiz » Tue Apr 10, 2012 9:44 am

Hi

Which files do I need to change or copy to duplicate the slideshow module? I found a new jquery slider which I think would look better in my website theme and I want to change the slider to use it.

Thank you.
SinekSekiz
 
Posts: 5
Joined: Sat Apr 07, 2012 4:56 am

Re: How to create/duplicate a module?

Postby Qphoria » Tue Apr 10, 2012 2:58 pm

snappyfish wrote:Followed this guide to duplicate "cash on delivery" But I get this error below in 1.5.2.1 at the checkout.

Code: Select all
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 9
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 10
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 11
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 11
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 15


Do I need to do anything with the copied files for 1.5.2.1?

Thanks.


You cloned it back in 1.4.x and expect it to work in 1.5.x?
Image Image
Donate!|OpenCart Basics|GeoZones
Help me get more development cloud storage - Click Here to get DropBox
User avatar
Qphoria
Administrator
 
Posts: 18197
Joined: Mon Jul 21, 2008 7:02 pm
Donate to Qphoria

Re: How to create/duplicate a module?

Postby SinekSekiz » Tue Apr 17, 2012 12:24 am

I'm sorry I didn't really want to ask this again but I think I waited long enough. Could you please tell me which files I need to duplicate or modify to change slider in OC?

Thank you.
SinekSekiz
 
Posts: 5
Joined: Sat Apr 07, 2012 4:56 am

Re: How to create/duplicate a module?

Postby snappyfish » Sat Apr 21, 2012 10:34 am

Qphoria wrote:
snappyfish wrote:Followed this guide to duplicate "cash on delivery" But I get this error below in 1.5.2.1 at the checkout.

Code: Select all
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 9
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 10
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 11
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 11
2012-03-18 22:05:07 - PHP Notice:  Undefined index: code in C:\wamp\www\open\catalog\view\theme\default\template\checkout\payment_method.tpl on line 15


Do I need to do anything with the copied files for 1.5.2.1?

Thanks.


You cloned it back in 1.4.x and expect it to work in 1.5.x?


I cloned it from 1.5.x following the thread here which started with

"This guide applies to all versions of OpenCart 1.x (eg 1.3.x, 1.4.x, 1.5.x, etc)"
snappyfish
 
Posts: 100
Joined: Wed Apr 13, 2011 8:36 pm

Re: How to create/duplicate a module?

Postby Zakash » Mon Apr 30, 2012 3:58 pm

WOW! Thanks! (: works perfect :)
Zakash
 
Posts: 14
Joined: Sun Jan 15, 2012 2:48 pm

Re: How to create/duplicate a module?

Postby lalitsharma1607 » Sat May 12, 2012 12:20 pm

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.php
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;
      }   
   }
}
?>


I am also trying to do the same but i got the error as:-
Fatal error: Class 'Controllerpaymentcustompaybypoints' not found in D:\New Folder\wamp\www\newproject\upload\system\engine\front.php on line 53

i cloned the 'cod' file to 'custom_pay_by_points'.
any help will be appreciated.....
lalitsharma1607
 
Posts: 3
Joined: Tue May 08, 2012 1:30 pm

Re: How to create/duplicate a module?

Postby storm-cloud » Wed May 16, 2012 11:56 pm

Hello Q,

Another great solution! Thank you.

My goal is to be able to control the display order during checkout for the weight based shipping methods. However, since there doesn't seem to be any method to do this (or is there?), I would think perhaps this may provide a solution.

I need four weight based shipping methods that can be controlled in any sort order and not the default alphabetical order that occur when assigning multiple Geo Zones.

For example, let's say I have "Regular Shipping" and "Expedited Shipping" as Geo Zones. Naturally, the Expedited service will display above Regular during checkout as alphabetically this comes first. However, I need this to display as Regular showing first.

If I create four of these modules (three clones) then I should be able to do this (I hope). However, I successfully cloned the weight based shipping and I cannot seem to control the module individually. To clarify, any changes that I make in the clone also copies over to the original module.

It would seem that the search and replace method outlined in step one is not as simple for the weight based shipping method because the word "weight" is used for more than just the file name.

So instead what I did was to seach for "/weight" and change this to "/weight01" which changed all the directories over to the cloned file, then in controller file changed "ControllerShippingWeight" to "ControllerShippingWeight01" and in the model file changed "ModelShippingWeight" to "ModelShippingWeight01".

These are the file names that I changed from "weight" to "weight01":

admin/controller/shipping/weight.php
admin/language/english/shipping/weight.php
admin/view/template/shipping/weight.tpl
catalog/language/english/shipping/weight.php
catalog/model/shipping/weight.php
system/library/weight.php

Obviously, I do not have a clue what I am doing and I have missed something! :P

Any possibility of further guidance as to what else needs to be changed?
storm-cloud
 
Posts: 156
Joined: Wed Feb 22, 2012 12:07 am

Re: How to create/duplicate a module?

Postby Johnathan » Thu May 17, 2012 3:26 pm

You never need to duplicate the weight-based shipping module. Just duplicate your geo zone four times, and that will give you four different shipping options during checkout.
Image
ImageImageImageImageImageImageImageImageImage
User avatar
Johnathan
Global Moderator
 
Posts: 2845
Joined: Thu Dec 17, 2009 7:08 pm

Re: How to create/duplicate a module?

Postby storm-cloud » Fri May 18, 2012 9:25 am

Johnathan wrote:You never need to duplicate the weight-based shipping module. Just duplicate your geo zone four times, and that will give you four different shipping options during checkout.


Thank you for your reply. I know my post was quite long but it is obvious you missed my key point (this is not meant to sound rude in any way, I just don't know how else to state this :) ).

I understand that this can be achieved through creating more Geo Zones. However, the problem is that these are sorted alphabetically by default. I would like full control over the display order. For example, let's say I create three Geo Zones for shipping purposes. These are titled "Standard Shipping", "Tracked Shipping" and "Expedited Shipping". These will show in checkout in this order (alphabetically):

Expedited Shipping
Standard Shipping
Tracked Shipping

However, I would like the display order to be (sorted by cost rather than alphabetically):

Standard Shipping
Tracked Shipping
Expedited Shipping

The only way I can think of to achieve this is to duplicate the weight based shipping module and allocate one Geo Zone to each and then set the sort order for the actual module as I decide.

Of course, I will need to overwrite the default titles so that the same four shipping titles do not show up during checkout.

If there is an easier way to achieve this, I would be more than happy to use whichever method provides control of the sort order.
storm-cloud
 
Posts: 156
Joined: Wed Feb 22, 2012 12:07 am

Re: How to create/duplicate a module?

Postby som1987 » Sat May 19, 2012 8:55 am

Dear Members,
I want to develop a new payment method. How to do this?

Thanks
Sodmeb
som1987
 
Posts: 1
Joined: Sat May 19, 2012 8:51 am

Re: How to create/duplicate a module?

Postby storm-cloud » Mon May 21, 2012 1:28 pm

Would anyone know of a solution to the above (2 posts above)? It would be great if there were some way to manually sort the Geo Zones for the Weight Based Shipping Module during checkout.

Alternatively, I could duplicate the Weight Based Shipping Module and add a single Geo Zone to each and set the sort order for each module clone. I have attempted to do this as per this post: viewtopic.php?f=22&t=6696&start=100#p291128 but I must be missing something?
storm-cloud
 
Posts: 156
Joined: Wed Feb 22, 2012 12:07 am

Re: How to create/duplicate a module?

Postby Johnathan » Mon May 21, 2012 3:13 pm

To order the weight-based geo zones by something else, such as the "description" field, make this change:

Code: Select all
IN:
/
catalog/model/shipping/weight.php

REPLACE
:
$query $this->db->query("SELECT * FROM " DB_PREFIX "geo_zone ORDER BY name");

WITH:
$query $this->db->query("SELECT * FROM " DB_PREFIX "geo_zone ORDER BY description"); 
Image
ImageImageImageImageImageImageImageImageImage
User avatar
Johnathan
Global Moderator
 
Posts: 2845
Joined: Thu Dec 17, 2009 7:08 pm

Re: How to create/duplicate a module?

Postby storm-cloud » Sat May 26, 2012 7:30 am

Johnathan wrote:To order the weight-based geo zones by something else, such as the "description" field, make this change:


Awesome! That certainly did the trick, thank you so very much. Now I can have full control over our shipping options again! ;D
storm-cloud
 
Posts: 156
Joined: Wed Feb 22, 2012 12:07 am

Re: How to create/duplicate a module?

Postby opencart.customize » Wed May 30, 2012 7:14 am

Hello

seems I got to ask here about developing a custom product layout.

I am looking for having a different product template for some of the OCS products.

I seem found a way of changing a standard product template from setting: products product Design customDes-prod-options, see: products-product-Design-customDes-prod-options.png after I added a custome layout in admin-system-design-layouts, see: system-design-layouts-customeLayoutProductOptions.png

I also followed the way of MVC and created product duplicated layout-module-controller files:

catalog/controller/product/product-options.php
catalog/language/english/product/product-options.php
catalog/model/catalog/product-options.php
catalog/view/theme/mytheme/template/product/product-options.tpl

The problem is that I am not sure I applied all files duplicates and changed everything needed, sorry..

I do not see any custome template to the assigned product because it definitely still uses the default one, pls advise
Attachments
system-design-layouts-customeLayoutProductOptions.png
system-design-layouts-customeLayout
system-design-layouts-customeLayoutProductOptions.png (51.81 KiB) Viewed 2957 times
products-product-Design-customDes-prod-options.png
products product Design
products-product-Design-customDes-prod-options.png (48.59 KiB) Viewed 2957 times
opencart.customize
 
Posts: 1
Joined: Wed May 30, 2012 6:34 am

Re: How to create/duplicate a module?

Postby perezosogato » Sat Jun 16, 2012 6:34 am

hi buyers,

i created a offline payment, but when i tested, i met the problem as below,

Notice: Undefined index: code in E:\xampp\htdocs\testcartv1512\catalog\view\theme\default\template\checkout\payment.tpl on line 9 Notice: Undefined index: code in E:\xampp\htdocs\testcartv1512\catalog\view\theme\default\template\checkout\payment.tpl on line 10 Offline


i using v1.5.1.2

Please helps.


--++--- i found the answer, sorry but i was not read the whole replies indeed.

the answer is in viewtopic.php?f=22&t=6696&start=80

reason :catalog\model\payment
find the created or duplicate files.
when you replace the cod, there was a word "code" was replaced as well. find check the answer from "Zaboor ", you will be grateful to Zaboor's efforts. :) ;D
perezosogato
 
Posts: 85
Joined: Sat Jul 23, 2011 5:03 pm

PreviousNext

Return to Extension Support

Who is online

Users browsing this forum: No registered users and 14 guests

Hosted by Arvixe Web Hosting