Jump to content



Latest News: (loading..)

* * * * * 8 votes

Multi_Vendor_Shipping new thread


  • Please log in to reply
4549 replies to this topic

#4541 ONLINE   lyonsperf

lyonsperf
  • Members
  • 305 posts
  • Real Name:Matt
  • Gender:Male
  • Location:CT

Posted 11 January 2013 - 08:58 PM

Works fine for flat rate.
If the only tool you have is a hammer, all your problems look like nails

#4542   kymation

kymation

    Believers

  • Community Sponsor
  • 6,682 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 11 January 2013 - 09:07 PM

You can just use the flat rate module and set the cost to 0. Change the title to Free Shipping and you're done.

I have no idea why the free shipping module doesn't work.

Regards
Jim
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support

#4543 ONLINE   lyonsperf

lyonsperf
  • Members
  • 305 posts
  • Real Name:Matt
  • Gender:Male
  • Location:CT

Posted 11 January 2013 - 09:22 PM

Here's the code I have
<?php
/*
  $Id$ freeamount.php 2
  Modified for MVS_1.2.3 2010/03/03 Motorcity
  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
  ----------------------------------------------
  ane - 06/02/02 - modified freecount.php to
  allow for freeshipping on minimum order amount
  originally written by dwatkins 1/24/02
  Modified BearHappy 09/04/04
  ----------------------------------------------
*/

  class freeamount {
	var $code, $title, $description, $icon, $enabled;
// class constructor
	function freeamount() {
	  global $order, $vendors_id;

	  $this->code = 'freeamount';
	  $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
	  $this->description = MODULE_SHIPPING_FREEAMOUNT_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') {
	  if (defined(@ constant('MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_' . $vendors_id))) {
		$this->sort_order = @ constant('MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_' . $vendors_id);
	  } else {
		$this->sort_order = '-';
	  }
	  return $this->sort_order;
   }
	function tax_class($vendors_id='1') {
	  $this->tax_class = constant('MODULE_SHIPPING_FREEAMOUNT_TAX_CLASS_' . $vendors_id);
	  return $this->tax_class;
	}
	function enabled($vendors_id='1') {
	  $this->enabled = false;
	  $status = @ constant('MODULE_SHIPPING_FREEAMOUNT_STATUS_' . $vendors_id);
	  if (isset ($status) && $status != '') {
		$this->enabled = (($status == 'True') ? true : false);
	  }
	  if (($this->enabled == true) && ((int) constant('MODULE_SHIPPING_FREEAMOUNT_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_FREEAMOUNT_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_FREEAMOUNT_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_FREEAMOUNT_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
		while ($check = tep_db_fetch_array($check_query)) {
		  if ($check['zone_id'] < 1) {
			$check_flag = true;
			break;
		  }
		  elseif ($check['zone_id'] == $order->delivery['zone_id']) {
			$check_flag = true;
			break;
		  } //if
		} //while
		if ($check_flag == false) {
		  $this->enabled = false;
		} //if
	  } //if
	  return $this->enabled;
	} //function
	//MVS End
// class methods
	function quote($method = '', $module = '', $vendors_id = '1') {
	  global $_POST, $order, $cart, $total_count, $shipping_weight, $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);
   $get_total = false;
   $get_weight = false;
	  $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;
	  }
	  $shipping = @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_COST_' . $vendors_id) + $handling;
	  //MVS End

	  if ($shipping_weight > @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX_' . $vendors_id)) {
		if (@[member='constant']('MODULE_SHIPPING_FREEAMOUNT_DISPLAY_' . $vendors_id) == 'False') return;
// This next line might be used by some sites, but most wouldn't want it by default. 
//	$this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_TOO_HEAVY . ' (' . $shipping_weight . ') ' . MODULE_SHIPPING_FREEAMOUNT_TEXT_UNIT;
  $get_weight = false;
	  } else {
	$get_weight = true;
   }
	  if ($cart->show_total() < @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_AMOUNT_' . $vendors_id)) {
		if (@[member='constant']('MODULE_SHIPPING_FREEAMOUNT_DISPLAY_' . $vendors_id) == 'False') return;
	   $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR . ' (' . @[member='constant']('MODULE_SHIPPING_FREEAMOUNT_AMOUNT_' . $vendors_id) . ') ';
  $get_total = false;
	  } else {
	 $get_total = true;
		
if (($get_total == true && $get_weight == true))
   {
	   $this->quotes = array('id' => $this->code,
							 'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE,
							 'methods' => array(array('id' => $this->code,
							 'title' => MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY,
							 'cost' => $shipping)));
  }
		}
	  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_FREEAMOUNT_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 Free Shipping with Minimum Purchase', 'MODULE_SHIPPING_FREEAMOUNT_STATUS_" . $vendors_id . "', 'True', 'Do you want to offer minimum order free shipping?', '6', '7', '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 ('Maximum Weight', 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX_" . $vendors_id . "', '10', 'What is the maximum weight you will ship?', '6', '8', 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 ('Enable Display', 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY_" . $vendors_id . "', 'True', 'Do you want to display text way if the minimum amount is not reached?', '6', '7', '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 ('Minimum Cost', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT_" . $vendors_id . "', '50.00', 'Minimum order amount purchased before shipping is free?', '6', '8', 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_FREEAMOUNT_SORT_ORDER_" . $vendors_id . "', '0', 'Sort order of display.', '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_FREEAMOUNT_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_FREEAMOUNT_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 . "')");
   }
	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_FREEAMOUNT_STATUS_' . $vendors_id,
'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX_' . $vendors_id,
'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER_' . $vendors_id,
'MODULE_SHIPPING_FREEAMOUNT_DISPLAY_' . $vendors_id,
'MODULE_SHIPPING_FREEAMOUNT_TAX_CLASS_' . $vendors_id,
'MODULE_SHIPPING_FREEAMOUNT_AMOUNT_' . $vendors_id,
'MODULE_SHIPPING_FREEAMOUNT_ZONE_' . $vendors_id
);
	}
  }
  ?>

If the only tool you have is a hammer, all your problems look like nails

#4544 ONLINE   lyonsperf

lyonsperf
  • Members
  • 305 posts
  • Real Name:Matt
  • Gender:Male
  • Location:CT

Posted 11 January 2013 - 09:23 PM

I need it to offer free shipping after a minimum is reached.
If the only tool you have is a hammer, all your problems look like nails

#4545   kymation

kymation

    Believers

  • Community Sponsor
  • 6,682 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 12 January 2013 - 12:12 AM

I don't see anything wrong. You'll have to debug it.

Regards
Jim
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support

#4546 ONLINE   lyonsperf

lyonsperf
  • Members
  • 305 posts
  • Real Name:Matt
  • Gender:Male
  • Location:CT

Posted 13 January 2013 - 03:39 PM

OK, after many winmerge compares of different free shipping mods and not finding a single difference, I finally found the answer.

If you enable free shipping in your admin panel/vendor section you must also go into admin panel-Modules-Order Total-Shipping, then click edit for the shipping line and change allow free shipping from true to false. This then allows the new MVS free shipping mod to enable!
Three days of work for one simple change!
Hope this helps someone else!
If the only tool you have is a hammer, all your problems look like nails

#4547   rwest

rwest
  • Members
  • 81 posts
  • Real Name:Ron West
  • Gender:Male
  • Location:WA

Posted 21 January 2013 - 03:38 PM

I hope someone here can help me.  My PHP programming skills are only adequate to install mods, test them, and implement them on my 2.2 rc2 site.  I have MVS 1.2.3 installed, and it has been working since it was released.  Last March I got myself in a crunch with the USPS Web Tools API change.  I was unable to get anything to work well, including any mods here.  Up against the clock, I found the USPS Rate V4 Intl Rate V2 thread, and mangaged (just barely) to get that mod to work for me.  The problem with that, that is still haunting me, is that installing it worked, the rates are correctly downloading from USPS, BUT after installation, I noticed that I could no longer go into my Modules admin.  All modules, not just shipping modules, just give me a blank white screen.  Again, rates work, but with the current situation I am unable to make any changes to any modules.  Everything else in admin displays perfectly, but I can't even click on modules in the admin box without the blank white page. I have looked through the code (to the best of my abilities) and can find no reason for this. My admin Vendors displays fine.

I am trying to fix this, but I don't know how to start. For one thing I can't use admin to remove or add modules.  I have backups of the previous files, so I would like to ask how to back out these changes long enough to install a working MVS/USPS V4 fix.

Ron

#4548   kymation

kymation

    Believers

  • Community Sponsor
  • 6,682 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 29 January 2013 - 04:51 AM

USPS has changed their API again. I've modified the USPS module for MVS and it seems to work. You can find the code here temporarily. Uninstall your module before installing this one to use all of the changes.

I have tested this on my test store, but I would really like to have others test this out and see if it works. Please post here if you have tried this code. If it works I'll add it to the main distribution.

@rwest  If you are still having problems, try just uploading this one over your old copy. If it lets you into your Admin, then uninstall and reinstall.

Regards
Jim
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support

#4549   marcochiana

marcochiana
  • Members
  • 13 posts
  • Real Name:Marco

Posted 12 February 2013 - 08:53 PM

Hello,
I installed MVS in my oscommerce 2.3.3 but I have this problem at checkout_confirmation.php
Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\enoosc\shop\includes\classes\vendor_shipping.php on line 46

Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\enoosc\shop\includes\classes\vendor_shipping.php on line 46

Warning: strpos() expects parameter 1 to be string, array given in C:\xampp\htdocs\enoosc\shop\includes\modules\order_total\ot_shipping.php on line 48

Warning: substr() expects parameter 1 to be string, array given in C:\xampp\htdocs\enoosc\shop\includes\modules\order_total\ot_shipping.php on line 48

Any Idea. I installed also Credit Class and gift voucher and discount coupon. Any idea about this warning?
Do you know if there are problem if MVS and credit class are installed in the same oscommerce??

Thanks for your help
Marco

#4550   kymation

kymation

    Believers

  • Community Sponsor
  • 6,682 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 12 February 2013 - 09:42 PM

You have a broken module in includes/modules/vendor_shipping/. If you've added something to that folder that's not supplied with this addon, try removing that temporarily and see if the error stops. If you haven't added anything, then go delete each file, one at a time, until the error stops. Once you know which module is causing the problem, you'll have to debug that module if it's one that you need, or just leave it out if you don't need it.

I have installed MVS along with CCGV in other stores. I don't remember any problems with that. I don't know which discount coupon addon you are using, but none of them should conflict with MVS.

Regards
Jim
My Addons

Banners Box 2.3.x  Support
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x  Support