Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can Shipping modules look like this?


SeanB

Recommended Posts

I'm trying to make a shipping module, but before i start working on the code, i want to know if anyone has tried, and found out it's not possible.

 

Here's what my shipping screen looks like right now, 2 modules

 

ship1.jpg

 

Now, with most modules, having multiple shipping options seems to mean multiple modules, which would mean the screen would look like this. (imagine the 2 other items wern't both canada)

 

ship2.jpg

 

I dont quite like how that looks. I'd rather my shipping screen looked something like this.

 

ship3.jpg

 

But like i said, before i go to all the trouble, i'd rather know that it's even possible. I downloaded another flat shipping module, but it ended up looking like picture #2, and i didn't like that at all.

 

Let me know what you think.

My website's address is in My Profile, since it's not allowed to be in my signature.

Link to comment
Share on other sites

I went to all the trouble of editing that image, twice, and nobody knows.

 

Guess i'l have to give it a try. Hope it works.

 

I think this thread is worth to be answered.

 

Either i m really bad in searching but i couldn't find anyone else actually solving this issue.

 

I found this code but it's not working properly it's returning always the first value as selected.

 

/includes/modules/shipping/flat.php

 

class flat {
var $code, $title, $description, $icon, $enabled;

// class constructor
function flat() {
  global $order;

  $this->code = 'flat';
  $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);

}

// class methods
function quote($method = '') {
  global $order;

  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
						'methods' => array(array('id' => '0',
												 'title' => 'US surface',
												 'cost' => 4),
										   array('id' => '1',
												 'title' => 'US air',
												 'cost' => 6),
										   array('id' => '2',
												 'title' => 'Canada & Mexico',
												 'cost' => 6),
										   array('id' => '3',
												 'title' => 'Everywhere Else surface',
												 'cost' => 6),
										   array('id' => '4',
												 'title' => 'Everywhere Else air',
												 'cost' => 8)
										  ));

  if ($this->tax_class > 0) {
	$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  }

  if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

  return $this->quotes;
}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FLAT_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Flat Shipping', 'MODULE_SHIPPING_FLAT_STATUS', 'True', 'Do you want to offer flat rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_FLAT_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FLAT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FLAT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
}

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
  return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
}
 }

 

I cannot believe you're all so happy adding duplicate flat.php files. We could make a contribution that adds 1 flat.php that is can have up to 5 values

 

Kind Regards

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...