Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Ok, so I'm creating a new tax calculation (using an online service -- integration), and I'm having some troubles.

 

So I've based my module on the ot_tax module, built out the basics of the module, and it works fine in configuration, but the process() function is not being called when I think it should.. I have the sort order set for it in the admin panel, but for some reason it's still not working.. here's the code, any ideas why the constructor is being called, but not the process() function during the order total calculation?

 

Thanks in advance!

 

class ot_avatax
{
var $title, $output;

function ot_avatax()
{
	$this->code = 'ot_avatax';
	$this->title = MODULE_ORDER_TOTAL_AVATAX_TITLE;
	$this->description = MODULE_ORDER_TOTAL_AVATAX_DESCRIPTION;
	$this->enabled = ((MODULE_ORDER_TOTAL_AVATAX_STATUS == 'true') ? true : false);
	$this->sort_order = MODULE_ORDER_TOTAL_AVATAX_SORT_ORDER;

	$this->output = array();
}

function process()
{
	global $order, $currencies;
	echo 'test_process';
	{{{code removed for size}}}
}

function check()
{
	if (!isset($this->_check))
	{
		$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_AVATAX_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 AvaTax Module', 'MODULE_ORDER_TOTAL_AVATAX_STATUS', 'False', 'Do you want AvaTax to calculate tax rates for you? (disable normal Tax calulation if you enable this module', '6', '1', '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 ('Account ID', 'MODULE_ORDER_TOTAL_AVATAX_ACCOUNT_ID', '', 'Account ID (provided by <a href=\"http://www.avalara.com\" target=\"_avalara\">Avalara</a>)', '6', '2', now())");
 	tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Account Key', 'MODULE_ORDER_TOTAL_AVATAX_ACCOUNT_KEY', '', 'Account Key (provided by <a href=\"http://www.avalara.com\" target=\"_avalara\">Avalara</a>)', '6', '3', 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_ORDER_TOTAL_AVATAX_SORT_ORDER', '3', 'Sort order of display.', '6', '4', now())");
}

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

function keys()
{
	return array('MODULE_ORDER_TOTAL_AVATAX_STATUS', 'MODULE_ORDER_TOTAL_AVATAX_ACCOUNT_ID', 'MODULE_ORDER_TOTAL_AVATAX_ACCOUNT_KEY', 'MODULE_ORDER_TOTAL_AVATAX_SORT_ORDER');
}
}

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...