Jump to content
blucollarguy

Multi_Vendor_Shipping new thread

Recommended Posts

I was pointed to this contribution based on my post yesterday in General Support.

 

All my inventory is supplied by companies that drop ship. Some use just USPS, some just UPS and FedEx and other such combinations.

 

Just briefly looking over this thread, it sounds like there are still a lot of bugs in the contribution.

 

So .... someone so isn't contribution savvy like myself (only have the header tag contribution on my store), shouldn't attempt this one?

 

If that's the case, what other solution can someone suggest for multi-vendor shipping. I need to be able to assign certain shipping to certain products, based on the drop ship supplier.

 

It's either that or my only other solution is to try and make my shipping table cover the majority of shipping charges of my suppliers as best I can, add a handling charge to each order to help cover shortages (a shipping cushion fund LOL), and just put in my Shipping page that items will be shipped via USPS, UPS, and/or FedEx.

 

If everything is shipped via drop ship companies (I hold no inventory), do I still need to open an account with the shipping companies in order to install the modules in the admin panel?

 

Shipping is one of the last things I need to get setup in order to open my store.

 

Sorry for this post - just trying to get my questions all out on the board up front. Thanks in advance!

 

 

Before installing osCommerce I was a complete PHP newbie but with the supplied install instructions provided with most mods, they are usually fairly simple to install.

 

that being said, MVS is a BIG contribution that takes quite a while to install, but the instructions are well laid out and it is well worth it if you deal with dropshippers (like I do). I too have some vendors who only ship in the USA by USPS, others ship globally by USPS and UPS. With this contribution, you can handle all this and more. While it is time consuing to install, definately worth the time and effort.

 

As for needing accounts with the shipping companies, yes, you will have to register with both USPS and UPS to use their back end systems.

 

Jim


Jim Bullen - President

The Cigar Hut Group of Companies

 

 

Installed add-ons: (that now need to be upgraded to BS 2.3.4.1 Frozen)

PWA, MVS, Easy Populate, Dynamic Sitemap, Featured Products, MVS Order Editor, MVS Shipping Estimator, Google XML Sitemap, About Us, Ad Tracker, Address Enhancer, Also Purchased, Backorders, Category Descriptions, Dynamic Meta Tags, Contact Us Email Subjects, Country state Selector, Extra Address Line, Order Number in Email Subject, OSC Affiliate, Product Extra Fields, Review Approval System, Reviews in Product Display, Sold Out, Sold Out (but Displayed), Ultimate SEO URL's, Updated Spiders, Welcome Email Password, Pending Order Email, Who's Online Enhancement, CCGV, Easy Discounts, Customer Comments, Request a Review, Sales Report, plus many many more!

Share this post


Link to post
Share on other sites
That's not what MVS was designed to do. You could set up one vendor for each product, but if there are more than a couple this would not be practical. I believe that there is a shipping by product contribution available that would do what you want.

 

Regards

Jim

 

I understand what your saying. Each flat ship rate would have to have its own vendor using what vendor shipping mods there are. But couldn't there be a vendor shipping mod that would fetch the shipping price from a table based on the product id? I think the Individual shipping contribution could be modified to do this but when I looked at it I got a little lost.

 

I use several different vendors so this contribution would be great for me. I need the UPS and regular flat shipping, but I also need to be able to assign specific amounts to specific items.

 

What I was thinking of was having it set up as a type of shipping that you could assign to a vendor. I think you would have to have two files.

1. catalog/includes/languages/english/modules/vendors_shipping/indvship.php

 

define('MODULE_SHIPPING_INDVSHIP_TEXT_TITLE', 'Individual Shipping');

define('MODULE_SHIPPING_INDVSHIP_TEXT_DESCRIPTION', 'Shipping and Handling');

define('MODULE_SHIPPING_INDVSHIP_TEXT_WAY', 'Shipping Rate');

?>

 

 

2. catalog/includes/modules/vendors_shipping/indvship.php

 

class indvship {

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

 

// class constructor

function indvship() {

global $order;

//MVS

$this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];

$this->code = 'indvship';

$this->title = MODULE_SHIPPING_INDVSHIP_TEXT_TITLE;

$this->description = MODULE_SHIPPING_INDVSHIP_TEXT_DESCRIPTION;

$this->icon = '';

$this->tax_class = MODULE_SHIPPING_INDVSHIP_TAX_CLASS;

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

 

// Enable Individual Shipping Module

$this->enabled = MODULE_SHIPPING_INDVSHIP_STATUS;

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_INDVSHIP_ZONE > 0) ) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_INDVSHIP_ZONE . "' 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 ($check_flag == false) {

$this->enabled = false;

}

}

}

 

// class methods

 

function quote($method = '') {

global $order, $cart;

$shiptotal = $cart->get_shiptotal();

 

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

'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,

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

'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,

'cost' => $shiptotal)));

 

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() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INDVSHIP_STATUS'");

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

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Individual Shipping Prices', 'MODULE_SHIPPING_INDVSHIP_STATUS', 'True', 'Do you want to offer individual shipping prices?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_INDVSHIP_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_INDVSHIP_ZONE', '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())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");

}

 

function remove() {

 

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

}

 

function keys() {

return array('MODULE_SHIPPING_INDVSHIP_STATUS', 'MODULE_SHIPPING_INDVSHIP_TAX_CLASS', 'MODULE_SHIPPING_INDVSHIP_ZONE', 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER');

}

}

?>

Is this correct?

And maybe this could be sort of an add on like the RVQ.

 

I'm also not sure what changes to make to other files? :(

Share this post


Link to post
Share on other sites
Is this correct?

And maybe this could be sort of an add on like the RVQ.

 

I'm also not sure what changes to make to other files? :(

It's not quite correct, but it should certainly be possible. First, all shipping modules need to be modified to work with MVS. See the modules.txt file in the distribution for details on these mods.

 

Second, this code seems to get its shipping cost from the shopping_cart class, thus (line 41):

$shiptotal = $cart->get_shiptotal();

The get_shiptotal method is not in the standard shopping_cart class, so it must be something added by this mod. I also doubt that it would work without modification. It would need to be modified to add only the products assigned to the current vendor, then call it with the $vendors_id.

 

You could put shipping costs in a separate table or in the Products table. A separate table would be more efficient if there are relatively few products that ship this way, or if a lot of the shipping costs are the same. Does this mod use a separate table? The code in the shopping_cart class would tell us how this was designed. Where did you get this code?

 

Regards

Jim

 

(Edit: Stupid spellchecker...)

Edited by kymation

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

Share this post


Link to post
Share on other sites

Thank you for the help. I got this code from the Individual Product Shipping Prices v1.0. It looks like in previous versions they made it possible to integrate this contribution with the old MVS, but now it has been updated. It had been removed from the application_top.php so that it could work in conjunction with other contributions; but it looks like the new version put it back into the application_top.php. I will look at the modules.txt file. It would seem to me that this would be perfectly doable.

 

In theory all you would need it to do is when the vendor is in the cart call the shipping value from a table according to the items products_id. I am somewhat framiliar to ASP but new to PHP. So as far as making it pretty for editing the product shipping prices in the Admin Panel I have no idea. But as long as you could set the vendor shipping type in the vendors shipping modules and upload your values to the table that should be workable for most people. I think I'll post in the thread for the Individual shipping mod as well, maybe I'll get some help there as well.

Share this post


Link to post
Share on other sites
Thank you for the help. I got this code from the Individual Product Shipping Prices v1.0.

As long as you can keep it in a shipping module then this will work. Your approach sounds good to me. Please keep us posted on this, and feel free to ask for help if you need it.

 

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
As long as you can keep it in a shipping module then this will work. Your approach sounds good to me. Please keep us posted on this, and feel free to ask for help if you need it.

 

Regards

Jim

 

Ok here is what I have:

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

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

// class constructor
function indvship() {
  global $order;
  $this->code = 'indvship';
  $this->title = MODULE_SHIPPING_INDVSHIP_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_INDVSHIP_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_INDVSHIP_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_INDVSHIP_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_INDVSHIP_STATUS == 'True') ? true : false);

//MVS
function sort_order($vendors_id='1') {
  if (defined (@constant ('MODULE_SHIPPING_TABLE_SORT_ORDER_' . $vendors_id))) {
	$this->sort_order = @constant('MODULE_SHIPPING_TABLE_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_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);
  }
  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 = '" . $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

// class methods

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



		  $vendors_data_query = tep_db_query("select handling_charge, 
													 handling_per_box,
							 vendor_country 
											  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;
		  }
	$this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,
												 'cost' => $shipping + $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_ INDVSHIP_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 Individual Shipping Prices', 'MODULE_SHIPPING_INDVSHIP_STATUS', 'True', 'Do you want to offer individual shipping prices?', '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, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_INDVSHIP_TAX_CLASS', '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_INDVSHIP_ZONE', '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_INDVSHIP_SORT_ORDER', '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_INDVSHIP_STATUS_" . $vendors_id . "', 'MODULE_SHIPPING_INDVSHIP_TAX_CLASS_" . $vendors_id . "', 'MODULE_SHIPPING_INDVSHIP_ZONE_" . $vendors_id . "', 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER_" . $vendors_id . "');
}
 }
?>

 

 

Does this look better?

Share this post


Link to post
Share on other sites
Does this look better?

That's close. You need to convert

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

to

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

 

Also, all of the constants in your install method need to be converted, e.g.

 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 Individual Shipping Prices', 'MODULE_SHIPPING_INDVSHIP_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer individual shipping prices?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now(), '" . $vendors_id . "')");

(Note the MODULE_SHIPPING_INDVSHIP_STATUS_" . $vendors_id . "' in the above.)

 

You also need to get the value for $shipping in the quotes method. That needs to be retrieved from your shipping costs table for each of the products having the current $vendors_id. You can probably get some inspiration for that from the additions to the shopping_cart class that the individual shipping mod used. They could just as well be added here; I see no need for that code to be in the shopping cart.

 

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

For those of you who are not running the latest version of UPSXML, here is the shipping delay code to use with the older version (the RC4 release):

 

find

 

if (constant('SHIPPING_DAYS_DELAY_' . $vendors_id) > 0) {
	$shipdate = date("Ymd", time()+(86400*constant('SHIPPING_DAYS_DELAY_' . $vendors_id)));
  } else {
	$shipdate = $this->today;
  }

 

and replace it with this:

 

if (constant('SHIPPING_DAYS_DELAY_' . $vendors_id) > 0) {
		$day_of_the_week = date ("w", time()+(86400*constant('SHIPPING_DAYS_DELAY_' . $vendors_id)));
		switch ($day_of_the_week) {
		case 0: // order supposed to leave on Sunday => Monday
		$shipdate = date("Ymd", time()+(86400*constant('SHIPPING_DAYS_DELAY_' . $vendors_id)) + 86400);
		break;

		case 6: // order supposed to leave on Saturday => Monday
		$shipdate = date("Ymd", time()+(86400*constant('SHIPPING_DAYS_DELAY_' . $vendors_id)) + 172800);
		break;

		default:
		$shipdate = date("Ymd", time()+(86400*constant('SHIPPING_DAYS_DELAY_' . $vendors_id)));
		}
		} else {
	$shipdate = $this->today;
  }

 

This way is easier to follow and modify as switch does not rely anywhere near as much on curly braces as if/elseif does (I'm reading a book on PHP and learning how to do all sorts of crazy things :)).

 

If you want to add in extra days (for instance if you don't ship on Friday), just add in additional case statements. The values for "w" are 0-6, Sunday through Saturday, and the amount of seconds in a day is 86400. The case for Friday would be

 

case 5: // order supposed to leave on Friday => Monday
		$shipdate = date("Ymd", time()+(86400*constant('SHIPPING_DAYS_DELAY_' . $vendors_id)) + 259200);
		break;

 

I've dropped 7 from the case statements (it is included in the if/elseif version) as 7 is not a possible value for "w" that I'm aware of.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Ok Here is what I have:

 

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

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

// class constructor
function indvship() {
  global $order;
  $this->code = 'indvship';
  $this->title = MODULE_SHIPPING_INDVSHIP_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_INDVSHIP_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_INDVSHIP_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_INDVSHIP_TAX_CLASS;

//MVS
 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);
  }
  return $this->enabled;
}

function sort_order($vendors_id='1') {
  if (defined (@constant ('MODULE_SHIPPING_TABLE_SORT_ORDER_' . $vendors_id))) {
	$this->sort_order = @constant('MODULE_SHIPPING_TABLE_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_TABLE_TAX_CLASS_' . $vendors_id);
  return $this->tax_class;
}

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 = '" . $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

// class methods

  function quote($method = '', $module = '', $vendors_id = '1') {
  global $HTTP_POST_VARS, $shipping_price, $order, $cart, $shipping_num_boxes;

 			$product_ship = tep_db_query("products_ship_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	if ($product = tep_db_fetch_array($product_query)) {
	  $products_ship_price = $product['products_ship_price'];


	  $vendors_data_query = tep_db_query("select handling_charge, 
													 handling_per_box,
											  from " . TABLE_VENDORS . " 
											  where vendors_id = '" . (int)$vendors_id . "'"
										   	);
		  $vendors_data = tep_db_fetch_array($vendors_data_query); 	

		  $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;
		  }
	$this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,
												 'cost' => $shipping + $handling)));

  if ($this->tax_class($vendors_id) > 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 configuration_key = 'MODULE_SHIPPING_FLAT_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 Individual Shipping Prices', 'MODULE_SHIPPING_INDVSHIP_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer individual shipping prices?', '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, use_function, set_function, date_added, vendors_id) values ('Tax Class', 'MODULE_SHIPPING_INDVSHIP_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_INDVSHIP_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_INDVSHIP_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_INDVSHIP_STATUS_' . $vendors_id,  'MODULE_SHIPPING_INDVSHIP_TAX_CLASS_' . $vendors_id , 'MODULE_SHIPPING_INDVSHIP_ZONE_' . $vendors_id ., 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER_' . $vendors_id );
}
 }
?>

 

I'm not sure about:

// class methods

  function quote($method = '', $module = '', $vendors_id = '1') {
  global $HTTP_POST_VARS, $shipping_price, $order, $cart, $shipping_num_boxes;

 			$product_ship = tep_db_query("products_ship_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	if ($product = tep_db_fetch_array($product_query)) {
	  $products_ship_price = $product['products_ship_price'];

 

and:

		$this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,
												 'cost' => $shipping + $handling)));

 

 

Do I need to specify this in this code that it needs to be multiplied by the number of products? That is probable done in the shopping cart stuff though?

Share this post


Link to post
Share on other sites
I'm not sure about:

	 			$product_ship = tep_db_query("products_ship_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

That won't work. $products_id is not available here. You'll need to loop through the products in the cart and add the costs, if the product is in the Individual Ship table. The rest of your code looks OK, although I haven't tested it.

 

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, I have one more question before I dive into shipping.

 

If I do the Multi-Vendor contribution since I use drop shippers, do I need to activate the USPS and UPS modules in the Admin Panel?

 

I don't want to activate something that will be in the contribution and totally mess something up. Since I'm still new to PHP, I don't understand the language well enough to spot errors and such.

 

The ONLY contribution I have installed is the Header Tag one.

 

Since this is a long install for the Multi Vendor contribution, I want to make sure my ducks are in a row before diving in.

 

QUACK! LOL


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites
Ok, I have one more question before I dive into shipping.

 

If I do the Multi-Vendor contribution since I use drop shippers, do I need to activate the USPS and UPS modules in the Admin Panel?

 

I don't want to activate something that will be in the contribution and totally mess something up. Since I'm still new to PHP, I don't understand the language well enough to spot errors and such.

 

The ONLY contribution I have installed is the Header Tag one.

 

Since this is a long install for the Multi Vendor contribution, I want to make sure my ducks are in a row before diving in.

 

QUACK! LOL

 

If you use MVS, none of the shipping modules you currently have installed will be used. They can be installed, uninstalled, deleted, whatever, it won't matter, unless you turn MVS off.

 

Once you have MVS running you can use any of the shipping modules that are included. You'll have to activate at least one module per vendor in order to charge people for shipping.


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

Thank you for that clear explanation.

 

*deep breath* ....... Ok, I'll procrastinate for a lil longer LOL.

 

Shipping and SSL are my last hurdles to tackle before officially opening up.

 

I think.....


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites

OK Craig and Jim

 

I have the new version of UPSXML R & R working for the most part. I have three issues left that I can't seem to resolve and was hoping you could help.

 

For the insurance part it is supposed to pull the order subtotal and send that amouint in the request. This works in the stand alone version yet I get an empty result from the MVS version.

 

Second, and I think completely related, I am trying to get the store owners email address in the MVS so that it can email errors to the Store owner. It works in the stand alone version but not in the MVS version.

 

Lastly, it is sending duplicate requests again and in the duplicate request it doubles the items from that vendor. I remember this happening in the other MVS version and we had to set or unset a variable to clear this. Just don't remember exactly what we did. BTW it reports the correct rate and not the doubled rat so it isn't that big a bug.

Share this post


Link to post
Share on other sites
That won't work. $products_id is not available here. You'll need to loop through the products in the cart and add the costs, if the product is in the Individual Ship table. The rest of your code looks OK, although I haven't tested it.

 

Regards

Jim

 

 

Hey Jim, I think I have it working but I can't test it because I can't seem to get MVS working before I even add it. I did have to do some mods to the shopping_cart.php. I basically added another column to products that the shopping cart calls like price and weight. Then had the shopping cart total it, so that I can set it as a global in the includes/modules/vendors_shipping/indvship.php

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

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

//MVS
 //  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'indvship';
  $this->title = MODULE_SHIPPING_INDVSHIP_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_INDVSHIP_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 = 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER_' . $vendors_id;
				 if (defined($sort_order)) 
				 	{ $this->sort_order = constant($sort_order);
					} 
				 else 
				 	{ $this->sort_order = '-';
					}
				 return $this->sort_order;
			   }

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

		  function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_INDVSHIP_STATUS_' . $vendors_id);
					if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_INDVSHIP_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_INDVSHIP_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_INDVSHIP_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 = '" . MODULE_SHIPPING_INDVSHIP_ZONE . "' 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, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
  global $order, $total_count, $shipping_weight, $shipping_num_boxes, $shiptotal;

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

//MVS - Changed 'cost' => $shiptotal + $handling
  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,
												 'cost' => $shiptotal + $handling)));
// $this->tax_class = constant(MODULE_SHIPPING_INDVSHIP_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)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INDVSHIP_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 Item Shipping', 'MODULE_SHIPPING_INDVSHIP_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer individual 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 ('Handling Fee', 'MODULE_SHIPPING_INDVSHIP_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_INDVSHIP_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_INDVSHIP_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_INDVSHIP_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 configuration_key in ('" . implode("', '", $this->keys($vendors_id)) . "')");
  }

function keys($vendors_id) {
  return array('MODULE_SHIPPING_INDVSHIP_STATUS_' . $vendors_id, 'MODULE_SHIPPING_INDVSHIP_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_INDVSHIP_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_INDVSHIP_ZONE_' . $vendors_id, 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER_' . $vendors_id);
}
 }
?>

 

here are the changes to shopping cart.php

// mod indvship var $shiptotal;
 class shoppingCart {
var $contents, $total, $weight, $cartID, $content_type,$shiptotal;
................................................................................
......................................................
function reset($reset_database = false) {
  global $customer_id;

  $this->contents = array();
  $this->total = 0;
  $this->weight = 0;
  // mod indvship
  $this->shiptotal = 0;
  // end indvship
  $this->content_type = false;
................................................................................
........................................................
$product_query = tep_db_query("select products_id, products_price, products_ship_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	if ($product = tep_db_fetch_array($product_query)) {
	  $prid = $product['products_id'];
	  $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
	  $products_price = $product['products_price'];
	  $products_weight = $product['products_weight'];
	  // mod indvship
	  $products_ship_price = $product['products_ship_price'];
	  // end indvship
	  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }
	  $this->total += tep_add_tax($products_price, $products_tax) * $qty;
	  // mod indvship
	  $this->shiptotal += ($products_ship_price * $qty);
	  // end indvship
	  $this->weight += ($qty * $products_weight);
	}

 

and here is the language file:

define('MODULE_SHIPPING_INDVSHIP_TEXT_TITLE', 'Individual Shipping');
define('MODULE_SHIPPING_INDVSHIP_TEXT_DESCRIPTION', 'Shipping and Handling');
define('MODULE_SHIPPING_INDVSHIP_TEXT_WAY', 'Shipping Rate');
?>

 

Now my problem is testing it properly. I can't seem to get MVS showing the right shipping values in the cart? And I don't want to add my files until I am sure that MVS works correctly. The cart keeps showing regular shipping mods values rather than the MVS shipping. Do I need to Enable or Disable something. I am using a fresh install of OSC with a fresh install of MVS? Sorry this is such a long post. :(

Share this post


Link to post
Share on other sites

Oops forgot the SQL update for database:

ALTER TABLE `products` ADD `products_ship_price` decimal(15,2) NOT NULL default '0.00';

 

I know we were talking about a new table for the shipping values, but this was how I could see to do it. I think the way I did it every product would have to have this field even if its' value is 0.00. :)

Share this post


Link to post
Share on other sites
For the insurance part it is supposed to pull the order subtotal and send that amouint in the request. This works in the stand alone version yet I get an empty result from the MVS version.

 

Second, and I think completely related, I am trying to get the store owners email address in the MVS so that it can email errors to the Store owner. It works in the stand alone version but not in the MVS version.

 

Lastly, it is sending duplicate requests again and in the duplicate request it doubles the items from that vendor. I remember this happening in the other MVS version and we had to set or unset a variable to clear this. Just don't remember exactly what we did. BTW it reports the correct rate and not the doubled rat so it isn't that big a bug.

For the order subtotal for the current vendor try:

$subtotal = $cart->vendor_shipping[$vendors_id]['cost'];

The value that would be used in standard osC is not necessarily filled with MVS.

 

For the store owner's email address, the constant STORE_OWNER_EMAIL_ADDRESS should still work. We didn't change that at all.

 

I have no idea what is causing your duplicate emails. You may need to reset the variables in order to prevent them from getting used twice, but I don't know why it should be sending the email twice anyway. I probably need to take another look at the email code.

 

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
Oops forgot the SQL update for database:

ALTER TABLE `products` ADD `products_ship_price` decimal(15,2) NOT NULL default '0.00';

 

I know we were talking about a new table for the shipping values, but this was how I could see to do it. I think the way I did it every product would have to have this field even if its' value is 0.00. :)

Adding the shipping cost to the Products table will work just fine. A separate table might be more efficient, but it would also complicate the code, particularly the Admin side.

 

You should get MVS working before you try this. We'll try to help if you get stuck. It is a big mod, so it's pretty easy to mess something up.

 

Your code is almost working. The changes to shopping_cart.php will give you a total for all products that have a shipping cost set. If you only have one vendor using this module then that will give the correct result. If you try to add a second vendor it will fail, since all products in the cart will be added to the total, not just the current vendor. I would suggest modifying the vendor_shipping method of the Cart class instead. Starting on line 291 of shopping_cart.php:

		$products_query = tep_db_query("select products_id, 
										   products_price, 
										   products_ship_price,
										   products_tax_class_id, 
										   products_weight, 
										   vendors_id 
									from " . TABLE_PRODUCTS . " 
									where products_id = '" . (int)$products_id . "'"
								  );
	if ($products = tep_db_fetch_array($products_query)) {
	  $products_price = $products['products_price'];
	  $products_ship_price = $products['products_ship_price'];
	  $products_weight = $products['products_weight'];
	  $vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id']; 
	  $products_tax = tep_get_tax_rate($products['products_tax_class_id']);

	  //Find special prices (if any)
	  $specials_query = tep_db_query("select specials_new_products_price 
									  from " . TABLE_SPECIALS . " 
									  where products_id = '" . (int)$products_id . "' 
										and status = '1'"
									);
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }

	  //Add values to the output array
	  $this->vendor_shipping[$vendors_id]['weight'] += ($quantity * $products_weight);
	  $this->vendor_shipping[$vendors_id]['ship_cost'] += ($quantity * $products_ship_price);
	  $this->vendor_shipping[$vendors_id]['cost'] += tep_add_tax($products_price, $products_tax) * $quantity;
	  $this->vendor_shipping[$vendors_id]['qty'] += $quantity;
	  $this->vendor_shipping[$vendors_id]['products_id'][] = $products_id; //There can be more than one product
	}

Then in indvship.php, change the beginning of the quote method to add the Cart class to the globals and define the value:

//Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
global $order, $total_count, $shipping_weight, $shipping_num_boxes, $cart;
$shiptotal =  $cart->vendor_shipping[$vendors_id]['ship_cost'];

That should work for any number of vendors. I haven't tested this, so beware of lurking typos.

 

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 Craig and Jim

 

I have the new version of UPSXML R & R working for the most part. I have three issues left that I can't seem to resolve and was hoping you could help.

 

For the insurance part it is supposed to pull the order subtotal and send that amouint in the request. This works in the stand alone version yet I get an empty result from the MVS version.

 

Second, and I think completely related, I am trying to get the store owners email address in the MVS so that it can email errors to the Store owner. It works in the stand alone version but not in the MVS version.

 

Lastly, it is sending duplicate requests again and in the duplicate request it doubles the items from that vendor. I remember this happening in the other MVS version and we had to set or unset a variable to clear this. Just don't remember exactly what we did. BTW it reports the correct rate and not the doubled rat so it isn't that big a bug.

Ok Marc, email me a copy and I may have time to look at it this weekend. Great work on this BTW.

 

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
Ok Marc, email me a copy and I may have time to look at it this weekend. Great work on this BTW.

 

Craig :)

Craig thanks for that I had come by that earlier once I had figured out that I stupidly forgotten to set the global variable.:blink: I still can't figure out why it isn't sending an email. Not that important as I'm sure not many store owners would know what to do with the error email anyway.

 

The XML requests are what is being sent twice both the rate request and time in transit, yet, only the rate request is showing double items in the second request that it sends.

 

Since all the right info is being used in the end, this is just me being a perfectionnist and the fact that I don't like things happening for no apparent reason.

Edited by HallMarc

Share this post


Link to post
Share on other sites
The XML requests are what is being sent twice both the rate request and time in transit, yet, only the rate request is showing double items in the second request that it sends.

I think I've figured this one out. Find this code in upsxml.php (line 675):

		for ($i = 0; $i < $this->items_qty; $i++) {

		$ratingServiceSelectionRequestPackageContent .=
		"	   <Package>\n".

and add the following just before it:

		$ratingServiceSelectionRequestPackageContent = '';

That should stop the doubling of the quantities the second time through.

 

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
I think I've figured this one out. Find this code in upsxml.php (line 675):

		for ($i = 0; $i < $this->items_qty; $i++) {

		$ratingServiceSelectionRequestPackageContent .=
		"	   <Package>\n".

and add the following just before it:

		$ratingServiceSelectionRequestPackageContent = '';

That should stop the doubling of the quantities the second time through.

 

Regards

Jim

OK now that is wierd. I had tried that before and I didn't see nay change. THis time it worked. Still sending double requests yet the request remains the same both times now. B)

Share this post


Link to post
Share on other sites

Jim and Craig,

As I said all bugs seem to be worked out of the new UPSXML mod. In order for this new version to operate properly the new UPSXML Rates and Services mod supplied by JanZ must be downloaded and installed first.

http://www.oscommerce.com/community/contri...l/search,upsxml

 

I am starting to see that the duplicate request bug is happening across all modules in MVS so noe I am thinking that the function is being called twice from the shipping page. I don't really know and I am just guessing. The other time we discussed a similar issue was with BAX and it too was doubling and tripleing cart contents. This was due to an array not being set initially. We never found a solution to the double request issue.

 

This is a minor bug as it doesn't cause any pricing issues. The only negative effect would be the time involved in asking for the rates and EDDs. Their API seems relativley fast so the time saved would be maybe one second.

 

Thanks again to everyone who has worked so hard to make this a reality. Special thanks to Craig and Jim.

Edited by HallMarc

Share this post


Link to post
Share on other sites
I am starting to see that the duplicate request bug is happening across all modules in MVS so noe I am thinking that the function is being called twice from the shipping page. I don't really know and I am just guessing. The other time we discussed a similar issue was with BAX and it too was doubling and tripleing cart contents. This was due to an array not being set initially. We never found a solution to the double request issue.

The issue with the BAX module was similar because some of the code in the BAX module was adapted from UPSXML. However, the BAX API only allows a single class of service per quote, so the quote request must be made several times to get all of the rate classes. UPSXML allows multiple rate classes in a single request, so there should only be one rate request (and a separate request for delivery times if this is being used.)

 

If we are sending duplicate rate requests then there is probably a bug in MVS. I'll try to take a look at this once I've got my search engine tamed.

 

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

×