Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Odd thing about this is that, in my editor anyway, line 128(which is the same line number my error check says it is) is:
$vendors_data_query = tep_db_query("select handling_charge,

 

When I check each of the braces, the class closes at line 161, which is not correct. You closed the function quotes at the wrong place, go to lines 124 and 125:

return $this->quotes;
}

and delete these two lines, and give it a try.

 

Craig :)

 

Thanks Craig :D

Link to comment
Share on other sites

Stephanie is going to see what she can do to get me going. I just really not that good creating or rewriting table shipping or anything.

 

OK this is as far as I got and I still get an error at line 143:

Fatal error: Call to undefined function: zones() in C:\xxx\xxx\xxx\catalog\admin\vendor_modules.php on line 143

 

I have spent all the time I have on this maybe someone else can fix the errors.

Here is the percent.php file:

 

<?php
/*
$Id: percent.php,v 2.2 2003/05/03 modifyed:WebyMaster-TWM dgw_ Exp $
 Modified for MVS 2005/03/13 sjs

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

Copyright (c) 2001,2002 osCommerce

Released under the GNU General Public License
*/
class percent {
var $code, $title, $description, $icon, $enabled;

// class constructor
function percent() {
global $order, $vendors_id;

//MVS
 //  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'percent';
  $this->title = MODULE_SHIPPING_PERCENT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_PERCENT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_PERCENT_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_PERCENT_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_PERCENT_STATUS == 'True') ? true : false);

//MVS start
function sort_order($vendors_id='1') {
  if (defined (@constant ('MODULE_SHIPPING_TABLE_PERCENT_ORDER_' . $vendors_id))) {
	$this->sort_order = @constant('MODULE_SHIPPING_PERCENT_SORT_ORDER_' . $vendors_id);
  } else {
	$this->sort_order = '0';
  }
  return $this->sort_order;
}

function tax_class($vendors_id='1') {
  $this->tax_class = constant('MODULE_SHIPPING_PERCENT_TAX_CLASS_' . $vendors_id);
  return $this->tax_class;
}

function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id);
		if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  return $this->enabled;
}

function zones($vendors_id='1') {
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id) > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	while ($check = tep_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
	}//while

	if ($check_flag == false) {
	  $this->enabled = false;
	}//if
  }//if
  return $this->enabled;
}//function
//MVS End

// class methods
function quote($method = '', $module = '', $vendors_id = '1') {
global $order, $cart;

//if ('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id) == 'True') {
// edited to work with gift vouchers and 0 weight products
//$order_total = $cart->show_total();
$order_total = $cart->show_total_virtual();
// edited to work with gift vouchers and 0 weight products
}
if ($order_total >= MODULE_SHIPPING_PERCENT_LESS_THEN) {
$shipping_percent = $order_total * MODULE_SHIPPING_PERCENT_RATE;
}
else {
$shipping_percent = MODULE_SHIPPING_PERCENT_FLAT_USE;
}

//MVS Start
  $vendors_data_query = tep_db_query("select handling_charge,
											 handling_per_box,
											 vendor_country,
											 vendors_zipcode
									  from " . TABLE_VENDORS . "
									  where vendors_id = '" . (int)$vendors_id . "'"
									);
$vendors_data = tep_db_fetch_array($vendors_data_query);
  $country_name = tep_get_countries($vendors_data['vendor_country'], true);

// begin mod for extra handling fee
$vendors_handling_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_INDVSHIP_HANDLING_" . $vendors_id . "'");
$vendors_handling_data = tep_db_fetch_array($vendors_handling_query);

$handling_charge = $vendors_data['handling_charge'] + $vendors_handling_data['configuration_value'];
// end mod for extra handling fee
  $handling_per_box = $vendors_data['handling_per_box'];
  if ($handling_charge > $handling_per_box*$shipping_num_boxes) {
	$handling = $handling_charge;
  } else {
	$handling = $handling_per_box*$shipping_num_boxes;
  }

//MVS End

$this->quotes = array('id' => $this->code,
					  'module' => MODULE_SHIPPING_PERCENT_TEXT_TITLE,
					  'methods' => array(array('id' => $this->code,
					  'title' => MODULE_SHIPPING_PERCENT_TEXT_WAY,
					  'cost' => $shipping_percent + $handling)));

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($vendors_id='1') {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_PERCENT_STATUS_" . $vendors_id . "'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}

function install($vendors_id='1') {
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id)  values ('Enable Percent Shipping', 'MODULE_SHIPPING_PERCENT_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer percent rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Percentage Rate', 'MODULE_SHIPPING_PERCENT_RATE_" . $vendors_id . "', '.18', 'The Percentage Rate all .01 to .99 for all orders using this shipping method.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('A Flat Rate for orders under', 'MODULE_SHIPPING_PERCENT_LESS_THEN_" . $vendors_id . "', '34.75', 'A Flat Rate for all orders that are under the amount shown.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('A Flat Rate of', 'MODULE_SHIPPING_PERCENT_FLAT_USE_" . $vendors_id . "', '6.50', 'A Flat Rate used for all orders.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id)  values ('Tax Class', 'MODULE_SHIPPING_PERCENT_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id)  values ('Shipping Zone', 'MODULE_SHIPPING_PERCENT_ZONE_" . $vendors_id . "', '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(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_PERCENT_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '0', now(), '" . $vendors_id . "')");
}

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

function keys($vendors_id) {
return array('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_RATE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_LESS_THEN_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_FLAT_USE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_SORT_ORDER_' . $vendors_id);
}
}
?>

 

Sorry mtechama, I didn't get it finished :(

Maybe you can fiddle with it a little :P I just don't have more time right now. >_<

Link to comment
Share on other sites

OK this is as far as I got and I still get an error at line 143:

Fatal error: Call to undefined function: zones() in C:\xxx\xxx\xxx\catalog\admin\vendor_modules.php on line 143

 

I have spent all the time I have on this maybe someone else can fix the errors.

Here is the percent.php file:

 

<?php
/*
$Id: percent.php,v 2.2 2003/05/03 modifyed:WebyMaster-TWM dgw_ Exp $
 Modified for MVS 2005/03/13 sjs

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

Copyright (c) 2001,2002 osCommerce

Released under the GNU General Public License
*/
class percent {
var $code, $title, $description, $icon, $enabled;

// class constructor
function percent() {
global $order, $vendors_id;

//MVS
 //  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'percent';
  $this->title = MODULE_SHIPPING_PERCENT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_PERCENT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_PERCENT_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_PERCENT_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_PERCENT_STATUS == 'True') ? true : false);

//MVS start
function sort_order($vendors_id='1') {
  if (defined (@constant ('MODULE_SHIPPING_TABLE_PERCENT_ORDER_' . $vendors_id))) {
	$this->sort_order = @constant('MODULE_SHIPPING_PERCENT_SORT_ORDER_' . $vendors_id);
  } else {
	$this->sort_order = '0';
  }
  return $this->sort_order;
}

function tax_class($vendors_id='1') {
  $this->tax_class = constant('MODULE_SHIPPING_PERCENT_TAX_CLASS_' . $vendors_id);
  return $this->tax_class;
}

function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id);
		if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  return $this->enabled;
}

function zones($vendors_id='1') {
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id) > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	while ($check = tep_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
	}//while

	if ($check_flag == false) {
	  $this->enabled = false;
	}//if
  }//if
  return $this->enabled;
}//function
//MVS End

// class methods
function quote($method = '', $module = '', $vendors_id = '1') {
global $order, $cart;

//if ('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id) == 'True') {
// edited to work with gift vouchers and 0 weight products
//$order_total = $cart->show_total();
$order_total = $cart->show_total_virtual();
// edited to work with gift vouchers and 0 weight products
}
if ($order_total >= MODULE_SHIPPING_PERCENT_LESS_THEN) {
$shipping_percent = $order_total * MODULE_SHIPPING_PERCENT_RATE;
}
else {
$shipping_percent = MODULE_SHIPPING_PERCENT_FLAT_USE;
}

//MVS Start
  $vendors_data_query = tep_db_query("select handling_charge,
											 handling_per_box,
											 vendor_country,
											 vendors_zipcode
									  from " . TABLE_VENDORS . "
									  where vendors_id = '" . (int)$vendors_id . "'"
									);
$vendors_data = tep_db_fetch_array($vendors_data_query);
  $country_name = tep_get_countries($vendors_data['vendor_country'], true);

// begin mod for extra handling fee
$vendors_handling_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_INDVSHIP_HANDLING_" . $vendors_id . "'");
$vendors_handling_data = tep_db_fetch_array($vendors_handling_query);

$handling_charge = $vendors_data['handling_charge'] + $vendors_handling_data['configuration_value'];
// end mod for extra handling fee
  $handling_per_box = $vendors_data['handling_per_box'];
  if ($handling_charge > $handling_per_box*$shipping_num_boxes) {
	$handling = $handling_charge;
  } else {
	$handling = $handling_per_box*$shipping_num_boxes;
  }

//MVS End

$this->quotes = array('id' => $this->code,
					  'module' => MODULE_SHIPPING_PERCENT_TEXT_TITLE,
					  'methods' => array(array('id' => $this->code,
					  'title' => MODULE_SHIPPING_PERCENT_TEXT_WAY,
					  'cost' => $shipping_percent + $handling)));

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($vendors_id='1') {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_PERCENT_STATUS_" . $vendors_id . "'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}

function install($vendors_id='1') {
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id)  values ('Enable Percent Shipping', 'MODULE_SHIPPING_PERCENT_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer percent rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Percentage Rate', 'MODULE_SHIPPING_PERCENT_RATE_" . $vendors_id . "', '.18', 'The Percentage Rate all .01 to .99 for all orders using this shipping method.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('A Flat Rate for orders under', 'MODULE_SHIPPING_PERCENT_LESS_THEN_" . $vendors_id . "', '34.75', 'A Flat Rate for all orders that are under the amount shown.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('A Flat Rate of', 'MODULE_SHIPPING_PERCENT_FLAT_USE_" . $vendors_id . "', '6.50', 'A Flat Rate used for all orders.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id)  values ('Tax Class', 'MODULE_SHIPPING_PERCENT_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id)  values ('Shipping Zone', 'MODULE_SHIPPING_PERCENT_ZONE_" . $vendors_id . "', '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(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_PERCENT_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '0', now(), '" . $vendors_id . "')");
}

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

function keys($vendors_id) {
return array('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_RATE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_LESS_THEN_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_FLAT_USE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_SORT_ORDER_' . $vendors_id);
}
}
?>

 

Sorry mtechama, I didn't get it finished :(

Maybe you can fiddle with it a little :P I just don't have more time right now. >_<

 

That error on line 143 is:

$module->zones($vendors_id);

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

Hi Craig,

 

It's a very minor point, and may well just be my setup - I more or less automatically blame everything on globals!

 

I just did a test order and ordered two items from the same vendor. I wanted check that the e-mail to the vendor contained all the details (Qty, Product name, Item Code/Number, Product Model, Per Unit Price, Item Comments) as I had added some item comments.

 

The e-mail to the vendor contained all the details, but the second item was outside the table.

The table listing the items in the email to the vendor seemed to be missing the row for the second item.

 

	$email = $email .  '<table width="75%" border=1 cellspacing="0" cellpadding="3">
<tr><td>Qty:</td><td>Product Name:</td><td>Item Code/Number:</td><td>Product Model:</td><td>Per Unit Price:</td><td>Item Comments: </td></tr>';
	   for ($i=0, $n=sizeof($vendor_products[$l]['vendor_orders_products']); $i<$n; $i++) {
  $product_attribs ='';
  if (isset($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) && (sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) > 0)) {

	for ($j = 0, $k = sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']); $j < $k; $j++) {
	 $product_attribs .= '  ' . $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['option'] . ': ' .  $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['value'] . '<br>';
	}
	}
	$email = $email . '<tr><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pqty'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pname'] . '<br>  <i>Option<br> ' . $product_attribs .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_id'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pmodel'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_price'] . '</td><td>' .
 $vendor_products[$l]['vendor_orders_products'][$i]['Pcomments'] . '</b></td></tr>';

  }
}
$email = $email . '</table><br><HR><br>';

 

What do you think?

 

- Paul -

Link to comment
Share on other sites

Craig and/or Jim

 

here is the code for that file:

catalog\admin\vendor_modules.php on line 143

 

<?php
/*
 $Id: vendor_modules.php,v 1.1 2005/03/14 jck Exp $
 $Modified_from: modules.php,v 1.47 2003/06/29 22:50:52 hpdl Exp $

 Modified for MVS V1.0 2006/03/25 JCK/CWG
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
 $vendors_id = (isset($_GET['vendors_id']) ? $_GET['vendors_id'] : 'a');

 if (tep_not_null($action)) {
switch ($action) {
  case 'save':
	while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

	if( is_array( $value ) ) $value = implode( ", ", $value);
	  tep_db_query("update " . TABLE_VENDOR_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key .  "' and vendors_id = '" . $vendors_id . "'");
	}

	tep_redirect(tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $HTTP_GET_VARS['module'] . '&vendors_id=' . $vendors_id));
	break;
  case 'install':
  case 'remove':
	$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
	$class = basename($HTTP_GET_VARS['module']);

	if (file_exists(DIR_FS_CATALOG_MODULES . 'vendors_shipping/' . $class . $file_extension)) {
	  include(DIR_FS_CATALOG_MODULES . 'vendors_shipping/' . $class . $file_extension);
	  $module = new $class;
	  if ($action == 'install') {
		$module->install($vendors_id);  //MVS
	  } elseif ($action == 'remove') {
		$module->remove($vendors_id);  //MVS
	  }
	}

	tep_redirect(tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $class . '&vendors_id=' . $vendors_id));
	break;
}
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE_MODULES_SHIPPING; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
<!-- //MVS  -->
					<tr>
					  <td class="main">
<?php

 $vendors_query = tep_db_query("select * from " . TABLE_VENDORS . " where vendors_id = '" . $vendors_id . "' order by vendors_name");
 $vendor_info = tep_db_fetch_array($vendors_query);
 $vendors_name = $vendor_info['vendors_name'];

 if ($vendors_id == 'a') {
echo "<div align=\"center\">" . TEXT_NO_VENDOR_SELECTED . ' <a href="' . tep_href_link(FILENAME_VENDORS) . '">' . tep_image_submit('button_back.gif'). '</a><br><br></div>';
 } else {
echo CURRENTLY_MANAGING . $vendors_name . CURRENTLY_MANAGING_2 . "<a href='" . tep_href_link(FILENAME_VENDORS) . "'>" . CURRENTLY_MANAGING_3 . "</a>";
 }

?>
	</td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODULES; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
<?php
 $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
 $directory_array = array();

 if ($dir = @dir(DIR_FS_CATALOG_MODULES . 'vendors_shipping/')) {
while ($file = $dir->read()) {
  if (!is_dir(DIR_FS_CATALOG_MODULES . 'vendors_shipping/' . $file)) {
	if (substr($file, strrpos($file, '.')) == $file_extension) {
	  $directory_array[] = $file;
	}
  }
}
sort($directory_array);
$dir->close();
 }

 $installed_modules = array();
 for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {
$file = $directory_array[$i];

include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/vendors_shipping/' . $file);
include(DIR_FS_CATALOG_MODULES . 'vendors_shipping/' . $file);

$class = substr($file, 0, strrpos($file, '.'));
if (tep_class_exists($class)) {
  $module = new $class;
  if ($module->check($vendors_id) > 0) {
	if ($module->sort_order($vendors_id) > 0) {
	  $installed_modules[$module->sort_order($vendors_id)] = $file;
	} else {
	  $installed_modules[] = $file;
	}
  }

  $module->zones($vendors_id);

  if ((!isset($HTTP_GET_VARS['module']) || (isset($HTTP_GET_VARS['module']) && ($HTTP_GET_VARS['module'] == $class))) && !isset($mInfo)) {
	$module_info = array('code' => $module->code,
						 'title' => $module->title,
						 'description' => $module->description,
						 'status' => $module->check($vendors_id));

	$module_keys = $module->keys($vendors_id);

	$keys_extra = array();
	for ($j=0, $k=sizeof($module_keys); $j<$k; $j++) {
	  $key_value_query_string = "select configuration_title, configuration_value, configuration_description, use_function, set_function from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = '" . $module_keys[$j] . "'";
	  $key_value_query = tep_db_query("select configuration_title, configuration_value, configuration_description, use_function, set_function from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = '" . $module_keys[$j] . "'");
	  $key_value = tep_db_fetch_array($key_value_query);

	  $keys_extra[$module_keys[$j]]['title'] = $key_value['configuration_title'];
	  $keys_extra[$module_keys[$j]]['value'] = $key_value['configuration_value'];
	  $keys_extra[$module_keys[$j]]['description'] = $key_value['configuration_description'];
	  $keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];
	  $keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];
	}

	$module_info['keys'] = $keys_extra;

	$mInfo = new objectInfo($module_info);
  }

  if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {
	if ($module->check($vendors_id) > 0) {
	  echo '			  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $class . '&action=edit&vendors_id=' . $vendors_id) . '\'">' . "\n";
	} else {
	  echo '			  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";
	}
  } else {
	 echo '			  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $class . '&vendors_id=' . $vendors_id) . '\'">' . "\n";
  }
?>
			<td class="dataTableContent"><?php echo $module->title; ?></td>
			<td class="dataTableContent" align="right"><?php if (is_numeric($module->sort_order($vendors_id))) echo $module->sort_order($vendors_id); ?></td>
			<td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $class . '&vendors_id=' . $vendors_id) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
		  </tr>
<?php
}
 }

 ksort($installed_modules);

 $check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = 'MODULE_VENDOR_SHIPPING_INSTALLED_" . $vendors_id . "' and vendors_id = '" . $vendors_id . "'");
 if (tep_db_num_rows($check_query)) {
$check = tep_db_fetch_array($check_query);

if ($check['configuration_value'] != implode(';', $installed_modules)) {
  tep_db_query("update " . TABLE_VENDOR_CONFIGURATION . " set configuration_value = '" . implode(';', $installed_modules) . "', last_modified = now() where configuration_key = 'MODULE_VENDOR_SHIPPING_INSTALLED_" . $vendors_id . "' and vendors_id = '" . $vendors_id . "'");
}
 } else {
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (vendors_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('" . $vendors_id . "', 'Installed Modules', 'MODULE_VENDOR_SHIPPING_INSTALLED_" . $vendors_id . "', '" . implode(';', $installed_modules) . "', 'This is automatically updated. No need to edit.', '6', '0', now())");
 }
?>
		  <tr>
			<td colspan="3" class="smallText"><?php echo TEXT_MODULE_DIRECTORY . ' ' . DIR_FS_CATALOG_MODULES . 'vendors_shipping/'; ?></td>
		  </tr>
		</table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
case 'edit':
  $keys = '';
  reset($mInfo->keys);
  while (list($key, $value) = each($mInfo->keys)) {
	$keys .= '<b>' . $value['title'] . '</b><br>' . $value['description'] . '<br>';

	if ($value['set_function']) {
	  eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");
	} else {
	  $keys .= tep_draw_input_field('configuration[' . $key . ']', $value['value']);
	}
	$keys .= '<br><br>';
  }
  $keys = substr($keys, 0, strrpos($keys, '<br><br>'));

  $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');

  $contents = array('form' => tep_draw_form('modules', FILENAME_VENDOR_MODULES, 'module=' . $HTTP_GET_VARS['module'] . '&action=save&vendors_id=' . $vendors_id));
  $contents[] = array('text' => $keys);
  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $HTTP_GET_VARS['module'] . '&vendors_id=' . $vendors_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
default:
  $heading[] = array('text' => '<b>' . $mInfo->title . '</b>');

  if ($mInfo->status == '1') {
	$keys = '';
	reset($mInfo->keys);
	while (list(, $value) = each($mInfo->keys)) {
	  $keys .= '<b>' . $value['title'] . '</b><br>';
	  if ($value['use_function']) {
		$use_function = $value['use_function'];
		if (ereg('->', $use_function)) {
		  $class_method = explode('->', $use_function);
		  if (!is_object(${$class_method[0]})) {
			include(DIR_WS_CLASSES . $class_method[0] . '.php');
			${$class_method[0]} = new $class_method[0]();
		  }
		  $keys .= tep_call_function($class_method[1], $value['value'], ${$class_method[0]});
		} else {
		  $keys .= tep_call_function($use_function, $value['value']);
		}
	  } else {
		$keys .= $value['value'];
	  }
	  $keys .= '<br><br>';
	}
	$keys = substr($keys, 0, strrpos($keys, '<br><br>'));
	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $mInfo->code . '&action=remove&vendors_id=' . $vendors_id) . '">' . tep_image_button('button_module_remove.gif', IMAGE_MODULE_REMOVE) . '</a> <a href="' . tep_href_link(FILENAME_VENDOR_MODULES, (isset($HTTP_GET_VARS['module']) ? '&module=' . $HTTP_GET_VARS['module'] : '') . '&action=edit&vendors_id=' . $vendors_id) . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
	$contents[] = array('text' => '<br>' . $mInfo->description);
	$contents[] = array('text' => '<br>' . $keys);
  } else {
	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_VENDOR_MODULES, 'module=' . $mInfo->code . '&action=install&vendors_id=' . $vendors_id) . '">' . tep_image_button('button_module_install.gif', IMAGE_MODULE_INSTALL) . '</a>');
	$contents[] = array('text' => '<br>' . $mInfo->description);
  }
  break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo '			<td width="25%" valign="top">' . "\n";

$box = new box;
echo $box->infoBox($heading, $contents);

echo '			</td>' . "\n";
 }
?>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

When I log in under my test account to try and ship something the page is screwed up really bad.

 

The Checkout_Shipping page says

 

"TABLE_HEADING_COMMENTS

TITLE_CONTINUE_CHECKOUT_PROCEDURE

TEXT_CONTINUE_CHECKOUT_PROCEDURE" and everything is plain

 

http://addictiveracing.com/catalog/checkout_shipping.php

 

then when i try to log in to my admin section it says

 

"1146 - Table 'addictiv_p_os1.TABLE_VENDOR_CONFIGURATION' doesn't exist

 

select configuration_key as cfgKey, configuration_value as cfgValue from TABLE_VENDOR_CONFIGURATION

 

[TEP STOP]

"

Link to comment
Share on other sites

When I log in under my test account to try and ship something the page is screwed up really bad.

 

The Checkout_Shipping page says

 

"TABLE_HEADING_COMMENTS

TITLE_CONTINUE_CHECKOUT_PROCEDURE

TEXT_CONTINUE_CHECKOUT_PROCEDURE" and everything is plain

 

http://addictiveracing.com/catalog/checkout_shipping.php

 

then when i try to log in to my admin section it says

 

"1146 - Table 'addictiv_p_os1.TABLE_VENDOR_CONFIGURATION' doesn't exist

 

select configuration_key as cfgKey, configuration_value as cfgValue from TABLE_VENDOR_CONFIGURATION

 

[TEP STOP]

"

 

I fixed the Admin problem but not the checkout_shipping problem

 

<?php
/*
 $Id: checkout_shipping.php,v 1.3 2003/02/06 17:38:16 thomasamoulton Exp $

 Modified for MVS V1.0 2006/03/25 JCK/CWG
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
*/

define('NAVBAR_TITLE_1', 'Checkout');
define('NAVBAR_TITLE_2', 'Shipping Method');

define('HEADING_TITLE', 'Delivery Information');

define('TABLE_HEADING_SHIPPING_ADDRESS', 'Shipping Address');
define('TEXT_CHOOSE_SHIPPING_DESTINATION', 'Please choose from your address book where you would like the items to be delivered to.');
define('TITLE_SHIPPING_ADDRESS', 'Shipping Address:');

define('TABLE_HEADING_SHIPPING_METHOD', 'Shipping Method');
define('TEXT_CHOOSE_SHIPPING_METHOD', 'Please select the preferred shipping method to use on this order.');
define('TITLE_PLEASE_SELECT', 'Please Select');
define('TEXT_ENTER_SHIPPING_INFORMATION', 'This is currently the only shipping method available to use on this order.');

define('TABLE_HEADING_COMMENTS', 'Add Comments About Your Order');

define('TITLE_CONTINUE_CHECKOUT_PROCEDURE', 'Continue Checkout Procedure');
define('TEXT_CONTINUE_CHECKOUT_PROCEDURE', 'to select the preferred payment method.');
//MVS Start
define('TEXT_MULTIPLE_SHIPPING_METHODS', 'Some products will be shipped from different locations. Please choose a shipping method for each group of products below.');
define('TEXT_PRODUCTS', 'Products');
//MVS End
?>

Edited by thessrtech
Link to comment
Share on other sites

OK this is as far as I got and I still get an error at line 143:

Fatal error: Call to undefined function: zones() in C:\xxx\xxx\xxx\catalog\admin\vendor_modules.php on line 143

 

I have spent all the time I have on this maybe someone else can fix the errors.

Here is the percent.php file:

 

<?php
/*
$Id: percent.php,v 2.2 2003/05/03 modifyed:WebyMaster-TWM dgw_ Exp $
 Modified for MVS 2005/03/13 sjs

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

Copyright (c) 2001,2002 osCommerce

Released under the GNU General Public License
*/
class percent {
var $code, $title, $description, $icon, $enabled;

// class constructor
function percent() {
global $order, $vendors_id;

//MVS
 //  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'percent';
  $this->title = MODULE_SHIPPING_PERCENT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_PERCENT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_PERCENT_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_PERCENT_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_PERCENT_STATUS == 'True') ? true : false);

//MVS start
function sort_order($vendors_id='1') {
  if (defined (@constant ('MODULE_SHIPPING_TABLE_PERCENT_ORDER_' . $vendors_id))) {
	$this->sort_order = @constant('MODULE_SHIPPING_PERCENT_SORT_ORDER_' . $vendors_id);
  } else {
	$this->sort_order = '0';
  }
  return $this->sort_order;
}

function tax_class($vendors_id='1') {
  $this->tax_class = constant('MODULE_SHIPPING_PERCENT_TAX_CLASS_' . $vendors_id);
  return $this->tax_class;
}

function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id);
		if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  return $this->enabled;
}

function zones($vendors_id='1') {
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id) > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	while ($check = tep_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
	}//while

	if ($check_flag == false) {
	  $this->enabled = false;
	}//if
  }//if
  return $this->enabled;
}//function
//MVS End

// class methods
function quote($method = '', $module = '', $vendors_id = '1') {
global $order, $cart;

//if ('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id) == 'True') {
// edited to work with gift vouchers and 0 weight products
//$order_total = $cart->show_total();
$order_total = $cart->show_total_virtual();
// edited to work with gift vouchers and 0 weight products
}
if ($order_total >= MODULE_SHIPPING_PERCENT_LESS_THEN) {
$shipping_percent = $order_total * MODULE_SHIPPING_PERCENT_RATE;
}
else {
$shipping_percent = MODULE_SHIPPING_PERCENT_FLAT_USE;
}

//MVS Start
  $vendors_data_query = tep_db_query("select handling_charge,
											 handling_per_box,
											 vendor_country,
											 vendors_zipcode
									  from " . TABLE_VENDORS . "
									  where vendors_id = '" . (int)$vendors_id . "'"
									);
$vendors_data = tep_db_fetch_array($vendors_data_query);
  $country_name = tep_get_countries($vendors_data['vendor_country'], true);

// begin mod for extra handling fee
$vendors_handling_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_INDVSHIP_HANDLING_" . $vendors_id . "'");
$vendors_handling_data = tep_db_fetch_array($vendors_handling_query);

$handling_charge = $vendors_data['handling_charge'] + $vendors_handling_data['configuration_value'];
// end mod for extra handling fee
  $handling_per_box = $vendors_data['handling_per_box'];
  if ($handling_charge > $handling_per_box*$shipping_num_boxes) {
	$handling = $handling_charge;
  } else {
	$handling = $handling_per_box*$shipping_num_boxes;
  }

//MVS End

$this->quotes = array('id' => $this->code,
					  'module' => MODULE_SHIPPING_PERCENT_TEXT_TITLE,
					  'methods' => array(array('id' => $this->code,
					  'title' => MODULE_SHIPPING_PERCENT_TEXT_WAY,
					  'cost' => $shipping_percent + $handling)));

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($vendors_id='1') {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_PERCENT_STATUS_" . $vendors_id . "'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}

function install($vendors_id='1') {
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added, vendors_id)  values ('Enable Percent Shipping', 'MODULE_SHIPPING_PERCENT_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer percent rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Percentage Rate', 'MODULE_SHIPPING_PERCENT_RATE_" . $vendors_id . "', '.18', 'The Percentage Rate all .01 to .99 for all orders using this shipping method.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('A Flat Rate for orders under', 'MODULE_SHIPPING_PERCENT_LESS_THEN_" . $vendors_id . "', '34.75', 'A Flat Rate for all orders that are under the amount shown.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('A Flat Rate of', 'MODULE_SHIPPING_PERCENT_FLAT_USE_" . $vendors_id . "', '6.50', 'A Flat Rate used for all orders.', '6', '0', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id)  values ('Tax Class', 'MODULE_SHIPPING_PERCENT_TAX_CLASS_" . $vendors_id . "', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added, vendors_id)  values ('Shipping Zone', 'MODULE_SHIPPING_PERCENT_ZONE_" . $vendors_id . "', '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(), '" . $vendors_id . "')");
tep_db_query("insert into " . TABLE_VENDOR_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, vendors_id) values ('Sort Order', 'MODULE_SHIPPING_PERCENT_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '6', '0', now(), '" . $vendors_id . "')");
}

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

function keys($vendors_id) {
return array('MODULE_SHIPPING_PERCENT_STATUS_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_RATE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_LESS_THEN_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_FLAT_USE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_ZONE_' . $vendors_id, 'MODULE_SHIPPING_PERCENT_SORT_ORDER_' . $vendors_id);
}
}
?>

 

Sorry mtechama, I didn't get it finished :(

Maybe you can fiddle with it a little :P I just don't have more time right now. >_<

 

 

 

Jim I need this solved A.S.A.P.

Thanks, Wade

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

Parse error: parse error, unexpected '<' in /home/addictiv/public_html/catalog/checkout_shipping.php on line 60

 

 

<?php
/*
 $Id: checkout_shipping.php,v 1.16 2003/06/09 23:03:53 hpdl Exp $

 Modified for MVS V1.0 2006/03/25 JCK/CWG
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2006 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
 require('includes/classes/http_client.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

// if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('sendto')) {
tep_session_register('sendto');
$sendto = $customer_default_address_id;
 } else {
// verify the selected shipping address
$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
$check_address = tep_db_fetch_array($check_address_query);

if ($check_address['total'] != '1') {
  $sendto = $customer_default_address_id;
  if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
}
 }

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// register a random ID in the session to check throughout the checkout procedure
// against alterations in the shopping cart contents
 if (!tep_session_is_registered('cartID')) tep_session_register('cartID');
 $cartID = $cart->cartID;

// if the order contains only virtual products, forward the customer to the billing page as
// a shipping address is not needed
 if ($order->content_type == 'virtual') {
if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
$shipping = false;
$sendto = false;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 <?php	[color=#FF0000][b][size=3]<--Line 60[/size][/b][/color]
//MVS start
 if (tep_count_shipping_modules() > 0 || SELECT_VENDOR_SHIPPING == 'true') {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		 <td class="main"><b><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></b></td>
	  </tr>
	</table></td>
  </tr>
<?php
 if (SELECT_VENDOR_SHIPPING == 'true') {
include(DIR_WS_CLASSES . 'vendor_shipping.php');
$shipping_modules = new shipping;
 } else {
include(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping;
$total_weight = $cart->show_weight();
$cost = $cart->show_total();
$total_count = $cart->count_contents();
 }

 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
if (!tep_session_is_registered('comments')) tep_session_register('comments');
if (tep_not_null($HTTP_POST_VARS['comments'])) {
  $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
}

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

  if (SELECT_VENDOR_SHIPPING == 'true') {

  $total_shipping_cost = 0;
  $shipping_title = MULTIPLE_SHIP_METHODS_TITLE;
  $vendor_shipping = $cart->vendor_shipping;
  $shipping = array();
  foreach ($vendor_shipping as $vendor_id => $vendor_data) {
	$products_shipped = $_POST['products_' . $vendor_id];
	$products_array = explode ("_", $products_shipped);

	$shipping_data = $_POST['shipping_' . $vendor_id];
	$shipping_array = explode ("_", $shipping_data);
	$module = $shipping_array[0];
	$method = $shipping_array[1];
	$ship_tax = $shipping_array[2];

	if ( is_object($$module) || ($module == 'free') ) {
	  if ($module == 'free') {
		$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
		$quote[0]['methods'][0]['cost'] = '0';
	  } else {
		$total_weight = $vendor_shipping[$vendor_id]['weight'];
		$shipping_weight = $total_weight;
		$cost = $vendor_shipping[$vendor_id]['cost'];
		$total_count = $vendor_shipping[$vendor_id]['qty'];
		$quote = $shipping_modules->quote($method, $module, $vendor_id);

	  }
	  if (isset($quote['error'])) {
		tep_session_unregister('shipping');
	  } else {
		if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
		  $output[$vendor_id] = array('id' => $module . '_' . $method,
									  'title' => $quote[0]['methods'][0]['title'],
									  'ship_tax' => $ship_tax,
									  'products' => $products_array,
									  'cost' => $quote[0]['methods'][0]['cost']
									 );
		  $total_ship_tax += $ship_tax;
		  $total_shipping_cost += $quote[0]['methods'][0]['cost'];
		}//if isset
	  }//if isset
	}//if is_object
  }//foreach
  if ($free_shipping == true) {
	$shipping_title = $quote[0]['module'];
  } elseif (count($output) <2) {
	$shipping_title = $quote[0]['methods'][0]['title'];
	}
  $shipping = array('id' => $shipping,
					'title' => $shipping_title,
					'cost' => $total_shipping_cost,
					'shipping_tax_total' => $total_ship_tax,
					'vendor' => $output
				   );

} else {
  if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {
	$shipping = $HTTP_POST_VARS['shipping'];

	list($module, $method) = explode('_', $shipping);
	if ( is_object($$module) || ($shipping == 'free_free') ) {
	  if ($shipping == 'free_free') {
		$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
		$quote[0]['methods'][0]['cost'] = '0';
	  } else {
		$quote = $shipping_modules->quote($method, $module);
	  }
	}
	if (isset($quote['error'])) {
	  tep_session_unregister('shipping');
	} else {
	  if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
		$shipping = array('id' => $shipping,
						  'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
						  'cost' => $quote[0]['methods'][0]['cost']);

		tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
	  }
	}
  } else {
	tep_session_unregister('shipping');
  }
}
tep_redirect(tep_href_link('checkout_payment.php', '', 'SSL'));
exit;
 }  //MVS END

// get all available shipping quotes
 $quotes = $shipping_modules->quote();

// if no shipping method has been selected, automatically select the cheapest method.
// if the modules status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
 if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
var selected;

function selectRowEffect(object, buttonSelect) {
 if (!selected) {
if (document.getElementById) {
  selected = document.getElementById('defaultSelected');
} else {
  selected = document.all['defaultSelected'];
}
 }

 if (selected) selected.className = 'moduleRow';
 object.className = 'moduleRowSelected';
 selected = object;

// one button is not an array
 if (document.checkout_address.shipping[0]) {
document.checkout_address.shipping[buttonSelect].checked=true;
 } else {
document.checkout_address.shipping.checked=true;
 }
}

function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
			<td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td>
			<td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="main" align="center" valign="top"><?php echo '<b>' . TITLE_SHIPPING_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
				<td class="main" valign="top"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br>'); ?></td>
				<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> 
			  </tr>
			</table></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
//MVS
 if (SELECT_VENDOR_SHIPPING == 'true') {
require(DIR_WS_MODULES . 'vendor_shipping.php');
 } else {
$quotes = $shipping_modules->quote();

 if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) {
$pass = false;

switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
  case 'national':
	if ($order->delivery['country_id'] == STORE_COUNTRY) {
	  $pass = true;
	}
	break;
  case 'international':
	if ($order->delivery['country_id'] != STORE_COUNTRY) {
	  $pass = true;
	}
	break;
  case 'both':
	$pass = true;
	break;
}

$free_shipping = false;
if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
  $free_shipping = true;

  include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
}
 } else {
$free_shipping = false;
 }

// if no shipping method has been selected, automatically select the cheapest method.
// if the modules status was changed when none were available, to save on implementing
// a javascript force-selection method, also automatically select the cheapest shipping
// method if more than one module is now enabled
if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();
//MVS End
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td>
			<td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
} elseif ($free_shipping == false) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
}

if ($free_shipping == true) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td colspan="2" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><b><?php echo FREE_SHIPPING_TITLE; ?></b> <?php echo $quotes[$i]['icon']; ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" width="100%"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			</table></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
} else {
  $radio_buttons = 0;
  for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><b><?php echo $quotes[$i]['module']; ?></b> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
	if (isset($quotes[$i]['error'])) {
?>
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
	} else {
	  for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
		$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);

		if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
		  echo '				  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
		} else {
		  echo '				  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
		}
?>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
<?php
		if ( ($n > 1) || ($n2 > 1) ) {
?>
				<td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td>
				<td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td>
<?php
		} else {
?>
				<td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>
<?php
		}
?>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
		$radio_buttons++;
	  }
	}
?>
			</table></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
  }
}
?>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}
 } //MVS end
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo '<b>' . TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>
			<td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="50%" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
			<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		  </tr>
		</table></td>
		<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
		<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
		  <tr>
			<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
			<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	  <tr>
		<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
		<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
		<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
		<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
	  </tr>
	</table></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by thessrtech
Link to comment
Share on other sites

Albert: Delete line 60 from that file; it should not be there at all. Check the rest of your modifications carefully, since you apparently have other errors in your code as well. Something is preventing the language file defines from working. Probably another typo in this file.

 

Wade: I plan on looking at that when I have time. Right now I don't have the time; I'm behind on work for my real job. If you can't wait for one of us to fix it, I suggest that you pay somebody to do it for you.

 

Everybody: Please don't post entire files unless somebody is asking you to. A few lines before and after the error is sufficient for us to get the idea in most cases. We particularly don't need to see files that are unmodified from stock MVS or osCommerce core code. It's getting hard to read this thread, and you'll scare off the newbies. >_<

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Albert: Delete line 60 from that file; it should not be there at all. Check the rest of your modifications carefully, since you apparently have other errors in your code as well. Something is preventing the language file defines from working. Probably another typo in this file.

 

Wade: I plan on looking at that when I have time. Right now I don't have the time; I'm behind on work for my real job. If you can't wait for one of us to fix it, I suggest that you pay somebody to do it for you.

 

Everybody: Please don't post entire files unless somebody is asking you to. A few lines before and after the error is sufficient for us to get the idea in most cases. We particularly don't need to see files that are unmodified from stock MVS or osCommerce core code. It's getting hard to read this thread, and you'll scare off the newbies. >_<

 

Regards

Jim

 

Thank you jim,

whenever you got it fixed just let me know right now I got paypal disable til this is solved.

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

Albert: Delete line 60 from that file; it should not be there at all. Check the rest of your modifications carefully, since you apparently have other errors in your code as well. Something is preventing the language file defines from working. Probably another typo in this file.

 

Wade: I plan on looking at that when I have time. Right now I don't have the time; I'm behind on work for my real job. If you can't wait for one of us to fix it, I suggest that you pay somebody to do it for you.

 

Everybody: Please don't post entire files unless somebody is asking you to. A few lines before and after the error is sufficient for us to get the idea in most cases. We particularly don't need to see files that are unmodified from stock MVS or osCommerce core code. It's getting hard to read this thread, and you'll scare off the newbies. >_<

 

Regards

Jim

 

Ok when I deleted the modified checkout_shipping.php file and uploaded the standard one it works fine. So does that mean it's just this one file or could it be multiple?

Link to comment
Share on other sites

Ok when I deleted the modified checkout_shipping.php file and uploaded the standard one it works fine. So does that mean it's just this one file or could it be multiple?

 

 

Last question :blush: I installed and configured the Shipping configuration and now it says

 

 

Shipping Method

This is currently the only shipping method available to use on this order.

 

United States Postal Service United States Postal Service

An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

Link to comment
Share on other sites

Ok when I deleted the modified checkout_shipping.php file and uploaded the standard one it works fine. So does that mean it's just this one file or could it be multiple?

It's probably just that one. There could be other problems hidden by this one, but fix one at a time.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Last question :blush: I installed and configured the Shipping configuration and now it says

Shipping Method

This is currently the only shipping method available to use on this order.

 

United States Postal Service United States Postal Service

An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

USPS is a real pain to use. Check your Vendor settings; every detail of the vendor's address must be correct. Make certain that there are no typos and that the zip code is the correct one for that address.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Jim Have a question for you. on this MVS when a regular customer places an order then go through paypal then they redirect to the success checkout page. Will the order show as a regular "Customer Order" instead of Vedors Order?

 

Wade

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

Jim Have a question for you. on this MVS when a regular customer places an order then go through paypal then they redirect to the success checkout page. Will the order show as a regular "Customer Order" instead of Vedors Order?

 

Wade

There is nothing in MVS to tell the customer that their order is shipping from a vendor (Unless you add that in.) Stock MVS states(on the shipping page) that the order will ship from multiple locations. You can modify that language to say anything that you want. Try it and see,

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

There is nothing in MVS to tell the customer that their order is shipping from a vendor (Unless you add that in.) Stock MVS states(on the shipping page) that the order will ship from multiple locations. You can modify that language to say anything that you want. Try it and see,

 

Regards

Jim

 

 

so you are saying that I get there order in the Customer Order instead in the Vendors Area?

 

Nevermind I found it

Edited by mtechama

Wade Morris

Amarillo, Texas

 

Before you do any changes on your site you need to do BACKUP! BACKUP!

Link to comment
Share on other sites

This mod is fantastic but for what my business requires it needs an update, i am a little surprised no one has implemented it. I currently run a shop with around 5000 products (nightmare to keep track of) and when orders are placed for the larger items such as furniture we inturn place orders with the supplier if we do not have it in stock. We try to keep all the smaller items we sell in stock.

 

The present OsCommerce system can prevent orders being placed if the item is currently out of stock, which is good for the smaller items. But when placing orders with our suppliers it is nearly impossible to know whether at the time the customer places the order that the supplier is out of stock or not. When a customer places an order for an item that you do not have instock but is ordered from the supplier there should be an option to allow the customer to proceed to checkout informing the customer it is to be shipped from a different location. If the item is in stock then obviously you can send it out. In this scenario a problem can occur when the customer orders more items than your present stock amount. It probably would be cheaper in postage to send the complete order from the supplier, and the quantity should not be deducted, but this is ambiguous and someone else might prefer it to be different.

 

Also it might be a good idea to have a returns information field added to the database for each vendor to inform the customer that if they wish to return the product they need to send it back to the supplier. Different vendors have different returns policies. Again a nightmare to try and remember.

 

Hope you like the ideas

Dave

Link to comment
Share on other sites

hi,

 

I've just added this contribution, and is getting this message when i do a checkout.

 

Warning: Invalid argument supplied for foreach() in /home/estrella/public_html/checkout_process.php on line 125

 

Warning: Cannot modify header information - headers already sent by (output started at /home/estrella/public_html/checkout_process.php:125) in /home/estrella/public_html/includes/functions/general.php on line 29

 

however, the order is created as per usual, but I'm getting the above error msg. any advice?

 

<?php
/*
 $Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 include('includes/application_top.php');

// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 if (!tep_session_is_registered('sendto')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }

 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
}

// avoid hack attempts during the checkout procedure by checking the internal cartID
 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
if ($cart->cartID != $cartID) {
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
 }

 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

// load selected payment module
 require(DIR_WS_CLASSES . 'payment.php');
if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS
 $payment_modules = new payment($payment);

//MVS start
// load the selected shipping module
  if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true')){
	include(DIR_WS_CLASSES . 'vendor_shipping.php');
  } elseif (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false')){
	include(DIR_WS_CLASSES . 'shipping.php');
  }
  $shipping_modules = new shipping($shipping);	
  //MVS End

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 $sql_data_array = array('customers_id' => $customer_id,
					  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
					  'customers_company' => $order->customer['company'],
					  'customers_street_address' => $order->customer['street_address'],
					  'customers_suburb' => $order->customer['suburb'],
					  'customers_city' => $order->customer['city'],
					  'customers_postcode' => $order->customer['postcode'], 
					  'customers_state' => $order->customer['state'], 
					  'customers_country' => $order->customer['country']['title'], 
					  'customers_telephone' => $order->customer['telephone'], 
					  'customers_email_address' => $order->customer['email_address'],
					  'customers_address_format_id' => $order->customer['format_id'], 
					  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 
					  'delivery_company' => $order->delivery['company'],
					  'delivery_street_address' => $order->delivery['street_address'], 
					  'delivery_suburb' => $order->delivery['suburb'], 
					  'delivery_city' => $order->delivery['city'], 
					  'delivery_postcode' => $order->delivery['postcode'], 
					  'delivery_state' => $order->delivery['state'], 
					  'delivery_country' => $order->delivery['country']['title'], 
					  'delivery_address_format_id' => $order->delivery['format_id'], 
					  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 
					  'billing_company' => $order->billing['company'],
					  'billing_street_address' => $order->billing['street_address'], 
					  'billing_suburb' => $order->billing['suburb'], 
					  'billing_city' => $order->billing['city'], 
					  'billing_postcode' => $order->billing['postcode'], 
					  'billing_state' => $order->billing['state'], 
					  'billing_country' => $order->billing['country']['title'], 
					  'billing_address_format_id' => $order->billing['format_id'], 
					  'payment_method' => $order->info['payment_method'], 
					  'cc_type' => $order->info['cc_type'], 
					  'cc_owner' => $order->info['cc_owner'], 
					  'cc_number' => $order->info['cc_number'], 
					  'cc_expires' => $order->info['cc_expires'], 
					  'date_purchased' => 'now()', 
					  'orders_status' => $order->info['order_status'], 
					  'currency' => $order->info['currency'], 
					  'currency_value' => $order->info['currency_value']);
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
						'title' => $order_totals[$i]['title'],
						'text' => $order_totals[$i]['text'],
						'value' => $order_totals[$i]['value'], 
						'class' => $order_totals[$i]['code'], 
						'sort_order' => $order_totals[$i]['sort_order']);
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id, 
					  'orders_status_id' => $order->info['order_status'], 
					  'date_added' => 'now()', 
					  'customer_notified' => $customer_notification,
					  'comments' => $order->info['comments']);
 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
//MVS - added insert for new orders_shipping table
	$shipping_array = $shipping['vendor'];
 foreach ($shipping_array as $vendors_id => $shipping_data) {
$vendors_query = tep_db_query("select vendors_name
							   from " . TABLE_VENDORS . "
							   where vendors_id = '" . (int)$vendors_id . "'"
							 );
$vendors_name = 'Unknown';
if ($vendors = tep_db_fetch_array($vendors_query)) {
  $vendors_name = $vendors['vendors_name'];
}
			$shipping_method_array = explode ('_', $shipping_data['id']);
			if ($shipping_method_array[0] == 'fedex1') {
					$shipping_method = 'Federal Express';
					} elseif ($shipping_method_array[0] == 'upsxml') {
					$shipping_method = 'UPS';
					} elseif ($shipping_method_array[0] == 'usps') {
					$shipping_method = 'USPS';
					} else {
				$shipping_method = $shipping_method_array[0];
				}
$sql_data_array = array('orders_id' => $insert_id,
						'vendors_id' => $vendors_id,
						'shipping_module' => $shipping_method,
						'shipping_method' => $shipping_data['title'],
						'shipping_cost' => $shipping_data['cost'],
						'shipping_tax' =>  $shipping_data['ship_tax'],
						'vendors_name' => $vendors_name,
						'vendor_order_sent' => 'no'
					   );
tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array);
 }
//MVS End
// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
  if (DOWNLOAD_ENABLED == 'true') {
	$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 
						FROM " . TABLE_PRODUCTS . " p
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
						 ON p.products_id=pa.products_id
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
						 ON pa.products_attributes_id=pad.products_attributes_id
						WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
	$products_attributes = $order->products[$i]['attributes'];
	if (is_array($products_attributes)) {
	  $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	}
	$stock_query = tep_db_query($stock_query_raw);
  } else {
	$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
  }
  if (tep_db_num_rows($stock_query) > 0) {
	$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
	if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
	  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	} else {
	  $stock_left = $stock_values['products_quantity'];
	}
	tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
	  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	}
  }
}

// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

//MVS start - added 'vendors_id' => ...
$sql_data_array = array('orders_id' => $insert_id,
						'products_id' => tep_get_prid($order->products[$i]['id']),
						'products_model' => $order->products[$i]['model'],
						'products_name' => $order->products[$i]['name'],
						'products_price' => $order->products[$i]['price'],
						'final_price' => $order->products[$i]['final_price'],
						'products_tax' => $order->products[$i]['tax'],
						'products_quantity' => $order->products[$i]['qty'],
						'vendors_id' => $order->products[$i]['vendors_id']
					   ); //MVS end
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();
$order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM

//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
  $attributes_exist = '1';
  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	if (DOWNLOAD_ENABLED == 'true') {
	  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
						   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
						   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							on pa.products_attributes_id=pad.products_attributes_id
						   where pa.products_id = '" . $order->products[$i]['id'] . "' 
							and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
							and pa.options_id = popt.products_options_id 
							and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
							and pa.options_values_id = poval.products_options_values_id 
							and popt.language_id = '" . $languages_id . "' 
							and poval.language_id = '" . $languages_id . "'";
	  $attributes = tep_db_query($attributes_query);
	} else {
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
	}
	$attributes_values = tep_db_fetch_array($attributes);

	$sql_data_array = array('orders_id' => $insert_id, 
							'orders_products_id' => $order_products_id, 
							'products_options' => $attributes_values['products_options_name'],
							'products_options_values' => $attributes_values['products_options_values_name'], 
							'options_values_price' => $attributes_values['options_values_price'], 
							'price_prefix' => $attributes_values['price_prefix']);
	tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

	if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
	  $sql_data_array = array('orders_id' => $insert_id, 
							  'orders_products_id' => $order_products_id, 
							  'orders_products_filename' => $attributes_values['products_attributes_filename'], 
							  'download_maxdays' => $attributes_values['products_attributes_maxdays'], 
							  'download_count' => $attributes_values['products_attributes_maxcount']);
	  tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
	}
	$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
  }
}
//------insert customer choosen option eof ----
$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;

//TotalB2B start
//MVS edited


//MVS begin
 if (SELECT_VENDOR_EMAIL_OPTION == 'false') {
 $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price_nodiscount($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}
}
if (SELECT_VENDOR_EMAIL_OPTION == 'true') {
  $order_id = $insert_id;
   require(DIR_WS_INCLUDES . 'vendor_order_data.php');
	   }
function vendors_email($vendors_id, $oID, $status, $vendor_order_sent) {
   $vendor_order_sent =  false;
  $debug='no';
  $vendor_order_sent = 'no';
$index2 = 0;
		  //let's get the Vendors
		  $vendor_data_query = tep_db_query("select v.vendors_id, v.vendors_name, v.vendors_email, v.vendors_contact, v.vendor_add_info, v.vendor_street, v.vendor_city, v.vendor_state, v.vendors_zipcode, v.vendor_country, v.account_number, v.vendors_status_send, os.shipping_module, os.shipping_method, os.shipping_cost, os.shipping_tax, os.vendor_order_sent from " . TABLE_VENDORS . " v,  " . TABLE_ORDERS_SHIPPING . " os where v.vendors_id=os.vendors_id and v.vendors_id='" . $vendors_id . "' and os.orders_id='" . (int)$oID . "' and v.vendors_status_send='" . $status . "'");
	   while ($vendor_order = tep_db_fetch_array($vendor_data_query)) {
$vendor_products[$index2] = array('Vid' => $vendor_order['vendors_id'],
						 'Vname' => $vendor_order['vendors_name'],
						 'Vemail' => $vendor_order['vendors_email'],
						 'Vcontact' => $vendor_order['vendors_contact'],
						 'Vaccount' => $vendor_order['account_number'],
						 'Vstreet' => $vendor_order['vendor_street'],
						 'Vcity' => $vendor_order['vendor_city'],
						 'Vstate' => $vendor_order['vendor_state'],
						 'Vzipcode' => $vendor_order['vendors_zipcode'],
						 'Vcountry' => $vendor_order['vendor_country'],
						 'Vaccount' => $vendor_order['account_number'],							   'Vinstructions' => $vendor_order['vendor_add_info'],
						 'Vmodule' => $vendor_order['shipping_module'],							   'Vmethod' => $vendor_order['shipping_method']);
if ($debug == 'yes') {
echo 'The vendor query: ' . $vendor_order['vendors_id'] . '<br>';
  }
							   $index = 0;
$vendor_orders_products_query = tep_db_query("select o.orders_id, o.orders_products_id, o.products_model, o.products_id, o.products_quantity, o.products_name, p.vendors_id,  p.vendors_prod_comments, p.vendors_prod_id, p.vendors_product_price from " . TABLE_ORDERS_PRODUCTS . " o, " . TABLE_PRODUCTS . " p where p.vendors_id='" . (int)$vendor_order['vendors_id'] . "' and o.products_id=p.products_id and o.orders_id='" . $oID . "' order by o.products_name");
	while ($vendor_orders_products = tep_db_fetch_array($vendor_orders_products_query)) {
  $vendor_products[$index2]['vendor_orders_products'][$index] = array(
								  'Pqty' => $vendor_orders_products['products_quantity'],
								  'Pname' => $vendor_orders_products['products_name'],
								  'Pmodel' => $vendor_orders_products['products_model'],
								  'Pprice' => $vendor_orders_products['products_price'],
								  'Pvendor_name' => $vendor_orders_products['vendors_name'],
								  'Pcomments' => $vendor_orders_products['vendors_prod_comments'],
								  'PVprod_id' => $vendor_orders_products['vendors_prod_id'],
								  'PVprod_price' => $vendor_orders_products['vendors_product_price'],
								  'spacer' => '-');
							   //MVS end
			   if ($debug == 'yes') {
echo 'The products query: ' . $vendor_orders_products['products_name'] . '<br>';
}
	$subindex = 0;
  $vendor_attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$vendor_orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($vendor_attributes_query)) {
	  while ($vendor_attributes = tep_db_fetch_array($vendor_attributes_query)) {
	  $vendor_products[$index2]['vendor_orders_products'][$index]['vendor_attributes'][$subindex] = array('option' => $vendor_attributes['products_options'],
																 'value' => $vendor_attributes['products_options_values'],
																 'prefix' => $vendor_attributes['price_prefix'],
																 'price' => $vendor_attributes['options_values_price']);

		$subindex++;
	  }
	}
	$index++;
  }
 $index2++;
// let's build the email
  // Get the delivery address
 $delivery_address_query = tep_db_query("select distinct delivery_company, delivery_name, delivery_street_address, delivery_city, delivery_state, delivery_postcode from " . TABLE_ORDERS . " where orders_id='" . $oID ."'");
 $vendor_delivery_address_list = tep_db_fetch_array($delivery_address_query);

if ($debug == 'yes') {
echo 'The number of vendors: ' . sizeof($vendor_products) . '<br>';
 }
$email='';
for ($l=0, $m=sizeof($vendor_products); $l<$m; $l++) {

$vendor_country = tep_get_country_name($vendor_products[$l]['Vcountry']);
$order_number= $oID;
$vendors_id=$vendor_products[$l]['Vid'];
$the_email=$vendor_products[$l]['Vemail'];
$the_name=$vendor_products[$l]['Vname'];
$the_contact=$vendor_products[$l]['Vcontact'];
$email=  '<b>To: ' . $the_contact . '  <br>' . $the_name . '<br>' . $the_email . '<br>' .
$vendor_products[$l]['Vstreet'] .'<br>' .
$vendor_products[$l]['Vcity'] .', ' .
$vendor_products[$l]['Vstate'] .'  ' .
$vendor_products[$l]['Vzipcode'] . ' ' . $vendor_country . '<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'Special Comments or Instructions:  ' . $vendor_products[$l]['Vinstructions'] .'<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'From: ' . STORE_OWNER . '<br>' . STORE_NAME_ADDRESS . '<br>' . 'Accnt #: ' . $vendor_products[$l]['Vaccount'] . '<br>' . EMAIL_SEPARATOR . '<br>' . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . '<br>' .  EMAIL_SEPARATOR . '<br>' . '<br> Shipping Method: ' .  $vendor_products[$l]['Vmodule'] . ' -- '  .  $vendor_products[$l]['Vmethod'] .  '<br>' .  EMAIL_SEPARATOR . '<br>' . '<br>Dropship deliver to:<br>' .
$vendor_delivery_address_list['delivery_company'] .'<br>' .
$vendor_delivery_address_list['delivery_name'] .'<br>' .
$vendor_delivery_address_list['delivery_street_address'] .'<br>' .
$vendor_delivery_address_list['delivery_city'] .', ' .
$vendor_delivery_address_list['delivery_state'] . ' ' . $vendor_delivery_address_list['delivery_postcode'] . '<br><br>';
$email = $email .  '<table width="75%" border=1 cellspacing="0" cellpadding="3">
<tr><td>Qty:</td><td>Product Name:</td><td>Item Code/Number:</td><td>Product Model:</td><td>Per Unit Price:</td><td>Item Comments: </td></tr>';
	   for ($i=0, $n=sizeof($vendor_products[$l]['vendor_orders_products']); $i<$n; $i++) {
  $product_attribs ='';
  if (isset($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) && (sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) > 0)) {

	for ($j = 0, $k = sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']); $j < $k; $j++) {
	 $product_attribs .= '  ' . $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['option'] . ': ' .  $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['value'] . '<br>';
	}
	}
	$email = $email . '<tr><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pqty'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pname'] . '<br>  <i>Option<br> ' . $product_attribs .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_id'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pmodel'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_price'] . '</td><td>' .
 $vendor_products[$l]['vendor_orders_products'][$i]['Pcomments'] . '</b></td></tr>';

  }
}
$email = $email . '</table><br><HR><br>';

tep_mail($the_name, $the_email, EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID ,  $email .  '<br>', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS) ;
 $vendor_order_sent = 'yes';

 tep_db_query("update " . TABLE_ORDERS_SHIPPING . " set vendor_order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "'  and vendors_id = '" . (int)$vendors_id . "'");

 if ($debug == 'yes') {
	   echo 'The $email(including headers:<br>Vendor Email Addy' . $the_email . '<br>Vendor Name' . $the_name . '<br>Vendor Contact' . $the_contact . '<br>Body--<br>' . $email . '<br>';
	   }
 }

 return true;
} //MVS end

//TotalB2B end

$order_total_modules->apply_credit();//ICW ADDED FOR CREDIT CLASS SYSTEM

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n" .
			 EMAIL_ADDITIONAL . "\n\n";
 if ($order->info['comments']) {
$email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
			  EMAIL_SEPARATOR . "\n" . 
			  $products_ordered . 
			  EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
				EMAIL_SEPARATOR . "\n" .
				tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
			  EMAIL_SEPARATOR . "\n" .
			  tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . 
				EMAIL_SEPARATOR . "\n";
$payment_class = $$payment;
$email_order .= $payment_class->title . "\n\n";
if ($payment_class->email_footer) { 
  $email_order .= $payment_class->email_footer . "\n\n";
}
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }

 //MVS start
if (SELECT_VENDOR_EMAIL_WHEN == 'Catalog' || SELECT_VENDOR_EMAIL_WHEN == 'Both') {
		$status=$order->info['order_status'];
		 if (isset($status)) {
 $order_sent_query = tep_db_query("select vendor_order_sent, vendors_id from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . $insert_id . "'");
   while ($order_sent_data = tep_db_fetch_array($order_sent_query)) {
 $order_sent_ckeck = $order_sent_data['vendor_order_sent'];
 $vendors_id = $order_sent_data['vendors_id'];
//   echo $order_sent_check . ' The order sent check<br>';
//		  echo $insert_id . 'The order number<br>';
  if ($order_sent_ckeck == 'no') {
	 $status='';
	 $oID=$insert_id;
	 $vendor_order_sent = false;
	 $status=$order->info['order_status'];

	 vendors_email($vendors_id, $oID, $status, $vendor_order_sent);
		}// if order check
	  }// while
	}// if isset
	 //  echo 'Email sent? ' . $vendor_order_sent . '<br>';
 }// if enabled
 //MVS end this file is complete

 // Include OSC-AFFILIATE 
 require(DIR_WS_INCLUDES . 'affiliate_checkout_process.php');

// load the after_process function from the payment modules
 $payment_modules->after_process();

 $cart->reset(true);

 //added for Points module  
 $sqlquery = tep_db_query('SELECT value from '. TABLE_ORDERS_TOTAL . ' where orders_id = ' . $insert_id . ' and class = \'ot_total\' ');

 $order_value = tep_db_fetch_array($sqlquery);

 $confquery = tep_db_query('select configuration_value from '. TABLE_CONFIGURATION . ' where configuration_key = "POINTS_PER_DOLLAR_PURCHASE" ');

 $confvalue = tep_db_fetch_array($confquery);
 $points_per_dollar = $confvalue['configuration_value'];
 $points_awarded = $order_value['value'] * $points_per_dollar;

$sql_data_array = array('unique_id' => '',
						'customer_id' => $customer_id,
						'orders_id' => $insert_id,
						'points_pending' => $points_awarded,
						'date_added' => 'now()', 
						'status' => 1);

tep_db_perform('customer_points_pending', $sql_data_array);


// unregister session variables used during checkout
 tep_session_unregister('sendto');
 tep_session_unregister('billto');
 tep_session_unregister('shipping');
 tep_session_unregister('payment');
 tep_session_unregister('comments');
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');
 $order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM

 tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

Thanks in advance! :)

Link to comment
Share on other sites

This mod is fantastic but for what my business requires it needs an update, i am a little surprised no one has implemented it. I currently run a shop with around 5000 products (nightmare to keep track of) and when orders are placed for the larger items such as furniture we inturn place orders with the supplier if we do not have it in stock. We try to keep all the smaller items we sell in stock.

 

The present OsCommerce system can prevent orders being placed if the item is currently out of stock, which is good for the smaller items. But when placing orders with our suppliers it is nearly impossible to know whether at the time the customer places the order that the supplier is out of stock or not. When a customer places an order for an item that you do not have instock but is ordered from the supplier there should be an option to allow the customer to proceed to checkout informing the customer it is to be shipped from a different location. If the item is in stock then obviously you can send it out. In this scenario a problem can occur when the customer orders more items than your present stock amount. It probably would be cheaper in postage to send the complete order from the supplier, and the quantity should not be deducted, but this is ambiguous and someone else might prefer it to be different.

 

Also it might be a good idea to have a returns information field added to the database for each vendor to inform the customer that if they wish to return the product they need to send it back to the supplier. Different vendors have different returns policies. Again a nightmare to try and remember.

 

Hope you like the ideas

Dave

hi,

Warning: Invalid argument supplied for foreach() in /home/estrella/public_html/checkout_process.php on line 125

 

Warning: Cannot modify header information - headers already sent by (output started at /home/estrella/public_html/checkout_process.php:125) in /home/estrella/public_html/includes/functions/general.php on line 29

 

 

I've just added this contribution, and is getting this message when i do a checkout.

however, the order is created as per usual, but I'm getting the above error msg. any advice?

 

 

Thanks in advance! :)

This particular error is one that has become quite baffling. The "foreach" is being "filled" with data from the "shopping_cart" class, which must be initiated in order for their to be any data with which to create a customer order. Basically, what I am saying is: almost impossible to happen if the order is an "actual order", if it gets to the order confirmation without throwing a bunch of other errors, then this cannot happen. What this likely adds up to is that there is another error that is being interpreted as the "for each" error.

 

In a nut shell: this only an occasional error, most sites never experience it at all while some others see are claiming to see it fairly often. We have no answers for this at the moment.

 

Sorry

This mod is fantastic but for what my business requires it needs an update, i am a little surprised no one has implemented it. I currently run a shop with around 5000 products (nightmare to keep track of) and when orders are placed for the larger items such as furniture we inturn place orders with the supplier if we do not have it in stock. We try to keep all the smaller items we sell in stock.

 

The present OsCommerce system can prevent orders being placed if the item is currently out of stock, which is good for the smaller items. But when placing orders with our suppliers it is nearly impossible to know whether at the time the customer places the order that the supplier is out of stock or not. When a customer places an order for an item that you do not have instock but is ordered from the supplier there should be an option to allow the customer to proceed to checkout informing the customer it is to be shipped from a different location. If the item is in stock then obviously you can send it out. In this scenario a problem can occur when the customer orders more items than your present stock amount. It probably would be cheaper in postage to send the complete order from the supplier, and the quantity should not be deducted, but this is ambiguous and someone else might prefer it to be different.

 

Also it might be a good idea to have a returns information field added to the database for each vendor to inform the customer that if they wish to return the product they need to send it back to the supplier. Different vendors have different returns policies. Again a nightmare to try and remember.

 

Hope you like the ideas

Dave

 

This is a pretty good idea, I will add it to the feature list and work on it when I can. Implementation could difficult, in the mindset of covering as many needs as possible(options) within the basics of the idea.

 

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

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