Zen Cart Logo
Forums / Addon Shipping Modules / Need help, a shipping module form OSC

Need help, a shipping module form OSC

Views: 1,868

Results 1 to 5 of 5
15 Mar 2011, 12:03 PM
#1
g_life_tw avatar

g_life_tw

New Zenner

Join Date:
Mar 2011
Posts:
2
Plugin Contributions:
0

Need help, a shipping module form OSC

Dear all;

Sorry to bother you, I found a shipping module (T-Cat express) from Taiwan's oscommerce, i try to convert to zen cart code, but system always display
Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/g-life.tw/httpdocs/includes/modules/shipping/tcat.php on line 82

the code is

$check_query = zen_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TCAT_STATUS'");

and i don't know how to do that can make it work

this module is very useful in Taiwan, because T-Cat express is the largest express delivery company in Taiwan, and i hope someone can help me to fix this.

finaly, if this module can work, i'll upload it for anyone need this shipping module, thanks.

<?php
/*
  $Id: tcat.php,v 1.1 2003/10/19 08:27:22 nickle Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

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

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

      $this->code = 'tcat';
      $this->title = MODULE_SHIPPING_TCAT_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_TCAT_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_TCAT_SORT_ORDER;
      $this->icon = DIR_WS_ICONS . 'tcat.gif';
      $this->tax_class = MODULE_SHIPPING_TCAT_TAX_CLASS;
      $this->enabled = ((MODULE_SHIPPING_TCAT_STATUS == 'True') ? true : false);
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TCAT_ZONE > 0) ) {

        $check_flag = false;
        $check_query = zen_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TCAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while ($check = zen_db_fetch_array($check_query)) {
          if ($check['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
        }

        if ($check_flag == false) {
          $this->enabled = false;
        }
      }

      $this->types = array('TIME0'=>'上午送達 08:00-12:00',
                           'TIME1'=>'下午送達 12:00-17:00',
						   'TIME2'=>'夜間送達 17:00-20:00'
						   );
 }
// class methods
    function quote($method = '') {
      global $_POST, $order, $total_count;
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_TCAT_TEXT_TITLE);
		$methods = array();
		if ($method) {
			$i = substr($method,strlen($method)-1) ;
				$methods[] = array('id' => 'TIME'.$i,
								 'title' => $this->types['TIME'.$i],
								 'cost' => MODULE_SHIPPING_TCAT_COST + MODULE_SHIPPING_TCAT_HANDLING);
		} else {
			$qsize = sizeof($this->types);
			for ($i=0; $i<$qsize; $i++) {
			  //list($type, $time) = each($this->types[$i]);
			  $methods[] = array('id' => 'TIME'.$i,
								 'title' => $this->types['TIME'.$i],
								 'cost' => MODULE_SHIPPING_TCAT_COST + MODULE_SHIPPING_TCAT_HANDLING);
			}
		}
        $this->quotes['methods'] = $methods;

      if ($this->tax_class > 0) {
        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }
      if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
	  return $this->quotes;
    }

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

    function install() {
      zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('啟動宅急便模組?', 'MODULE_SHIPPING_TCAT_STATUS', 'True', '確定要啟動宅急便模組?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('運費', 'MODULE_SHIPPING_TCAT_COST', '120', '宅急便不分縣市每件統一收費', '6', '0', now())");
      zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('處理費', 'MODULE_SHIPPING_TCAT_HANDLING', '40', '宅急便每件處理費用', '6', '0', now())");
      zen_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 ('稅別', 'MODULE_SHIPPING_TCAT_TAX_CLASS', '0', '使用下列稅別', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
      zen_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 ('運送地區', 'MODULE_SHIPPING_TCAT_ZONE', '0', '如果選擇地區,則只有該地區可以使用這個運送模組', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
      zen_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('顯示順序', 'MODULE_SHIPPING_TCAT_SORT_ORDER', '0', '顯示順序,數字越小順序在前', '6', '0', now())");
    }

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

    function keys() {
      return array('MODULE_SHIPPING_TCAT_STATUS', 'MODULE_SHIPPING_TCAT_COST', 'MODULE_SHIPPING_TCAT_HANDLING', 'MODULE_SHIPPING_TCAT_TAX_CLASS', 'MODULE_SHIPPING_TCAT_ZONE', 'MODULE_SHIPPING_TCAT_SORT_ORDER');
    }
  }
?>
16 Mar 2011, 7:21 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Need help, a shipping module form OSC

G-Life.tw:

Sorry to bother you, I found a shipping module (T-Cat express) from Taiwan's oscommerce, i try to convert to zen cart code, but system always display
Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/g-life.tw/httpdocs/includes/modules/shipping/tcat.php on line 82

Check the wiki:

http://www.zen-cart.com/wiki/index.php/Developers_-_Porting_modules_from_osC

Cheers
Rod

17 Mar 2011, 10:25 AM
#3
g_life_tw avatar

g_life_tw

New Zenner

Join Date:
Mar 2011
Posts:
2
Plugin Contributions:
0

Re: Need help, a shipping module form OSC

RodG:

Check the wiki:

http://www.zen-cart.com/wiki/index.php/Developers_-_Porting_modules_from_osC

Cheers
Rod
Is that your answer?
I can tell you that i've been compare those code, but it still cannot work, so i ask for help from this community.
but your answer seems that you think i didn't try even...................i'm so sad.

OK, I'm so stupid and no logic to do this, i give up.

17 Mar 2011, 10:28 AM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Need help, a shipping module form OSC

No one said you were stupid, but you're asking for someone to program a mod for you, and most of us don't have that skill.

17 Mar 2011, 1:40 PM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Need help, a shipping module form OSC

G-Life.tw:

Is that your answer?

Hmmm, well, yes... Someone has taken a lot of care in writing that wiki, I really don't think I could have given you a better response if I tried.

Well, I suppose I could download and debug your code for you and let you know what I find, and in all seriousness I might have considered doing so, but your response indicates that this would be a thankless task so I've now lost interest.

Bye
Rod