Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Hey Guys,

 

Quick question….. I’m trying to understand if this contribution will do what my client needs.

 

The site now uses USPS flat rate shipping but my client want to add a drop ship program for furniture where each piece has a single flat rate specific to the item regardless of location.

 

Is this possible with MVS

 

Any advise is appreciated.

Link to comment
Share on other sites

Not sure if this is a PHP5/MySQL5 compatibility issue, but prior to upgrading my server I didn't get this error.

 

When I log on as my test customer and go to Account > Order History and click View to view an order, I get an empty box where the order information should be. In my log file I get this error message...

PHP Fatal error:  Using $this when not in object context in /var/www/catalog/includes/classes/vendor_order_data.php on line 17, referer: https://secure.rlknight.com/account_history.php

 

This is the code (catalog/includes/classes/vendor_order_date.php) at line 17 and immediately after...

	$this->products[$index2] = array('Vid' => $vendor_order['vendors_id'],
									   'Vname' => $vendor_order['vendors_name'],
										'Vmodule' => $vendor_order['shipping_module'],
										'Vmethod' => $vendor_order['shipping_method'],
										'Vcost' => $vendor_order['shipping_cost'],
										'Vship_tax' => $vendor_order['shipping_tax'],
										'Vnoname' => 'Shipper',
										 'spacer' => '-');

 

Can someone help me solve this?

 

Thanks,

Rick

 

P.S. Sorry for the double post. The original post was to the wrong place.

Link to comment
Share on other sites

Yikes! The forum isn't sending me update notices. Again. Let me try to catch up here....

 

Rick: Change all instances of $this->products to $these_products in that file.

 

oxdog: You should be able to do that using the Individual Shipping mod along with MVS. You could also just use Individual Shipping without MVS, but that would be less flexible and harder to maintain.

 

drillsar: Looks like a code file was loaded to includes/languages/.... Try reloading all of your shipping modules, including the language files, and be careful to get them in the right places.

 

EricK: I have no idea where it's getting that. I can't find anything in stock osCommerce that would generate that array. Oh well, just change it anyway. Change all instances of $line in that file to $sort_by_filter. And hope that nobody's used that for a global variable. Sigh.

 

Regards

Jim

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

Link to comment
Share on other sites

Rick: Change all instances of $this->products to $these_products in that file.

 

Regards

Jim

 

Jim,

 

You are my hero!

 

Replacing $this->products with $these_products got me a little further. I ended up also replacing $this->info with $these_info in both vendor_order_data.php and vendor_order_info.php. Now all seems to be OK.

 

Thanks again Jim,

 

Rick

Link to comment
Share on other sites

Sorry, I seem to have forgotten where all the variables were that needed to be changed. I really need to update this thing. Maybe I can find the time to put together a rollup. Yeah, right.

 

That's not all I forgot. I just downloaded a module I've never used before. The instructions have my initials on Version 1.0. Apparently the inside of my mind is a very strange place.

 

Regards

Jim

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

Link to comment
Share on other sites

Yikes! The forum isn't sending me update notices. Again. Let me try to catch up here....

 

Rick: Change all instances of $this->products to $these_products in that file.

 

oxdog: You should be able to do that using the Individual Shipping mod along with MVS. You could also just use Individual Shipping without MVS, but that would be less flexible and harder to maintain.

 

drillsar: Looks like a code file was loaded to includes/languages/.... Try reloading all of your shipping modules, including the language files, and be careful to get them in the right places.

 

EricK: I have no idea where it's getting that. I can't find anything in stock osCommerce that would generate that array. Oh well, just change it anyway. Change all instances of $line in that file to $sort_by_filter. And hope that nobody's used that for a global variable. Sigh.

 

Regards

Jim

 

Wow! Craziness here. Thanks Kymation for the feedback......

 

- ox

Link to comment
Share on other sites

Fix for mysql errors in prods_by_vendor.php:

EricK: Change all instances of $line in that file to $sort_by_filter. And hope that nobody's used that for a global variable. Sigh.

Regards

Jim

Thank you Jim! That did it. I also replaced all instances of $line in the orders_by_vendor.php file and that report is also fixed.

 

So, was this a register_globals= off problem?

 

Thanks again,

EricK

Link to comment
Share on other sites

Fix for mysql errors in prods_by_vendor.php:

 

Thank you Jim! That did it. I also replaced all instances of $line in the orders_by_vendor.php file and that report is also fixed.

 

So, was this a register_globals= off problem?

 

Thanks again,

EricK

Yes. MVS is a massive set of changes with a lot of tricky mods to the core osCommerce code. Sometimes we lost track of whether a variable had been defined on that particular page. This didn't matter as much on the Admin side, which is supposed to be secured, and didn't even show up when Register Globals was turned on. Newer versions of osCommerce and PHP have uncovered a few holes in the code. It would be a good idea to go through the whole MVS codebase and look for things like this. If I only had the time....

 

Regards

Jim

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

Link to comment
Share on other sites

Jim,

The only other MVS error I see is on checkout_shipping.php using uspsxml.php. I get rates and checkout, but this PHP Warning is displayed on checkout_shipping.php:

 

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_UPSXML_INSURE_ in

/home/username/htdocs/includes/modules/vendors_shipping/upsxml.php on line 420

 

The error goes away if in upsxml.php I replace all instances of:

OLD CODE = 'MODULE_SHIPPING_UPSXML_INSURE_' . $vendor_id

NEW CODE = 'MODULE_SHIPPING_UPSXML_INSURE_' . $vendors_id

 

But then I get the dreaded "ERROR_NO_SHIPPING_SELECTED_SELECTED" and can't checkout.

 

What is the difference between $vendor_id and $vendors_id?

 

Thanks again,

EricK

Edited by EricK
Link to comment
Share on other sites

I think I found my problem but I dont know how to fix it:

 

When I click on manage vendor in admin

 

I get this error:

 

Fatal error: Cannot redeclare class bax in /var/www/html/includes/modules/vendors_shipping/bax.php on line 14

 

it happens with all shipping patterns, I have a heavily modded site,

 

Please help im going nuts here

Link to comment
Share on other sites

Jim,

The only other MVS error I see is on checkout_shipping.php using uspsxml.php. I get rates and checkout, but this PHP Warning is displayed on checkout_shipping.php:

 

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_UPSXML_INSURE_ in

/home/username/htdocs/includes/modules/vendors_shipping/upsxml.php on line 420

 

The error goes away if in upsxml.php I replace all instances of:

OLD CODE = 'MODULE_SHIPPING_UPSXML_INSURE_' . $vendor_id

NEW CODE = 'MODULE_SHIPPING_UPSXML_INSURE_' . $vendors_id

 

But then I get the dreaded "ERROR_NO_SHIPPING_SELECTED_SELECTED" and can't checkout.

 

What is the difference between $vendor_id and $vendors_id?

 

Thanks again,

EricK

The difference is a lack of consistency in the coding. $vendor_id is used in a few places, $vendors_id is used in most. Doing a global replace would probably improve things. In any case, you need to use whichever one is being set by the code. $vendors_id appears to be correct here.

 

When you get the "no shipping selected" error, have you actually selected a shipping method for all vendors? If you have, search this thread for the constant you mentioned; there are several problems that can cause this.

 

Regards

Jim

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

Link to comment
Share on other sites

I think I found my problem but I dont know how to fix it:

 

When I click on manage vendor in admin

 

I get this error:

 

Fatal error: Cannot redeclare class bax in /var/www/html/includes/modules/vendors_shipping/bax.php on line 14

 

it happens with all shipping patterns, I have a heavily modded site,

 

Please help im going nuts here

Have you verified that you have not uploaded the code file (bax.php) to the language directory?

 

Regards

Jim

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

Link to comment
Share on other sites

Hello All,

 

I am new to osCommerce. Unfortunately I have come onboard late enough that osCommerce Online Merchant v2.2 RC 2 is the downloaded version I have. RC 2 has numerous changes that make installing MVS 1.1 near impossible. Specifically changes in the Checkout_Shipping.php and Shopping_Cart.php. Others may exist but that is where I determined this wasn't matching up.

 

I need the functionality that MVS offers, as I will be primarily drop-shipping from vendors, who will also be processing the orders. What are my options?

 

Thanks for any assistance and thank you for the contribution!

Edited by MOyler
Link to comment
Share on other sites

Hello All,

 

I am new to osCommerce. Unfortunately I have come onboard late enough that osCommerce Online Merchant v2.2 RC 2 is the downloaded version I have. RC 2 has numerous changes that make installing MVS 1.1 near impossible. Specifically changes in the Checkout_Shipping.php and Shopping_Cart.php. Others may exist but that is where I determined this wasn't matching up.

 

I need the functionality that MVS offers, as I will be primarily drop-shipping from vendors, who will also be processing the orders. What are my options?

 

Thanks for any assistance and thank you for the contribution!

 

i installed it it works just use winmerge

Link to comment
Share on other sites

i installed it it works just use winmerge

 

How would I use winmerge to incorporate MVS 1.1 Contribution into osCommerce 2.2 RC2? Isn't that for comparing files for difference? All I have is the install read-mes for MVS 1.1 and an Installed copy of RC2. Sorry if it's a dumb question, just not picturing it in my head. I did download and install Winmerge, so just need a gentle prod in the right direction, I will flounder about from there ;)

 

Thanks!

Link to comment
Share on other sites

Well say there is a file checkout.php with osC, there will also be a file checkout.php with MVS if there are changes necessary to it to make MVS work. You use Winmerge to look at the differences in both files while at the same time you can merge missing/additional sections from the MVS file to the osC file.

 

Sometimes however just accepting all merges is not the brightest idea, you have to look at the code if it makes sense and maybe adjust it by hand. Good luck :)

Link to comment
Share on other sites

Well say there is a file checkout.php with osC, there will also be a file checkout.php with MVS if there are changes necessary to it to make MVS work. You use Winmerge to look at the differences in both files while at the same time you can merge missing/additional sections from the MVS file to the osC file.

 

Sometimes however just accepting all merges is not the brightest idea, you have to look at the code if it makes sense and maybe adjust it by hand. Good luck :)

 

aah, so no magic involved... it's just a fancier version of my Two text windows and cut -n- paste...Gotcha!

 

If I run into the problem where the osC file doesn't even contain the line I'm looking for, I still just look in that general vicinity and see what changed and try to make the adjustments. Good Times! :)

 

Thanks,

Edited by MOyler
Link to comment
Share on other sites

I still need help!

 

I'm trying to modifiy my shipping module for MVS... It must work... but no. :huh:

 

So, i keep working on it but if someone could have a glimpse on it....

 

Error: everything is displayed except the right price. It keep displaying 0.00 >_<

 

First, I give you the entire code

 

<?php


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

// class constructor
function colissimo() {
//MVS
  $this->vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id'];
  $this->code = 'colissimo';
  $this->description = MODULE_SHIPPING_COLISSIMO_TEXT_DESCRIPTION;
  $this->title = MODULE_SHIPPING_COLISSIMO_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_COLISSIMO_TEXT_DESCRIPTION;
  $this->icon = DIR_WS_ICONS . 'colissimo.gif'; // ou shipping_laposte.gif au choix
}
//MVS Start
			function zones($vendors_id='1') {
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_COLISSIMO_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_COLISSIMO_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

			function sort_order($vendors_id='1') {
 $sort_order = @constant ('MODULE_SHIPPING_COLISSIMO_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_COLISSIMO_TAX_CLASS_' . $vendors_id);
					return $this->tax_class;
}

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

//Set the number of zones used for this vendor
			function num_zones($vendors_id='1') {

  $vendors_data_query = tep_db_query("select zones
									  from " . TABLE_VENDORS . "
									  where vendors_id = '" . (int)$vendors_id . "'"
									);
  $vendors_data = tep_db_fetch_array($vendors_data_query);
  $this->num_zones = $vendors_data['colissimo'];
					return $this->num_zones;
}
//MVS End

//Get a quote
function quote($method = '', $module = '', $vendors_id = '1') {

  global $order, $cart, $shipping_weight, $shipping_num_boxes;
//MVS Start
//return an error if the module is not enabled for this vendor
  if ($this->enabled($vendors_id) < 1) {
	$this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;
	return $this->quotes;
  }
//MVS End


  $dest_country = $order->delivery['country']['iso_code_2'];
  $postcode = $order->delivery['postcode'];
  $store_postcode = constant('MODULE_SHIPPING_COLISSIMO_STORE_POSTCODE');
  $error = false;


  if (($dest_country != 'FR') && ($dest_country != 'FX')) {
$this->quotes['error'] = MODULE_SHIPPING_COLISSIMO_INVALID_ZONE;
  } else {
   // Colissimo MVS Start
	   $vendors_data_query = tep_db_query("select vendors_zipcode
										  from " . TABLE_VENDORS . "
										  where vendors_id = '" . (int)$vendors_id . "'"
										);
	  $vendors_data = tep_db_fetch_array($vendors_data_query);

	  //Choisir entre Colissimo Intra ou Extra
	  $colissimo_cost = $vendors_data['vendors_zipcode'];
	 if (substr($postcode, 0, 2) == substr($store_postcode, 0, 2)) {
	$colissimo_cost = constant('MODULE_SHIPPING_COLISSIMO_INTRA_' . $vendors_id);
		  } else {
	$colissimo_cost = constant('MODULE_SHIPPING_COLISSIMO_EXTRA_' . $vendors_id);
	   } 

// Colissimo MVS End 
	$colissimo_table = split("[:,]" , $colissimo_cost);
	$size = sizeof($colissimo_table);
	for ($i=0; $i<$size; $i+=2) {
	  if ($shipping_weight <= $colissimo_table[$i]) {
		$shipping = $colissimo_tables[$i+1];
		$shipping_method = MODULE_SHIPPING_COLISSIMO_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_COLISSIMO_TEXT_UNITS;





//MVS Start
	  $vendors_data_query = tep_db_query("select handling_charge
										  from " . TABLE_VENDORS . "
										  where vendors_id = '" . (int)$vendors_id . "'"
										);
	  $vendors_data = tep_db_fetch_array($vendors_data_query);

	  //Set handling to the handling per box times number of boxes, or handling charge if it is larger
	  $handling_charge = $vendors_data['handling_charge'];

	  //Set handling to the module's handling charge if it is larger
	  $module_handling = constant('MODULE_SHIPPING_COLISSIMO_HANDLING_' . $vendors_id);
	  if ($module_handling > $handling) {
		$handling = $module_handling;
	  }
	  $shipping_cost = $shipping + $handling;
	  }
//MVS End


	}
}
  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_COLISSIMO_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => $shipping_method,
												 'cost' => $shipping_cost)));

if ($shipping = 0) {   
$shipping_cost = 350000;
return $this->quotes;
}   								

// Pas possible de livrer 
if ($shipping_weight > 30) {
$this->quotes['error'] = MODULE_SHIPPING_COLISSIMO_TOO_HEAVY;
return $this->quotes;
 }



$this->tax_class = constant('MODULE_SHIPPING_COLISSIMO_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 ($error == true) $this->quotes['error'] = MODULE_SHIPPING_COLISSIMO_INVALID_ZONE;

  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_COLISSIMO_STATUS_" . $vendors_id . "'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install($vendors_id='1') {
		$vID = $vendors_id;
		//multi vendor add 'vendors_id' to field names and '" . $vID . "', to values
  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 ('Valider Colissimo', 'MODULE_SHIPPING_COLISSIMO_STATUS_" . $vendors_id . "', 'True', 'Activer / Désactiver Colissimo sans perdre les valeurs changées', '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 ('Colissimo intradépartement', 'MODULE_SHIPPING_COLISSIMO_INTRA_" . $vendors_id . "', '0.250:5.15, 0.5:5.90, 0.75:6.55, 1:7.05, 1.5:7.70, 2:7.70, 3:8.30, 4:8.90, 5:9.50, 6:10.10, 7:10.70, 8:11.30, 9:11.90, 10:12.50, 15:14.30, 30:19.10', 'Port basé sur le poids total des produits, tarif intradépartemental. Exemple: 1:3.50,2:5.50,etc.. Jusqu\'à 1 Kg facturé 3.50, jusqu\'à 2 Kg, 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, date_added, vendors_id) values ('Colissimo extradépartement', 'MODULE_SHIPPING_COLISSIMO_EXTRA_" . $vendors_id . "', '0.250:5.35, 0.5:6.10, 0.75:6.75, 1:7.25, 1.5:7.90, 2:7.90, 3:8.50, 4:9.10, 5:9.70, 6:10.30, 7:10.90, 8:11.50, 9:12.10, 10:12.70, 15:14.50, 30:19.30', 'Port basé sur le poids total des produits, tarif extradépartemental. Exemple: 1:4.50, 2:6.50, etc. Jusqu\'à 1 Kg facturé 4.50, jusqu\'à 2 Kg , 6.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, use_function, set_function, date_added, vendors_id) values ('Shipping Zone', 'MODULE_SHIPPING_COLISSIMO_ZONE_" . $vendors_id . "', '0', 'If a zone is selected, only enable Store Pickup 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 ('Frais d\'emballage', 'MODULE_SHIPPING_COLISSIMO_HANDLING_" . $vendors_id . "', '0', 'Définir le cout fixe d\'emballage', '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 ('Code TVA', 'MODULE_SHIPPING_COLISSIMO_TAX_CLASS_" . $vendors_id . "', '0', 'Choisir le code TVA en fonction du taux', '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, date_added, vendors_id) values ('Code postal', 'MODULE_SHIPPING_COLISSIMO_STORE_POSTCODE_" . $vendors_id . "', '78100', 'Code postal de la boutique', '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, vendors_id) values ('Ordre de tri', 'MODULE_SHIPPING_COLISSIMO_SORT_ORDER_" . $vendors_id . "', '0', 'Définir l\'ordre d\'affichage', '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, vendors_id) values ('Descriptif au choix', 'MODULE_SHIPPING_COLISSIMO_SHIP_TEXT_" . $vendors_id . "', 'Vous recevrez par mail votre numéro de suivi de colis', 'Le client pourra voir ce descriptif', '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_COLISSIMO_STATUS_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_INTRA_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_EXTRA_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_ZONE_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_HANDLING_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_TAX_CLASS_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_STORE_POSTCODE_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_SORT_ORDER_' . $vendors_id, 'MODULE_SHIPPING_COLISSIMO_SHIP_TEXT_' . $vendors_id);


//MVS End


}
 }
?>

 

Then, here is the concerned code (i guess):

 

 

   $dest_country = $order->delivery['country']['iso_code_2'];
  $postcode = $order->delivery['postcode'];
  $store_postcode = constant('MODULE_SHIPPING_COLISSIMO_STORE_POSTCODE');
  $error = false;


  if (($dest_country != 'FR') && ($dest_country != 'FX')) {
$this->quotes['error'] = MODULE_SHIPPING_COLISSIMO_INVALID_ZONE;
  } else {
   // Colissimo MVS Start
	   $vendors_data_query = tep_db_query("select vendors_zipcode
										  from " . TABLE_VENDORS . "
										  where vendors_id = '" . (int)$vendors_id . "'"
										);
	  $vendors_data = tep_db_fetch_array($vendors_data_query);

	  //Choisir entre Colissimo Intra ou Extra
	  $colissimo_cost = $vendors_data['vendors_zipcode'];
	 if (substr($postcode, 0, 2) == substr($store_postcode, 0, 2)) {
	$colissimo_cost = constant('MODULE_SHIPPING_COLISSIMO_INTRA_' . $vendors_id);
		  } else {
	$colissimo_cost = constant('MODULE_SHIPPING_COLISSIMO_EXTRA_' . $vendors_id);
	   } 

// Colissimo MVS End 
	$colissimo_table = split("[:,]" , $colissimo_cost);
	$size = sizeof($colissimo_table);
	for ($i=0; $i<$size; $i+=2) {
	  if ($shipping_weight <= $colissimo_table[$i]) {
		$shipping = $colissimo_tables[$i+1];
		$shipping_method = MODULE_SHIPPING_COLISSIMO_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_COLISSIMO_TEXT_UNITS;





//MVS Start
	  $vendors_data_query = tep_db_query("select handling_charge
										  from " . TABLE_VENDORS . "
										  where vendors_id = '" . (int)$vendors_id . "'"
										);
	  $vendors_data = tep_db_fetch_array($vendors_data_query);

	  //Set handling to the handling per box times number of boxes, or handling charge if it is larger
	  $handling_charge = $vendors_data['handling_charge'];

	  //Set handling to the module's handling charge if it is larger
	  $module_handling = constant('MODULE_SHIPPING_COLISSIMO_HANDLING_' . $vendors_id);
	  if ($module_handling > $handling) {
		$handling = $module_handling;
	  }
	  $shipping_cost = $shipping + $handling;
	  }
//MVS End


	}
}
  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_COLISSIMO_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => $shipping_method,
												 'cost' => $shipping_cost)));

 

I intend to add this mod to the contrib (if it works of course). Most of french users use this one but nobody has modified it !

 

Just tell me if something is hardly wrong in this code. Thanks!

Edited by damdamletouffu
Link to comment
Share on other sites

Jim,

 

I'm trying to modify the newer USPS shipping module, 2.9.5, to work with MVS-1.1 and I've run into a couple of problems I can't seem to solve.

 

In Admin >Vendors>Vendor Manager>Manage every thing looks like it's working properly except the sort order. I want sort order 20 and the DB table shows 20, but the form in Manage stays at 0. I can tell that everything in the DB is being updated from the form, so I guess the form just isn't populating properly.

 

When I run a test checkout, when I get to Shipping Method, I get these errors...

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_INSURE_ in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 177

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_OPTIONS_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 388

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_USERID_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 391

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_PASSWORD_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 391

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_TYPES_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 402

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_SERVER_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 458

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_INSURE_ in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 177

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_OPTIONS_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 388

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_USERID_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 391

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_PASSWORD_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 391

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_TYPES_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 402

Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_USPS_SERVER_1 in /var/www/catalog_live/includes/modules/vendors_shipping/usps.php on line 458

 

I think I have made all the right changes to the original module, but I must have missed something somewhere. If I send you the usps.php file, by email or on the forum, can you take a quick look at it for me?

 

Thanks,

Rick Knight

Link to comment
Share on other sites

Guys, take a look at new contribution "eShipper Integration Module for shipping with Canada Post, UPS, Fedex, Purolator, DHL and UPS" (http://addons.oscommerce.com/info/5711)

This may change the way you look at all separate shipping contribution. We are using eShipper solution for more than two years and could find nothing, but advantage:

1) Rates are cheapest (Canada Post rated dropped 3 times comparing to when we had our own account, Fedex prices are just unbelievably low)

2) All major vendors in single solution (currently they support Canada Post, UPS, Fedex, DHL/Purolator, trucking through the same unified interface)

3) If you ever need fulfilling (storage, packing and distribution solution), you have it for unbelievably low price with eShipper.

4) No need to integrate all shipping modules separately (and we did it all - Fedex, Canada Post, Local Pickup, Flat Rate, UPSXML etc.) - nightmare with each one of them, including discussed in this forum.

 

And, preventing your questions (few people asked about it) we do not earn _anything_ from promoting this module or using this service. Dream sometimes come true when you look around. The module is free, account with them is free. Integration code is there. You have nothing to loose to try. I guarantee to support this module to full extend.

 

Have fun!

 

 

Shimon ([email protected]) You may see how it works at our website http://www.onlybestrated.com

Link to comment
Share on other sites

Ack! Stupid thing isn't notifying me again....

 

macombmarineparts: I'm working on that module right now (I need to have estimates on individual products from the product page as well as the full cart) and I don't see that problem. What modules do you have installed? Remove everything that requires an external server (USPS, UPS, FedEx, etc.) and try with the internal modules (e.g. Fixed Rate) only. You could be seeing a connection delay from the external server.

 

Rick: The first error in that stack indicates that the constant is not getting the $vendors_id added onto the end. That definitely needs to be fixed. For the rest, the first thing I would do is uninstall and reinstall the module. If that doesn't do it, look at the install method -- are all of the constants correct, including the $vendors_id part?

 

damdamletouffu: I don't see anything wrong, at least on a quick runthrough. I'll take another look in a bit.

 

Regards

Jim

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

Link to comment
Share on other sites

<snip>

Just tell me if something is hardly wrong in this code. Thanks!

A couple of things:

 

Line 129: $colissimo_tables should be $colissimo_table -- that's probably the error that is causing you to not get a price.

 

Line 144: $handling_charge should be $handling -- that will just miss the handling charge in certain cases.

 

Please let us know if this works or not.

 

Regards

Jim

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

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