Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

making a contribution


kazoomaloo

Recommended Posts

ok here is what I have for code :

 

class shipping_total {

var $categories_id, $band0, $band1, $band2, $band3, $band4, $band5, $shippingTotal;

 

//class constructor

function ShipTotal() {

global $order;

 

$this->code = 'shipping total';

$this->title = MODULE_SHIPPING_TOTAL_TEXT_TITLE;

$this->description = MODULE_SHIPPING_TOTAL_TEXT_DESCRIPTION;

$this->sort_order = MODULE_SHIPPING_TOTSL_SORT_ORDER;

$this->icon = '';

$this->enabled = ((MODULE_SHIPPING_TOTSL_STATUS == 'True') ? true : false);

 

$this->shippingTotal = array();

 

if (tep_not_null($order_id)) {

$this->query($order_id);

} else {

$this->cart();

}

}

 

function tCosts($order_id) {

$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'id' => $orders_products['products_id'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

}

 

$shippingTotal_query = tep_db_query("select s.categories_id, band_0, band_1, band_2, band_3, band_4, band_5'

. ' from products_to_categories p, orders_products o, shipping_matrix s'

. ' where p.products_id = id'

. ' and s.categories_id = p.categories_id'");

$shippingTotal = tep_db_fetch_array($shippingTotal_query);

 

$this->shippingTotal = array('category' => $shippingTotal['category_id'],

'band0' => $shippingTotal['band_0'],

'band1' => $shippingTotal['band_1'],

'band2' => $shippingTotal['band_2'],

'band3' => $shippingTotal['band_3'],

'band4' => $shippingTotal['band_4'],

'band5' => $shippingTotal['band_5']);

if (qty = 1) {

if (band0 = 0) {

ts = 0;

}else{

ts = band0;

}

}else{

x = qty;

while(x < 6){

if (band(x) = 0) {

echo('please call for shipping');

}else{

ts = ts + band(x);

}

x = x + 1;

}

}

}

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_TABLE_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

 

 

function remove() {

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

}

 

function keys() {

return array('MODULE_SHIPPING_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');

}

}

 

?>

 

where should i go next, if i put it in the modules folder the shipping options disappear I know i don't have a completely working mod but if you guys could help I would appreciate it.

Link to comment
Share on other sites

Ok, here is the new version

 

class band {

var $code, $title, $description, $icon, $enabled;

 

// class constructor

function band() {

global $order;

 

$this->code = 'band';

$this->title = MODULE_SHIPPING_BAND_TEXT_TITLE;

$this->description = MODULE_SHIPPING_BAND_TEXT_DESCRIPTION;

$this->sort_order = MODULE_SHIPPING_BAND_SORT_ORDER;

$this->icon = '';

$this->enabled = ((MODULE_SHIPPING_BAND_STATUS == 'True') ? true : false);

 

 

}

 

// class methods

function quote($method = '') {

global $order;

 

 

$this->quotes = array('id' => $this->code,

'module' => MODULE_SHIPPING_BAND_TEXT_TITLE,

'methods' => array(array('id' => $this->code,

'title' => MODULE_SHIPPING_BAND_TEXT_WAY,

'cost' => MODULE_SHIPPING_BAND_COST)));

$shipping_total =

 

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_BAND_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 Band Shipping', 'MODULE_SHIPPING_BAND_STATUS', 'True', 'Do you want to offer band 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 ('Sort Order', 'MODULE_SHIPPING_BAND_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_BAND_STATUS', 'MODULE_SHIPPING_BAND_SORT_ORDER' );

}

}

?>

 

What I need to do is each item has a category, with each category is 5 bands with a shipping price behind it.

 

How can I access the database and table(shipping_matrix) and then compare the product_id, to find the category_id and then depending on the quantity go to a band and get the shipping price?

 

if someone could help i would appriecated greatly.

Link to comment
Share on other sites

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