Post by Qphoria » Tue Jan 19, 2010 3:54 am

Perhaps you just answered your own question. See how they did it, and what files are involved. Then use that info to create your own.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Miguelito » Fri Jan 22, 2010 6:26 am

Well back to creating a new shipping method based on weight based shipping...

Done as Q has instructed in the start of this thread and got an error when trying to use the new one in the store:
Fatal error: Call to undefined method Cart::getPostipaketti() in /home/mikimpor/public_html/opencart/catalog/model/shipping/postipaketti.php on line 26

Checked that and changed the line back to:
$postipaketti = $this->cart->getWeight();

Then again tried and got an error:
Fatal error: Call to a member function format() on a non-object in /home/mikimpor/public_html/opencart/catalog/model/shipping/postipaketti.php on line 45

If someone could point me where the problem is...? (not a coder)

The Finnish OpenCart Forum
"Real programmers don't document. If it was hard to write, it should be hard to understand."


Active Member

Posts

Joined
Sun Jan 10, 2010 10:11 pm

Post by Litriem » Sat Jan 23, 2010 6:24 am

Qphoria,

Great post, I plan on putting together a module soon and this will definitely be my guide.

Newbie

Posts

Joined
Wed Dec 30, 2009 12:12 am

Post by Qphoria » Thu Feb 04, 2010 5:06 am

Miguelito wrote:Well back to creating a new shipping method based on weight based shipping...

Done as Q has instructed in the start of this thread and got an error when trying to use the new one in the store:
Fatal error: Call to undefined method Cart::getPostipaketti() in /home/mikimpor/public_html/opencart/catalog/model/shipping/postipaketti.php on line 26

Checked that and changed the line back to:
$postipaketti = $this->cart->getWeight();

Then again tried and got an error:
Fatal error: Call to a member function format() on a non-object in /home/mikimpor/public_html/opencart/catalog/model/shipping/postipaketti.php on line 45

If someone could point me where the problem is...? (not a coder)
You are trying to format somewhere but probably didn't load the model first

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Miguelito » Mon Feb 08, 2010 2:53 am

Hi Q! I resolved my case with the help of another shipping method so again "trial-mistake" process was the best :)

The Finnish OpenCart Forum
"Real programmers don't document. If it was hard to write, it should be hard to understand."


Active Member

Posts

Joined
Sun Jan 10, 2010 10:11 pm

Post by ibparn » Wed Feb 17, 2010 4:38 pm

Qphoria wrote:Ah ok.. so you are 90% there.
The last step is the database (model) stuff. Since information has its own model file

Clone the
admin/model/catalog/information.php
file to event.php as well. That is your missing link
This was some great info and I did what I think is exacty what was suggested, yet I'm having the same problem.
I cloned the file as suggested yet I'm still unable to access it via the admin screen.

Any other suggestions.

User avatar
New member

Posts

Joined
Sun Feb 07, 2010 2:47 pm

Post by L0oney » Wed Mar 10, 2010 11:21 pm

Hi Everyone,

I am a webdesigner based in South Africa, with a basic understanding of php ;D
I am trying to create a payment gateway module for mygate.co.za, for SIM credit card processing. I was wondering which of the current modules would be best to use as a 'template' to create my module?

Any help will be greatly appreciately, thanks in advance O0

Newbie

Posts

Joined
Wed Mar 10, 2010 11:04 pm

Post by Chris P Duck » Tue Mar 23, 2010 9:42 pm

Just been reading through this and considering making a module to list categories on the home page in a similar way to the products listed, i.e. show the category name/image and a link.

It seems odd to have to duplicate and edit seven files just to do this as it is literally a case of pulling a few records from the categories table?!

Newbie

Posts

Joined
Fri Mar 19, 2010 12:24 am

Post by Qphoria » Tue Mar 23, 2010 9:56 pm

Chris P Duck wrote:Just been reading through this and considering making a module to list categories on the home page in a similar way to the products listed, i.e. show the category name/image and a link.
This was done as a mod already here: http://forum.opencart.com/viewtopic.php ... ome#p56071
It seems odd to have to duplicate and edit seven files just to do this as it is literally a case of pulling a few records from the categories table?!
The major con of MVC is the tedious file structure. That is compounded by having separate catalog and admin trees. But the pros will usually outweigh the cons.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Chris P Duck » Tue Mar 23, 2010 10:49 pm

Thanks for the advice. The module which I downloaded which was specific to Opencart 1.4.4 doesn't seem to work though.

Initially it was having trouble loading $this->load->helper('image'); which should be $this->load->model('tool/image');

Now it's showing a different error:
Fatal error: Call to a member function http() on a non-object

I got this from the Contributions section, http://www.opencart.com/index.php?route ... ion_id=177

I assume these things have been tested since it's explained in terms of just unzipping and replacing files?

Newbie

Posts

Joined
Fri Mar 19, 2010 12:24 am

Post by Qphoria » Wed Mar 24, 2010 12:00 am

Well you can't assume "1.4.x" means it works with anything higher than 1.4.0
Those 2 things you mentioned were changes that were made in 1.4.1

See here for information on porting modules from 1.4.0 to 1.4.4
http://forum.opencart.com/viewtopic.php?f=22&t=12474

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by yeuxbleus » Fri Mar 26, 2010 11:54 pm

Hi,

I did this trick with weight.php the shipping module for weight based shipping. I have renamed all weight to weight_insurance (i want one seperate shipping for normal shipping and one for garanteed/insured shipping). Though somehow in Admin Home - Shipping after Install of the module, when I try to Edit, the screen is empty, no error, just empty.

I must have overlooked something, but cannot guess what. Who knows?

Kind regards,
Maarten

User avatar
Newbie

Posts

Joined
Wed Mar 24, 2010 6:45 pm

Post by Qphoria » Fri Mar 26, 2010 11:57 pm

Typically an empty screen is a rendering issue. But if you used the same version of the module from the version of the cart you are using you shouldn't have any rendering problems.

Be sure you have "Display errors" set to true in the settings -> Server tab

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by oz_ak » Sat Apr 17, 2010 12:08 am

Thanks to good information

Newbie

Posts

Joined
Sat Feb 13, 2010 8:12 pm

Post by webstudent1 » Tue Apr 20, 2010 8:39 am

Well back to creating a new shipping method based on weight based shipping...

Find the 3 php page in admin area for 'weight' (language / model / template)
Change all the weight values from weight to yourshippingname (except the ones used to aquire cart weight)

On the user end (controller) they are Langange and Model (2 files)
Change your text again in language and in model change all the weight values from weight to yourshippingname (except the ones used to aquire cart weight)

Works 100%

WebStudent1

New member

Posts

Joined
Thu Jan 07, 2010 2:24 am

Post by maxisgsm » Wed May 12, 2010 11:38 am

@webstudent1

Which version you duplicate weight based shipping ?? I'm trying to duplicate that weight based shipping into other weight shipping (different provider)

but the 3 php page that you said found on admin area ( langguage / model / template) inside the model folder, i cannot find weight php ...... but inside controller got one weight.php ......

New member

Posts

Joined
Tue May 11, 2010 8:44 am

Post by maxisgsm » Wed May 12, 2010 11:49 am

In template file, which line should i change from weight to myshippingname ??

Code: Select all

<td><textarea name="weight_<?php echo $geo_zone['geo_zone_id']; ?>_rate" cols="40" rows="5"><?php echo ${'weight_' . $geo_zone['geo_zone_id'] . '_rate'}; ?></textarea></td>
            </tr>
            <tr>
              <td><?php echo $entry_status; ?></td>
              <td><select name="weight_<?php echo $geo_zone['geo_zone_id']; ?>_status">
                  <?php if (${'weight_' . $geo_zone['geo_zone_id'] . '_status'}) { ?>
should i change this weight into myshippingname ??

New member

Posts

Joined
Tue May 11, 2010 8:44 am

Post by inspiredbyiris » Thu May 13, 2010 3:02 pm

Hi Q,

I duplicate a category module and it works very well, but i have a problem:

For ex:

i have two categories: Cat 1 and Cat 2

Cat 1

--- subCat 1
--- subCat 2

Cat 2

--- subCat 1
---subCat 2

when i click subCat 1 or subCat 2 in Cat 2, i got error: the page not found! Although i created successfully in admin page.

Just another question, how do i insert products into Cat 2? Which template do i have to edit?

Hope Q or someone else can help me to solve this problem?

Thanks very much!


Posts

Joined
Fri May 07, 2010 5:38 pm

Post by channelcommerce » Thu May 13, 2010 7:49 pm

I'm also trying to create a new instance of the category module to run in header with modified controller code.

I followed the steps shown to create a duplicate module and it installs but when I edit and save the changes it is interfering with the original module, do I also need to change every variable name, and the admin model file?

If I don't need to change the controller is there a simple way to output the category data (just the <ul> data) in the header.tpl such as <?php echo $category; ?> but this just outputs Array? I do have the code in header.php to load modules in the header area.

Opencart Themes and eCommerce Solutions


New member

Posts

Joined
Tue Apr 13, 2010 4:46 am

Post by inspiredbyiris » Thu May 13, 2010 10:53 pm

Hi channelcommerce,

According to my solution, i create three new tables (oc_category2, oc_category2_description,oc_category2_to_store). They look like oc_category, oc_category_description,oc_category_to_store. They are the same, just have different name.

copy category.php, category.tpl then rename them to category2. Notice: you must change all variables from category to category2, upload into those paths:

------------------------------------------------------------------------------------------------------------------
admin/controller/catalog/category2.php
FIND: admin/controller/common/header.php

Code: Select all

 [b]// Insert into header.php: [/b]
$this->data['text_category2'] = $this->language->get('text_category2');
$this->data['category2'] = HTTPS_SERVER . 'index.php?route=catalog/category2';
admin/controller/module/category2.php

admin/language/english/catalog/category2.php
FIND: admin/language/english/common/header.php

Code: Select all

 // Insert: $_['text_category2']          = 'Categories 2';
admin/language/english/module/category2.php

admin/language/vietnamese/catalog/category2.php
FIND: admin/language/vietnamese/common/header.php

Code: Select all

// Insert: $_['text_category2']          = 'Chuyên mục 2';
admin/language/vietnamese/module/category2.php

admin/model/catalog/category2.php

admin/view/template/catalog/category2_form.tpl
admin/view/template/catalog/category2_list.tpl
FIND: admin/view/template/common/header.tpl

Code: Select all

 [b]// Insert:[/b] <li><a href="<?php echo $category2; ?>"><?php echo $text_category2; ?></a></li>
admin/view/template/module/category2.tpl

catalog/controller/module/category2.php

catalog/language/english/module/category2.php
catalog/language/vietnamese/module/category2.php

catalog/model/catalog/category2.php

catalog/view/theme/YOURTEMPLATE/template/module/category2.tpl
--------------------------------------------------------------------------------------------------------------------

It runs quite well!

As you can see in my last post, i got a problem to show Cat2 in front page and how to add products to Cat2 :D. Anyone can suggest any solution? Thanks very much


Posts

Joined
Fri May 07, 2010 5:38 pm
Who is online

Users browsing this forum: No registered users and 38 guests