Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

blucollarguy

Multi_Vendor_Shipping new thread

Recommended Posts

Craig,

 

I would like to ask you if you have some time would you be willing to help me create a table for shipping that goes by percentage of the total order not by weight?

 

Wade :)


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
Craig,

 

I would like to ask you if you have some time would you be willing to help me create a table for shipping that goes by percentage of the total order not by weight?

 

Wade :)

I worked with Stephanie a bit yesterday on it but have not had time yet to get back and look at where it ended up. I will try to get to it today.

 

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: webmaster@blucollarsales.com

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!

Share this post


Link to post
Share on other sites

Craig or Jim

 

I would like to have this shipping module done A.S.A.P.

 

Thanks Wade


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
Craig or Jim

 

I would like to have this shipping module done A.S.A.P.

 

Thanks Wade

 

same here :blush: , for some reason USPS is the default and i cant delete it. I dont want to use USPS and that's all it's saying is that

 

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.

Share this post


Link to post
Share on other sites
Craig or Jim

 

I would like to have this shipping module done A.S.A.P.

 

Thanks Wade

Wade:

So sorry, but I gotta make a living, and I haven't seen any checks from you.

 

I'll get to it when I can.

 

"Open Source" does not stand for free labor, keep this in mind the next time you see the notes in a contrib about making a donation to the authors for all the work you are reeping the benefits from.

 

"thessrtech":

 

The USPS problem is likely the fact that the module can't work in "Test" mode, it must be on the "Production" servers to get quotes. There are some notes about this in the MVS V1.1 package and instructions about getting authorized to use the production servers.

 

Craig :)

Edited by blucollarguy

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: webmaster@blucollarsales.com

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!

Share this post


Link to post
Share on other sites

Fine I find some other Free Commerce that will work for me I am loosing customers becuase of this


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
Guest
Craig or Jim

 

I would like to have this shipping module done A.S.A.P.

 

Thanks Wade

 

Wade,

Everyone here is helping in there free time, no one works here or gets paid for writing contributions or helping each other. It is great community of people helping people. You can't just expect someone to write a contribution for you right when you ask. You would have a lot more luck if you tried working on it yourself and asked questions as you run into them.

 

Going to a different shopping cart with technical support and installation help might be more what you are looking for if you don't feel that you can do any of the coding yourself.

 

Stephanie :(

Share this post


Link to post
Share on other sites
Wade,

Everyone here is helping in there free time, no one works here or gets paid for writing contributions or helping each other. It is great community of people helping people. You can't just expect someone to write a contribution for you right when you ask. You would have a lot more luck if you tried working on it yourself and asked questions as you run into them.

 

Going to a different shopping cart with technical support and installation help might be more what you are looking for if you don't feel that you can do any of the coding yourself.

 

Stephanie :(

 

 

Stephanie, I am not very good writing contributions or PHP scripts


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites

Hi Craig,

 

I think my post got buried beneath reams of code!

 

Was just wondering if you can help me with a problem with the email sent to the vendor:

 

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.

 

I thought it might be this line:

if (isset($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) && (sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) > 0)) {

 

Any help appreciated.

 

Cheers,

 

Paul.

Share this post


Link to post
Share on other sites
Wade,

Everyone here is helping in there free time, no one works here or gets paid for writing contributions or helping each other. It is great community of people helping people. You can't just expect someone to write a contribution for you right when you ask. You would have a lot more luck if you tried working on it yourself and asked questions as you run into them.

 

Going to a different shopping cart with technical support and installation help might be more what you are looking for if you don't feel that you can do any of the coding yourself.

 

Stephanie :(

 

Stephanie I am trying to rewrite some codes but I am getting close:

 

what I did is in includes/modules/vendors_shipping/table.php

 

I did this modifications:

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

$size = sizeof($table_cost);

for ($i=0, $n=$size; $i<$n; $i+=2) {

if ($order_total <= $table_cost[$i]) {

$shipping = $table_cost[$i+1];

break;

}

}

 

Then modify the code to the follwoing code:

 

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

$size = sizeof($table_cost);

for ($i=0, $n=$size; $i<$n; $i+=2) {

if ($order_total <= $table_cost[$i]) {

$pos = strpos($table_cost[$i+1], '%');

if ($pos === false) {

$shipping = $table_cost[$i+1];

}

else {

$shipping_cost_temp = split("%", $table_cost[$i+1]);

$shipping = $order_total * $shipping_cost_temp[0] / 100;

}

break;

}

}

 

then change the file name to table2.php and upload it to my test site and I got this error:

 

Warning: main(/home/content/m/t/e/mtechamatest/html/catalog/includes/languages/english/modules/vendors_shipping/table2.php): failed to open stream: No such file or directory in /home/content/m/t/e/mtechamatest/html/catalog/admin/vendor_modules.php on line 129

 

Warning: main(/home/content/m/t/e/mtechamatest/html/catalog/includes/languages/english/modules/vendors_shipping/table2.php): failed to open stream: No such file or directory in /home/content/m/t/e/mtechamatest/html/catalog/admin/vendor_modules.php on line 129

 

Warning: main(): Failed opening '/home/content/m/t/e/mtechamatest/html/catalog/includes/languages/english/modules/vendors_shipping/table2.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/content/m/t/e/mtechamatest/html/catalog/admin/vendor_modules.php on line 129

 

do you think I am very close?


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
Warning: main(/home/content/m/t/e/mtechamatest/html/catalog/includes/languages/english/modules/vendors_shipping/table2.php): failed to open stream: No such file or directory in /home/content/m/t/e/mtechamatest/html/catalog/admin/vendor_modules.php on line 129

Make a copy of catalog/includes/languages/english/modules/vendors_shipping/table.php, rename it to table2.php, then upload that to the same directory. That will take care of the error messages.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

ok jim I got rid the of the error in the Admin but when I do a checkout_shipping.php test I also got this error:

 

Warning: reset(): Passed variable is not an array or object in /home/content/m/t/e/mtechamatest/html/catalog/includes/classes/vendor_shipping.php on line 48

 

I am trying to learn to fix it


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
ok jim I got rid the of the error in the Admin but when I do a checkout_shipping.php test I also got this error:

 

Warning: reset(): Passed variable is not an array or object in /home/content/m/t/e/mtechamatest/html/catalog/includes/classes/vendor_shipping.php on line 48

 

I am trying to learn to fix it

That can happen if you don't have any shipping modules installed. Go to your Admin > Vendors, select a vendor, then click Manage and install at least one shipping module. Do this for each vendor if you have more than one set up.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
That can happen if you don't have any shipping modules installed. Go to your Admin > Vendors, select a vendor, then click Manage and install at least one shipping module. Do this for each vendor if you have more than one set up.

 

Regards

Jim

 

When I upload that new shipping module "Table 2" but there is not table2 listed in Admin>Venders section

 

one is install but I still got that error:

Edited by mtechama

Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites

Jim if you want you are welcome to go to test site admin


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
When I upload that new shipping module "Table 2" but there is not table2 listed in Admin>Venders section

 

one is install but I still got that error:

You also need to change

	  $this->code = 'table';

to

	  $this->code = 'table2';

Also change every constant containing _TABLE_ to _TABLE2_

 

If you've been making a lot of changes your configuration in the database may be messed up. Look in your vendors_configuration table for an entry like MODULE_VENDOR_SHIPPING_INSTALLED_#, where # is the vendor number. You should have one and only one of these for each vendor. The value should be the name of each module that you have installed for that vendor. If you want, you can just empty this table and start over.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
You also need to change
	  $this->code = 'table';

to

	  $this->code = 'table2';

Also change every constant containing _TABLE_ to _TABLE2_

 

If you've been making a lot of changes your configuration in the database may be messed up. Look in your vendors_configuration table for an entry like MODULE_VENDOR_SHIPPING_INSTALLED_#, where # is the vendor number. You should have one and only one of these for each vendor. The value should be the name of each module that you have installed for that vendor. If you want, you can just empty this table and start over.

 

Regards

Jim

 

 

I have looked into the database I don't see "MODULE_VENDOR_SHIPPING_INSTALLED_#"


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites

ok jim this what I got I have re-installed everything and for an example all the shipping module hasn't been installed and when I do a test checkout_shipping.php it shows "Flat Rate $5.00" and no Modules are installed. any ideas?


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
ok jim this what I got I have re-installed everything and for an example all the shipping module hasn't been installed and when I do a test checkout_shipping.php it shows "Flat Rate $5.00" and no Modules are installed. any ideas?

Look in your database, the vendors_configuration table. Post all the lines that you see there.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
Look in your database, the vendors_configuration table. Post all the lines that you see there.

 

Regards

Jim

 

 

jim I got it.

 

it was the regular shipping module on the flat rate. Now I got another problem now my Table2 isn't working I just want to know if you want me show you the difference of the old table.php and the new table2.php? the table.php works and the one that I modified is from this contribute:

 

http://www.oscommerce.com/community/contributions,3965

 

I added some few lines from table.php

 

Table2 works fine in Admin part but when I do a test "checkout_shipping.php doesn't show the Shipping Method.

Edited by mtechama

Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
jim I got it.

 

it was the regular shipping module on the flat rate. Now I got another problem now my Table2 isn't working I just want to know if you want me show you the difference of the old table.php and the new table2.php? the table.php works and the one that I modified is from this contribute:

 

http://www.oscommerce.com/community/contributions,3965

 

I added some few lines from table.php

 

Table2 works fine in Admin part but when I do a test "checkout_shipping.php doesn't show the Shipping Method.

Did you modify the table.php from the MVS distribution?

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
Did you modify the table.php from the MVS distribution?

 

Regards

Jim

 

yes


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
yes

OK, please post the whole thing. I'll try it out and see if I can figure out what's wrong.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

ok this is the table.php from MVS1.1

 

<?php
/*
 $Id: table.php,v 1.27 2003/02/05 22:41: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
*/

 class table {
var $code, $title, $description, $icon, $enabled, $vendors_id, $sort_order; //multi vendor

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

//MVS
//	  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'table';
  $this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;
  $this->icon = '';
  $this->delivery_country_id = $order->delivery['country']['id'];
  $this->delivery_zone_id = $order->delivery['zone_id'];
}

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

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

			function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_TABLE_STATUS_' . $vendors_id);
					if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_TABLE_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_TABLE_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->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'] == $this->delivery_zone_id) {
		$check_flag = true;
		break;
		}
	}

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

			function zones($vendors_id='1') {
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_TABLE_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_TABLE_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_zone_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'] == $this->delivery_zone_id) {
		$check_flag = true;
		break;
	  } //if
	}//while

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

//Get a quote
function quote($method = '', $module = '', $vendors_id = '1') {
  global $HTTP_POST_VARS, $shipping_weight, $order, $cart, $shipping_num_boxes;

  if (@constant('MODULE_SHIPPING_TABLE_MODE_' . $vendors_id) == 'price') {
	$order_total = $shipping_cost;
  } else {
	$order_total = $shipping_weight;
  }

  $table_cost = split("[:,]" , @constant('MODULE_SHIPPING_TABLE_COST_' . $vendors_id));
  $size = sizeof($table_cost);
  for ($i=0, $n=$size; $i<$n; $i+=2) {
	if ($order_total <= $table_cost[$i]) {
	  $shipping = $table_cost[$i+1];
	  break;
	}
  }

  if (@constant('MODULE_SHIPPING_TABLE_MODE_' . $vendors_id) == 'weight') {
	$shipping = $shipping * $shipping_num_boxes;
  }

//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);

  $handling_charge = $vendors_data['handling_charge'];
  $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

//MVS - Changed 'cost' => $shipping + $handling
  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
												 'cost' => $shipping + $handling)));

  //	$this->tax_class = constant(MODULE_SHIPPING_TABLE_TAX_CLASS_ . $vendors_id);
  if ($this->tax_class($vendors_id) > 0) {
	   $this->quotes['tax'] = tep_get_tax_rate($this->tax_class($vendors_id), $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)) {
  //multi vendor add  "vendors_id = '". $vendors_id ."' and"
	$check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_TABLE_STATUS_" . $vendors_id . "'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}						 /////VID

function install($vendors_id) {
//multi vendor add 'vendors_id' to field names and '" . $vendors_id . "', to values
  // $vendors_id = $vendors_id;
  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 Table Method', 'MODULE_SHIPPING_TABLE_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer table 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, vendors_id) values ('Shipping Table', 'MODULE_SHIPPING_TABLE_COST_" . $vendors_id . "', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '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, set_function, date_added, vendors_id) values ('Table Method', 'MODULE_SHIPPING_TABLE_MODE_" . $vendors_id . "', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered.', '6', '0', 'tep_cfg_select_option(array(\'weight\', \'price\'), ', 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 ('Handling Fee', 'MODULE_SHIPPING_TABLE_HANDLING_" . $vendors_id . "', '0', 'Handling fee for 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, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_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_TABLE_STATUS_' . $vendors_id, 'MODULE_SHIPPING_TABLE_COST_' . $vendors_id, 'MODULE_SHIPPING_TABLE_MODE_' . $vendors_id, 'MODULE_SHIPPING_TABLE_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_TABLE_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_TABLE_ZONE_' . $vendors_id, 'MODULE_SHIPPING_TABLE_SORT_ORDER_' . $vendors_id);
}
 }
?>

 

and this table2.php modified from MVS1.1

<?php
/*
 $Id: table2.php,v 1.27 2003/02/05 22:41: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
*/

 class table2 {
var $code, $title, $description, $icon, $enabled, $vendors_id, $sort_order; //multi vendor

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

//MVS
//	  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'table2';
  $this->title = MODULE_SHIPPING_TABLE2_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION;
  $this->icon = '';
  $this->delivery_country_id = $order->delivery['country']['id'];
  $this->delivery_zone_id = $order->delivery['zone_id'];
}

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

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

			function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_TABLE2_STATUS_' . $vendors_id);
					if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_TABLE2_ZONE_' . $vendors_id) > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE2_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_TABLE2_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->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'] == $this->delivery_zone_id) {
		$check_flag = true;
		break;
		}
	}

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

			function zones($vendors_id='1') {
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_TABLE2_ZONE_' . $vendors_id) > 0) ) {
	$check_flag = false;
	$check_query = tep_db_query("select zone_id from " . TABLE2_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_TABLE2_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_zone_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'] == $this->delivery_zone_id) {
		$check_flag = true;
		break;
	  } //if
	}//while

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

//Get a quote
function quote($method = '', $module = '', $vendors_id = '1') {
  global $HTTP_POST_VARS, $shipping_weight, $order, $cart, $shipping_num_boxes;

  if (@constant('MODULE_SHIPPING_TABLE2_MODE_' . $vendors_id) == 'price') {
	$order_total = $shipping_cost;
  } else {
	$order_total = $shipping_weight;
  }

  $table_cost = split("[:,]" , @constant('MODULE_SHIPPING_TABLE2_COST_' . $vendors_id));
  $size = sizeof($table_cost);
  for ($i=0, $n=$size; $i<$n; $i+=2) {
	if ($order_total <= $table_cost[$i]) {
			$pos = strpos($table_cost[$i+1], '%');
			if ($pos === false) {
					$shipping = $table_cost[$i+1];
			}
			else {
				  $shipping_cost_temp = split("%", $table_cost[$i+1]);
				  $shipping = $order_total * $hipping_cost_temp[0] / 100;
			}
			break;		

	}
  }

  if (@constant('MODULE_SHIPPING_TABLE2_MODE_' . $vendors_id) == 'weight') {
	$shipping = $shipping * $shipping_num_boxes;
  }

//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);

  $handling_charge = $vendors_data['handling_charge'];
  $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

//MVS - Changed 'cost' => $shipping + $handling
  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
												 'cost' => $shipping + $handling)));

  //	$this->tax_class = constant(MODULE_SHIPPING_TABLE2_TAX_CLASS_ . $vendors_id);
  if ($this->tax_class($vendors_id) > 0) {
	   $this->quotes['tax'] = tep_get_tax_rate($this->tax_class($vendors_id), $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)) {
  //multi vendor add  "vendors_id = '". $vendors_id ."' and"
	$check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_TABLE2_STATUS_" . $vendors_id . "'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}						 /////VID

function install($vendors_id) {
//multi vendor add 'vendors_id' to field names and '" . $vendors_id . "', to values
  // $vendors_id = $vendors_id;
  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 Table Method', 'MODULE_SHIPPING_TABLE2_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer table 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, vendors_id) values ('Shipping Table', 'MODULE_SHIPPING_TABLE2_COST_" . $vendors_id . "', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '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, set_function, date_added, vendors_id) values ('Table Method', 'MODULE_SHIPPING_TABLE2_MODE_" . $vendors_id . "', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered.', '6', '0', 'tep_cfg_select_option(array(\'weight\', \'price\'), ', 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 ('Handling Fee', 'MODULE_SHIPPING_TABLE2_HANDLING_" . $vendors_id . "', '0', 'Handling fee for 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, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_TABLE2_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_TABLE2_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_TABLE2_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_TABLE2_STATUS_' . $vendors_id, 'MODULE_SHIPPING_TABLE2_COST_' . $vendors_id, 'MODULE_SHIPPING_TABLE2_MODE_' . $vendors_id, 'MODULE_SHIPPING_TABLE2_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_TABLE2_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_TABLE2_ZONE_' . $vendors_id, 'MODULE_SHIPPING_TABLE2_SORT_ORDER_' . $vendors_id);
}
 }
?>


Wade Morris

Amarillo, Texas

 

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

Share this post


Link to post
Share on other sites
and this table2.php modified from MVS1.1

<snip>

OK, find this code in catalog/includes/modules/vendor_shipping/table2.php at Line 99:

		$order_total = $shipping_cost;
  } else {
	$order_total = $shipping_weight;

and change it to:

	$order_total = $cart->vendor_shipping[$vendors_id]['cost'];
 } else {
$order_total = $cart->vendor_shipping[$vendors_id]['weight'];

That appears to be an error in the MVS module. Either nobody's tried to use this before or I missed an update.

 

Also, Line 114 has a typo; It should be:

		$shipping = $order_total * $shipping_cost_temp[0] / 100;

and Line 128 has an errant comma. Change it to:

vendors_zipcode

It now should work.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×