Post by anel » Fri Aug 22, 2008 9:58 am

Hi. I have flat rate shipping already (3.50) How do I make priority shipping (6.50)?
I made a php file where I put everything from flat.php to it and changed all flat words to priority. Well it didn't do anything, I can't configure. What do I do?

Newbie

Posts

Joined
Fri Aug 22, 2008 9:39 am

Post by bruce » Fri Aug 22, 2008 10:30 am

It is not just one file...

admin\controller\shipping_priority.php
admin\language\english\controller\shipping_priority.php
admin\template\default\content\shipping_priority.tpl

catalog\extension\shipping\priority.php
catalog\language\english\extension\shipping\priority.php

If you already have all of these then you need to insert this new payment extension in your store admin.
Then go to user groups and "authorise" yourself to modify it.
Then go back to the payment extension and install it.

There are various posts already which describe this process in more detail if you need them and one by me showing how to get rid of the annoying "self authorisation" required for the store admin.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by anel » Sun Aug 24, 2008 4:26 am

Thanks. I was trying to find anything useful, but couldn't. Can you link me?

How do I authorize it? What name do I need to give it?
Can you tell me step by step like from what folder to what folder do I have to go and how to name it (because I did everything standard and just changed the name flat to priority)? I'm not a programmer.
Last edited by anel on Sun Aug 24, 2008 5:06 am, edited 1 time in total.

Newbie

Posts

Joined
Fri Aug 22, 2008 9:39 am

Post by JNeuhoff » Sun Aug 24, 2008 9:52 pm

Ok, Assuming you created a copy of the flat shipping module and renamed all occurences of 'flat' to 'priority' inside those files, then you should have ended up with the 5 files:

  admin\controller\shipping_priority.php
  admin\language\english\controller\shipping_priority.php
  admin\template\default\content\shipping_priority.tpl
  catalog\extension\shipping\priority.php
  catalog\language\english\extension\shipping\priority.php

Now, in order to install it, go to the OpenCart Admin panel:

Select the menu Extensions > Shipping
This will list the available shipping modules.

Click on the Insert-button and then enter the following details:

Extension Name: Priority Rate
Description: Priority Rate Shipping
Code: priority
Directory: shipping
Filename: priority.php
Controller: shipping_priority

Click on the Save button.

Now you need to authorize yourself before proceeding with the installation and configuration.
Go to Admin > Configuration > Users > User Group
This will show a list of user groups.
Click on the Update-icon on the right side for the top adminstrator
For both the Access and Modify multichoice lists enable the new 'shipping_priority' entries (using Ctrl-Right-Click)

Now continue with the installation of your new shipping module.
Go back to the Extensions > Shipping menu
Click on the Install-icon (a 'Plus' symbol) to the right for your 'Priority Rate' entry to install it.
Click on the Configure-icon to the right to show the configuration screen and enter your configuration values.
Last edited by JNeuhoff on Sun Aug 24, 2008 9:59 pm, edited 1 time in total.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by anel » Sun Aug 31, 2008 3:20 am

That's so weird. When I did everything you told me, but when I click on the plus sign it says everything went great (Success: You have updated shipping priority rate!) but configure button doesn't show up. What's wrong?

Newbie

Posts

Joined
Fri Aug 22, 2008 9:39 am

Post by bruce » Sun Aug 31, 2008 12:12 pm

Hi anel,

Edit the file admin\controller\extension.php by commenting out several lines as follows.

Code: Select all

//			if (count($array) == 3) {
//				$setting_info = $database->countRows($database->parse("select * from setting where type = '?' and `group` = '?'", $array[1], $result['code']));
//			} else {
				$setting_info = $database->countRows($database->parse("select * from setting where `group` = '?'", $result['code']));
//			}
I would welcome comments by anyone who can find or knows of any negative impact in removing this annoying little segment of code.

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by JNeuhoff » Sun Aug 31, 2008 9:11 pm

I would welcome comments by anyone who can find or knows of any negative impact in removing this annoying little segment of code.
This is in there for a good a reason and shouldn't be commented out.

Some extension controller names consist of 3 parts, separated by '_' characters, such as 'module_catalog_category', as opposed to those extensions which have only 2 parts in their controller names, such as 'shipping_flat'.

Make sure the controller name for the priority shipping module is something like 'shipping_priority'
but configure button doesn't show up. What's wrong?
I am not sure, but I don't think commenting out the code lines as per Bruce's suggestion is the right way.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JNeuhoff » Sun Aug 31, 2008 9:28 pm

Also, in the /admin/controller/shipping_priority.php file, in method index, it should contain the lines

Code: Select all

		......
		if (($request->isPost()) && ($this->validate())) {
			$database->query("delete from setting where `group` = 'priority'");
			$database->query($database->parse("insert into setting set type = 'global', `group` = 'priority', `key` = 'priority_status', `value` = '?'", $request->get('global_priority_status', 'post')));
			.....
		}
		......
		if ($request->has('global_priority_status', 'post')) {
			$view->set('global_priority_status', $request->get('global_priority_status', 'post'));
		} else {
			$view->set('global_priority_status', @$setting_info['global']['priority_status']);
		}
		.......
and the corresponding /admin/template//content/shipping_expected.tpl file should include this:

Code: Select all

            <tr>
              <td width="185"><?php echo $entry_status; ?></td>
              <td><select name="global_priority_status">
                  <?php if ($global_priority_status) { ?>
                  <option value="1" 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><?php echo $text_disabled; ?></option>
                  <?php } ?>
                </select></td>
            </tr>

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by bruce » Sun Aug 31, 2008 11:00 pm

Wow Juergen, I am definitely not batting well lately.  :D

My suggestion was wrong and even if it was right, would not be the answer to the problem with priority shipping.

That bit of code has been problematic for me in the past and today. Opencart in its raw form does not install or uninstall extensions in admin with names in three sections separated by underscores (eg: integration_order_export.php) unless they are in the form  something_catalog_something.php or something_admin_something.php

The following is the correct way to deal with it.

Code: Select all

			$array = explode('_', $result['controller']);
			//
			//  Special case relies on the naming convention
			//  module_admin_header
			//  to extract admin as the type in the following query.
			//  The extra check allows modifiers to have controllers with three sections that do not rely on the special case.
			//  eg:  integration_order_export
			//
			//if (count($array) == 3) {
			if (count($array) == 3 && in_array($array[1], array('admin','catalog')))
			{
					$setting_info = $database->countRows($database->parse("select * from setting where type = '?' and `group` = '?'", $array[1], $result['code']));
			}
			else
			{
				$setting_info = $database->countRows($database->parse("select * from setting where `group` = '?'", $result['code']));
			}


cheers

Bruce

Active Member

Posts

Joined
Wed Dec 12, 2007 2:26 pm

Post by Qphoria » Fri Oct 31, 2008 11:30 pm

Fixed in 0.7.current.
Thanks bruce.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 1 guest