Page 6 of 9

R: How to create/duplicate a module?

Posted: Sat Mar 03, 2012 4:01 pm
by madimar
Hmm, maybe you missed to adapt also catalog/model category into brand?
M

Sent from my DesireHD.

Re: How to create/duplicate a module?

Posted: Tue Mar 06, 2012 2:22 am
by kisist1
// 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.

Re: How to create/duplicate a module?

Posted: Mon Mar 19, 2012 6:06 am
by snappyfish
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.

Re: How to create/duplicate a module?

Posted: Wed Mar 21, 2012 12:11 pm
by mandamexico
@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

Re: How to create/duplicate a module?

Posted: Fri Mar 30, 2012 2:30 am
by bobwhite
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

Re: How to create/duplicate a module?

Posted: Tue Apr 10, 2012 5:44 pm
by SinekSekiz
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.

Re: How to create/duplicate a module?

Posted: Tue Apr 10, 2012 10:58 pm
by Qphoria
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?

Re: How to create/duplicate a module?

Posted: Tue Apr 17, 2012 8:24 am
by SinekSekiz
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.

Re: How to create/duplicate a module?

Posted: Sat Apr 21, 2012 6:34 pm
by snappyfish
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)"

Re: How to create/duplicate a module?

Posted: Mon Apr 30, 2012 11:58 pm
by Zakash
WOW! Thanks! (: works perfect :)

Re: How to create/duplicate a module?

Posted: Sat May 12, 2012 8:20 pm
by lalitsharma1607
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.....

Re: How to create/duplicate a module?

Posted: Thu May 17, 2012 7:56 am
by storm-cloud
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?

Re: How to create/duplicate a module?

Posted: Thu May 17, 2012 11:26 pm
by Johnathan
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.

Re: How to create/duplicate a module?

Posted: Fri May 18, 2012 5:25 pm
by storm-cloud
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.

Re: How to create/duplicate a module?

Posted: Sat May 19, 2012 4:55 pm
by som1987
Dear Members,
I want to develop a new payment method. How to do this?

Thanks
Sodmeb

Re: How to create/duplicate a module?

Posted: Mon May 21, 2012 9:28 pm
by storm-cloud
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: http://forum.opencart.com/viewtopic.php ... 00#p291128 but I must be missing something?

Re: How to create/duplicate a module?

Posted: Mon May 21, 2012 11:13 pm
by Johnathan
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"); 

Re: How to create/duplicate a module?

Posted: Sat May 26, 2012 3:30 pm
by storm-cloud
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

Re: How to create/duplicate a module?

Posted: Wed May 30, 2012 3:14 pm
by opencart.customize
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

Re: How to create/duplicate a module?

Posted: Sat Jun 16, 2012 2:34 pm
by perezosogato
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 http://forum.opencart.com/viewtopic.php ... 6&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