Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Rick: Now that I have an editor again, I remembered that I had to change the code for the close window button as well. The original has this in locations that don't always get called, so you don't always have a close button. Find this text near the end:

</table>
<!-- body_text_eof //-->
<?php

if ($debug == 'yes') {

and add just before that

  <tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>
 </tr>
 <tr>
<td>
  <p align="center">
  <?php echo '<a href="java script:window.close()">' . tep_image_button('button_close_window.jpg', IMAGE_BUTTON_CLOSE) . '</a>'; ?>
  </p>
</td>
 </tr>

You should also remove the close window code from elsewhere on this page so it doesn't show up twice.

 

Regards

Jim

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

Link to comment
Share on other sites

Rick: Now that I have an editor again, I remembered that I had to change the code for the close window button as well. The original has this in locations that don't always get called, so you don't always have a close button. Find this text near the end:
</table>
<!-- body_text_eof //-->
<?php

if ($debug == 'yes') {

and add just before that

  <tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>
 </tr>
 <tr>
<td>
  <p align="center">
  <?php echo '<a href="java script:window.close()">' . tep_image_button('button_close_window.jpg', IMAGE_BUTTON_CLOSE) . '</a>'; ?>
  </p>
</td>
 </tr>

You should also remove the close window code from elsewhere on this page so it doesn't show up twice.

 

Regards

Jim

 

Thanks Jim, that worked. In testing this I noticed that if I clicked on Ship Estimator after my login expired I would get an empty window with a close button just about dead center, right where the shipping info should be. I was looking at moving the close function, but wasn't sure how far down to go.

 

Also, you're trying to get this to work with the UPSXML module? I'm still using the UPS (non XML) module. Is there a reason to go to the UPSXML module?

 

Thanks,

Rick

 

P.S. (If anyone else is following this and trying to get it to work, there is no space between java and script in "java script:window.close()" in the above code snippet. This editor dosesn't seem to like javascript as one word).

Link to comment
Share on other sites

Yes, there's a bug in the Table code. Find this code in catalog/includes/modules/vendor_shipping/table.php at Line 99:

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

and change it to:

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

Remember that the Table module will only use the total cost for the vendor, not for the total order.

 

Regards

Jim

A client of mine just stumbled over this bug - thanks for posting the fix!! Save many hours of head-sratching ;-)

Link to comment
Share on other sites

Hello everyone.

I introduce myself, I'm Antonello and I have just writing the Forum.

Excuse me if my English is not good, but I am trying to improve it. :blush:

However we return to us: :thumbsup:

I have a problem with MVS 1.1, that I have installed everything to perfection, but in the procedure for checkout in checkout_shipping.php seems to me so:

Immagine.JPG

Anybody knows how can I do to remedy?

Thanks to all

Antonello

Link to comment
Share on other sites

Thanks Jim, that worked. In testing this I noticed that if I clicked on Ship Estimator after my login expired I would get an empty window with a close button just about dead center, right where the shipping info should be. I was looking at moving the close function, but wasn't sure how far down to go.

 

Also, you're trying to get this to work with the UPSXML module? I'm still using the UPS (non XML) module. Is there a reason to go to the UPSXML module?

 

Thanks,

Rick

 

P.S. (If anyone else is following this and trying to get it to work, there is no space between java and script in "java script:window.close()" in the above code snippet. This editor dosesn't seem to like javascript as one word).

I tried the UPSXML module because somebody asked about it. It does have some features that the regular module doesn't, such as negotiated rates, but it also seems to have some bugs. I'm using an older version on a client's site, and that one works, so I'm going to leave it alone and just forget about the new version.

 

Nice catch on the javascript. I never noticed that. It isn't like that in the code that I pasted into the box. I'll have to keep a closer eye on that "feature"....

 

Regards

Jim

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

Link to comment
Share on other sites

Hello everyone.

I introduce myself, I'm Antonello and I have just writing the Forum.

Excuse me if my English is not good, but I am trying to improve it. :blush:

However we return to us: :thumbsup:

I have a problem with MVS 1.1, that I have installed everything to perfection, but in the procedure for checkout in checkout_shipping.php seems to me so:

<image snipped>

Anybody knows how can I do to remedy?

Thanks to all

Antonello

Looks like more than one problem. The missing constants are likely a problem with catalog/includes/languages/english/checkout_shipping.php. Check that the file exists and that it is not corrupted. Also check that this line exists [near line 178] in catalog/checkout_shipping.php:

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

The mess at the bottom should probably be in the right column. That's likely an error in editing catalog/checkout_shipping.php that is messing up the HTML. That error could be in a number of different places, so you'll need to go through your edits and check each one carefully. If you have no other edits to that file, you could use the one from the MVS distribution instead.

 

Regards

Jim

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

Link to comment
Share on other sites

I tried the UPSXML module because somebody asked about it. It does have some features that the regular module doesn't, such as negotiated rates, but it also seems to have some bugs. I'm using an older version on a client's site, and that one works, so I'm going to leave it alone and just forget about the new version.

 

Regards

Jim

 

 

Hi Jim,

 

Are you saying that an older version of the UPSXML module works with the ship estimator for MVS?

 

As all I need the UPSXML module for, is the ability to add shipping delays per vendor and to have the rates display an Estimated Delivery Date, if the version on your client's site can do that and will work with the ship estimator, you would REALLY make my day if you could email me a copy of the 2 files you have working so I can get this implemented on my site at cigarsforless.com

 

(email addy is in my profile)

 

Thanks much!

Edited by cigarsforless

Jim Bullen - President

The Cigar Hut Group of Companies

 

 

Installed add-ons: (that now need to be upgraded to OSC CE Phoenix)

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!

Link to comment
Share on other sites

Looks like more than one problem. The missing constants are likely a problem with catalog/includes/languages/english/checkout_shipping.php. Check that the file exists and that it is not corrupted. Also check that this line exists [near line 178] in catalog/checkout_shipping.php:
  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);

The mess at the bottom should probably be in the right column. That's likely an error in editing catalog/checkout_shipping.php that is messing up the HTML. That error could be in a number of different places, so you'll need to go through your edits and check each one carefully. If you have no other edits to that file, you could use the one from the MVS distribution instead.

 

Regards

Jim

Thanks Jim ;) ;)

Link to comment
Share on other sites

Hi Jim,

 

Are you saying that an older version of the UPSXML module works with the ship estimator for MVS?

 

As all I need the UPSXML module for, is the ability to add shipping delays per vendor and to have the rates display an Estimated Delivery Date, if the version on your client's site can do that and will work with the ship estimator, you would REALLY make my day if you could email me a copy of the 2 files you have working so I can get this implemented on my site at cigarsforless.com

 

(email addy is in my profile)

 

Thanks much!

Me too Jim,

 

One of my vendors now includes shipping dimensions in inventory feeds. I think the UPSXML module can give dimensional rates, so it might be handy for me also.

 

Thanks,

Rick

Link to comment
Share on other sites

Jim,

 

I just added new product that uses FedEx shipping, so since I haven't used FedEx for some time I thought i should test the module. The module works and I do get shipping rates, but I also get this error in the Ship Estimator window...

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

Here's the code from around line 75...

	function zone($vendors_id='1') {
  $this->zone = @constant('MODULE_SHIPPING_FEDEX1_ZONE_' . $vendors_id);
  return $this->zone;
}

function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_FEDEX1_STATUS_' . $vendors_id);
					if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX1_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_FEDEX1_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;
}

As you can see, I do have the constant defined. Can you give me any suggestions for fixing this? I've used this FedEx in the past and don't recall getting this error. It wouldn't have anything to do with PHP5/MySQL5 would it?

 

Thanks,

Rick

Link to comment
Share on other sites

Me too Jim,

 

One of my vendors now includes shipping dimensions in inventory feeds. I think the UPSXML module can give dimensional rates, so it might be handy for me also.

 

Thanks,

Rick

Sorry guys, I'm not quite there yet. The working UPSXML module is the same one that's in the MVS 1.1 distribution. It was working with a hacked-up copy of the ship estimator that no longer exists. I decided to do some more cleanup of the code, and I'm not finished with that yet. I'll let you know as soon as I get it finished, or at least working well enough to test.

 

Regards

Jim

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

Link to comment
Share on other sites

Here's the ship_estimator.php code for anyone who wants to try it. Please understand that this is preliminary test code and should not be used on a live site without considerable testing first. Backup your files before you try this! No warranty expressed or implied. May cause foul language, loss of hair, and nasty notes from your service provider. Use with caution.

 

I tested this with MVS1.1, including the default UPSXML module that comes with it, both logged in and out, and it seems to work. On my test server (FreeBSD 6.2, PHP 5.2.5, MySQL 4.1.20). If this doesn't work for you, please post the symptoms and the version info so that we can try to figure out why. Or possibly sacrifice a chicken.

 

<?php
/*
 $Id: ship_estimator.php,v 1.2 2008/01/07 jck Exp $
 $Loc: catalog/

***** Test Code! *****

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

 Copyright (c) 2008 osCommerce

 Released under the GNU General Public License
*/

 $debug = 'no';
 require_once ('includes/application_top.php');
 require_once ('includes/classes/http_client.php');

 switch (true) {
case isset($_GET['action']):
  $action = $_GET['action'];
break;
case isset($_POST['action']):
  $action = $_POST['action'];
break;
default:
  $action = '';
 }
 $action = preg_replace("(\r\n|\n|\r)", "", $action);  // Remove CR &/ LF
 $action = preg_replace("/[^a-z_]/i",'', $action); // Strip anything we don't want

if ($action == 'ship_error') {
	if (tep_not_null($HTTP_GET_VARS['error_shippostcode'])) {
		$messageStack->add('ship_estimator', ERROR_SHIPPOSTCODE);
	}
	if (tep_not_null($HTTP_GET_VARS['error_shipcountry'])) {
		$messageStack->add('ship_estimator', ERROR_SHIPCOUNTRY);
	}
} elseif ($action == 'process_select' && !tep_session_is_registered('customer_id')) {
	$error_shippostcode = false;
	$error_shipcountry = false;
	if (!tep_not_null($HTTP_POST_VARS['shippostcode']) || !tep_not_null($HTTP_POST_VARS['shipcountry'])) {
		if (!tep_not_null($HTTP_POST_VARS['shippostcode'])) $error_shippostcode = true;
		if (!tep_not_null($HTTP_POST_VARS['shipcountry'])) $error_shipcountry = true;
		tep_redirect(tep_href_link(FILENAME_SHIP_ESTIMATOR, 'action=ship_error&error_shippostcode=' . $error_shippostcode . '&error_shipcountry=' . $error_shipcountry, 'NONSSL'));
	}
} elseif ($action == 'process_end') {
	tep_session_unregister('est_shipping_ot');
	tep_session_unregister('unregister');
	tep_session_unregister('est_shipping_id');
	tep_session_unregister('shipping');
	$shipping = '';
	$action = '';
}

if (tep_session_is_registered('customer_id')) {
	if (!tep_not_null($action)) {
		tep_redirect(tep_href_link(FILENAME_SHIP_ESTIMATOR, 'action=process_select', 'SSL'));
	}
} else {
	if (!tep_not_null($HTTP_POST_VARS['action'])) {
		tep_session_unregister('est_shipping_ot');
		tep_session_unregister('unregister');
		tep_session_unregister('est_shipping_id');
		tep_session_unregister('shipping');
	}
}

//MVS
if (SELECT_VENDOR_SHIPPING == 'true') {
	include_once (DIR_WS_CLASSES . 'vendor_shipping.php');
	$shipping_modules = new shipping;
} else {
	include_once (DIR_WS_CLASSES . 'shipping.php');
	$shipping_modules = new shipping;
	$total_weight = $cart->show_weight();
	$cost = $cart->show_total();
	$total_count = $cart->count_contents();
}
//MVS End

//  set all the $order variables if the customer is not logged in
 $cart_country_id = 0;
if (!tep_session_is_registered('customer_id')) {
	$shippostcode = $HTTP_POST_VARS['shippostcode'];
	tep_session_register('shippostcode');
	$shipcountry = $HTTP_POST_VARS['shipcountry'];
	tep_session_register('shipcountry');
	if (isset ($HTTP_POST_VARS['country_id']) ) {
		// country is selected
  $cart_country_id = (int) $HTTP_POST_VARS['country_id'];
		$country_info = tep_get_countries ($cart_country_id, true);
	} else {
		$country_info = tep_get_countries ($shipcountry, true);
	}
	$order->delivery = array('postcode' => $shippostcode,
														'country' => array('id' => $shipcountry, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']),
														'country_id' => $HTTP_POST_VARS['country_id'],
														'format_id' => tep_get_address_format_id($HTTP_POST_VARS['country_id']));
	$order->customer = array('postcode' => $shippostcode,
														'country' => array('id' => $shipcountry, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']),
														'country_id' => $shipcountry,
														'format_id' => tep_get_address_format_id($cart_country_id));
	$order->billing = array('postcode' => $shippostcode,
													'country' => array('id' => $shipcountry, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']),
													'country_id' => $shipcountry,
													'format_id' => tep_get_address_format_id($cart_country_id));
	$order->info = array('total' => $cart->show_total(), // TAX ????
												'currency' => $currency,
												'shipping_cost' => $shipping['cost'],
												'shipping_method' => $shipping['title'],
												'shipping_tax' => $shipping['shipping_tax_total'],
												'subtotal' => 0,
												'tax' => $order->products[$i]['tax'] + $shipping['shipping_tax_total'],
												'tax_groups' => array(),
												'country_id' => $shipcountry,
												'currency_value'=> $currencies->currencies[$currency]['value']);

	$index = 0;
	$products = $cart->get_products();
	for ($i=0, $n=sizeof($products); $i<$n; $i++) {
		//MVS - added 'vendors_id' => ..., 'vendors_name' => ...
		$order->products[$index] = array('qty' => $products[$i]['quantity'],
																			'name' => $products[$i]['name'],
																			'model' => $products[$i]['model'],
																			'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
																			'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
																			'price' => $products[$i]['price'],
																			'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
																			'weight' => $products[$i]['weight'],
																			'id' => $products[$i]['id'],
																			'vendors_id' => $products[$i]['vendors_id'],
																			'vendors_name' => $products[$i]['vendors_name']
		);
		if ($products[$i]['attributes']) {
			$subindex = 0;
			reset($products[$i]['attributes']);
			while (list($option, $value) = each($products[$i]['attributes'])) {
				$attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
				$attributes = tep_db_fetch_array($attributes_query);
				$order->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
																																	'value' => $attributes['products_options_values_name'],
																																	'option_id' => $option,
																																	'value_id' => $value,
																																	'prefix' => $attributes['price_prefix'],
																																	'price' => $attributes['options_values_price']);
				$subindex++;
			}
		}
		$shown_price = tep_add_tax($order->products[$index]['final_price'], $order->products[$index]['tax']) * $order->products[$index]['qty'];
		$order->info['subtotal'] += $shown_price;
		$products_tax = $order->products[$index]['tax'];
		$products_tax_description = $order->products[$index]['tax_description'];
		if (DISPLAY_PRICE_WITH_TAX == 'true') {
			$order->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
			if (isset($order->info['tax_groups']["$products_tax_description"])) {
				$order->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
			} else {
				$order->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
			}
		} else {
			$order->info['tax'] += ($products_tax / 100) * $shown_price;
			if (isset($order->info['tax_groups']["$products_tax_description"])) {
				$order->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
			} else {
				$order->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price + $shipping['shipping_tax_total'];
			}
		}
		$index++;
	}
	if (DISPLAY_PRICE_WITH_TAX == 'true') {
		$order->info['total'] = $order->info['subtotal'] + $order->info['shipping_cost'];
	} else {
		$order->info['total'] = $order->info['subtotal'] + $order->info['tax'] + $order->info['shipping_cost'];
	}

} else {
//customer is logged in
	// if no shipping destination address was selected, use the customers own address as default
	if (!tep_session_is_registered('sendto')) {
		tep_session_register('sendto');
		$sendto = $customer_default_address_id;
	} else {
		// verify the selected shipping address
		$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
		$check_address = tep_db_fetch_array($check_address_query);
		if ($check_address['total'] != '1') {
			$sendto = $customer_default_address_id;
			if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
		}
	}
}
if (tep_session_is_registered('customer_id')) {
	require_once (DIR_WS_CLASSES . 'order.php');
	$order = new order;
}

// process the selected shipping method
if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
	if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
	//MVS
	if (SELECT_VENDOR_SHIPPING == 'true') {
		$total_shipping_cost = 0;
		$shipping_title = MULTIPLE_SHIP_METHODS_TITLE;
		$vendor_shipping = $cart->vendor_shipping;
		$shipping = array();
		foreach ($vendor_shipping as $vendor_id => $vendor_data) {
			$products_shipped = $_POST['products_' . $vendor_id];
			$products_array = explode ("_", $products_shipped);
			$shipping_data = $_POST['shipping_' . $vendor_id];
			$shipping_array = explode ("_", $shipping_data);
			$module = $shipping_array[0];
			$method = $shipping_array[1];
			$ship_tax = $shipping_array[2];
			if ( is_object($$module) || ($module == 'free') ) {
				if ($module == 'free') {
					$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
					$quote[0]['methods'][0]['cost'] = '0';
				} else {
					$total_weight = $vendor_shipping[$vendor_id]['weight'];
					$shipping_weight = $total_weight;
					$cost = $vendor_shipping[$vendor_id]['cost'];
					$total_count = $vendor_shipping[$vendor_id]['qty'];
					$quote = $shipping_modules->quote($method, $module, $vendor_id);
				}
				if (isset($quote['error'])) {
					tep_session_unregister('shipping');
				} else {
					if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
						$output[$vendor_id] = array('id' => $module . '_' . $method,
																				'title' => $quote[0]['methods'][0]['title'],
																				'ship_tax' => $ship_tax,
																				'products' => $products_array,
																				'cost' => $quote[0]['methods'][0]['cost']
						);
						$total_ship_tax += $ship_tax;
						$total_shipping_cost += $quote[0]['methods'][0]['cost'];
					}
					//if isset
				}
				//if isset
			}
			//if is_object
		}
		//foreach
		if ($free_shipping == true) {
			$shipping_title = $quote[0]['module'];
		} elseif (count($output) <2) {
			$shipping_title = $quote[0]['methods'][0]['title'];
		}
		$shipping = array('id' => $shipping,
											'title' => $shipping_title,
											'cost' => $total_shipping_cost,
											'shipping_tax_total' => $total_ship_tax,
											'vendor' => $output
		);
		$shippostcode = $HTTP_POST_VARS['shippostcode'];
		tep_session_register('shippostcode');
		$shipcountry = $HTTP_POST_VARS['shipcountry'];
		tep_session_register('shipcountry');

	} else {  // SELECT_VENDOR_SHIPPING == 'false'
  //MVS End
		if ((isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_'))) {
			$shipping = $HTTP_POST_VARS['shipping'];
			list($module, $method) = explode('_', $shipping);
			if ( is_object($$module) || ($shipping == 'free_free') ) {
				if ($shipping == 'free_free') {
					$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
					$quote[0]['methods'][0]['cost'] = '0';
				} else { // $shipping == 'free_free'
					$quote = $shipping_modules->quote($method, $module);
				} //ELSE
			} //IF FREE
			if (isset($quote['error'])) {
				tep_session_unregister('shipping');
			} else { //ISSET ERROR
				if ((isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost']))) {
					$shipping = array('id' => $shipping,
														'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
														'cost' => $quote[0]['methods'][0]['cost']);
					tep_session_register('shippostcode', $shippostcode);
					tep_session_register('shipcountry', $shipcountry);
					tep_redirect(tep_href_link(FILENAME_SHIP_ESTIMATOR, 'action=process_ot&shipcountry=' . $shipcountry .  '&shippostcode=' . $shippostcode, 'SSL'));
				} //isset($quote[0]['methods'][0]['title']
			} //ELSE
		} else { // IF isset($HTTP_POST_VARS['shipping'])
			tep_session_unregister('shipping');
		} //ELSE
	} // ELSE
	tep_redirect(tep_href_link(FILENAME_SHIP_ESTIMATOR, 'action=process_ot&shipcountry=' . $shipcountry . '&shippostcode=' . $shippostcode, 'SSL'));
	exit;
} //IF action == 'process'


require_once (DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHIP_ESTIMATOR);
?>



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

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
	  </tr>
	  <tr>
		<td colspan="2" align="center" class="pageHeading"><b><?php echo TABLE_HEADING_EST_SHIPPING; ?></b></td>
	  </tr>
<?php

 if (!isset($HTTP_POST_VARS['action']) && $cart->count_contents() > 0 && !tep_session_is_registered('customer_id') || $HTTP_POST_VARS['action'] == 'process_end') {

?>
   <td width="100%" valign="top"><?php echo tep_draw_form('est_shipping_id', tep_href_link(FILENAME_SHIP_ESTIMATOR, '', 'SSL'), 'post') . tep_draw_hidden_field('action', 'process_select'); ?></td></tr>
<?php

if ($messageStack->size('ship_estimator') > 0) {

?>
  <tr>
	<td><?php echo $messageStack->output('ship_estimator'); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="3"><?php echo '<b>' . HEADING_PRODUCTS . '</b>'; ?></td>
		</tr>
<?php

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  echo '			<tr>' . "\n" .
	   '			  <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
	   '			  <td class="main" valign="top">' . $order->products[$i]['name'];

  if (STOCK_CHECK == 'true') {
	echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);
  }

  if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
	for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	  echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
	}
  }

  echo '			  </td>' . "\n";
  echo '			</tr>' . "\n";
}

?>
	  </table></td>
	</tr>
  </table></td>
  </tr>
  <tr>
   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
   </tr>
	 <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
		<td class="main"><b><?php echo TITLE_SHIPPING_ADDRESS; ?></b></td>
	  </tr>
				<tr>
					<td class="infoBoxContents"><?php echo ENTRY_POST_CODE; ?></td>
					<td class="infoBoxContents"><?php echo tep_draw_input_field('shippostcode') . ' ' . (tep_not_null(ENTRY_POST_CODE) ? '<span class="inputRequirement">* Required</span>': ''); ?></td>
				</tr>
				<tr>
					<td class="infoBoxContents"><?php echo ENTRY_COUNTRY; ?></td>
					<td class="infoBoxContents"><?php echo tep_get_country_list('shipcountry',DEFAULT_COUNTRY) . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">* Required</span>': ''); ?></td>
				</tr>
				<td class="infoBoxContents"></td>
				<td class="infoBoxContents"><?php echo tep_image_submit('button_process_quote.gif', IMAGE_BUTTON_PROCESS_QUOTE); ?></td>
				</tr>
			</table></td>
  </tr>
  </table></td>
  </tr>
  <tr>
   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
   </tr>
<?php
// end of the shipping address form if not a logged in customer and begin the ship estimate

 } elseif ($action == 'process_select') {
if (!tep_session_is_registered('customer_id')) {
  if (!tep_not_null($HTTP_POST_VARS['shippostcode']) || !tep_not_null($HTTP_POST_VARS['shipcountry'])) { // error nicely
	tep_redirect(tep_href_link(FILENAME_SHIP_ESTIMATOR, 'shipcountry=' . $shipcountry . '&shippostcode=' . $shippostcode, 'SSL'));
  }//!tep_not_null($HTTP_POST_VARS['shippostcode']
}//tep_session_is_registered('customer_id')
?>
	  <tr>
		<td width="100%" valign="top"><?php echo tep_draw_form('est_shipping_ot', tep_href_link(FILENAME_SHIP_ESTIMATOR, '', 'SSL'), 'post') . tep_draw_hidden_field('action', 'process'); ?></td>
<?php
if (!tep_session_is_registered('customer_id')) {
  $shippostcode = $HTTP_POST_VARS['shippostcode'];
  $shipcountry = $HTTP_POST_VARS['shipcountry'];
  echo tep_draw_hidden_field('shippostcode', $shippostcode);
  echo tep_draw_hidden_field('shipcountry', $shipcountry);
}
?>
	 <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
		<td class="main"><b><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></b></td>
	  </tr>
		  <tr>
<?php
if (!tep_session_is_registered ('customer_id')) {
  $shipcountry_name = tep_get_country_name($shipcountry);
?>
			 <td class="main"><?php echo $shippostcode . '<br>' . $shipcountry_name; ?></td>
<?php } else {  ?>
			 <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
<?php } ?>
		  </tr>
<?php
if (!tep_session_is_registered ('customer_id')) {
?>
			  <tr><td class="main" width="100%" align="center" valign="top"><?php echo TEXT_RESET_EXPLAIN . '<br><br><a href="' . tep_href_link(FILENAME_SHIP_ESTIMATOR, 'action=process_end', 'SSL') . '">' . tep_image_button('button_reset.gif', IMAGE_BUTTON_RESET_FORM) . '</a>'; ?> </td>
		 </tr>
<?php } ?>
		  </table></td>
  </tr>
  </table></td>
  </tr>
  <tr>
   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
   </tr>
<?php
// Start MVS
 if (SELECT_VENDOR_SHIPPING == 'true') {
$vendor_shipping = $cart->vendor_shipping();

//Display a notice if we are shipping by multiple methods
if (count ($vendor_shipping) > 1) {
?>
	 <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo TEXT_MULTIPLE_SHIPPING_METHODS; ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
	   </tr>
		  </table></td>
  </tr>
  </table></td>
  </tr>
  <tr>
   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
   </tr>
	 <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
<?php
}

foreach ($vendor_shipping as $vendor_id => $vendor_data) {
  $total_weight = $vendor_data['weight'];
  $shipping_weight = $total_weight;
  $cost = $vendor_data['cost'];
  $ship_tax = $shipping_tax;   //for taxes
  $total_count = $vendor_data['qty'];

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

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

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

		include_once (DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php');
	  }
	} else {
	  $free_shipping = false;
	}
//Get the quotes array
  $quotes = $shipping_modules->quote('', '', $vendor_id);

if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest($vendor_id);

?>
	 <tr>
	<td><table border="1" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="100%" valign="top"><b><?php echo TEXT_PRODUCTS; ?></b></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
  $products_ids = $vendor_data['products_id'];
  foreach ($products_ids as $product_id) {
	$products_query = tep_db_query("select products_name
													  from " . TABLE_PRODUCTS_DESCRIPTION . "
													  where products_id = '" . (int)$product_id . "'
														and language_id = '" . (int)$languages_id . "'"
								  );
	$products = tep_db_fetch_array($products_query);
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
							<td  class="main" width="100%" valign="top"><?php echo $products['products_name']; ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
  }//foreach
?>
</tr>
		  </table></td>
  </tr>
  </table></td>
  </tr>
  <tr>
   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
   </tr>
	 <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
<?php
  if (count ($quotes) > 1) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="50%" valign="top"><?php echo TEXT_AVAILABLE_SHIPPING_METHOD; ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
  }

  if ($free_shipping == true) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td colspan="2" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><b><?php echo FREE_SHIPPING_TITLE; ?></b> <?php echo $quotes[$i]['icon']; ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" width="100%"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			</table></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
} else {
  $radio_buttons = 0;
  for ($i=0, $n=count($quotes); $i<$n; $i++) {
?>
		  <tr>

			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><b><?php echo $quotes[$i]['module']; ?></b> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php

	tep_draw_hidden_field('shipping_title', $quotes[$i]['module']);

	if (isset($quotes[$i]['error'])) {
?>
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
	} else {
	  for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
		$shipping_actual_tax = $quotes[$i]['tax'] / 100;
		$shipping_tax = $shipping_actual_tax * $quotes[$i]['methods'][$j]['cost'];

		tep_draw_hidden_field('shipping_cost', $quotes[$i]['methods'][$j]['cost']);

?>
			   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			   <td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
<?php
		if ( ($n > 1) || ($n2 > 1) ) {
?>
				<td class="main"><?php echo $currencies->format($quotes[$i]['methods'][$j]['cost']); ?></td>
<?php
		} else {
?>
				<td class="main" align="right" colspan="2"><?php echo $currencies->format($quotes[$i]['methods'][$j]['cost']) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] . '_' . $shipping_tax); ?></td>
				<td class="main" align="right">
<?php
		  echo tep_draw_hidden_field('shipping_' . $vendor_id, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] . '_' . $shipping_tax);
		  echo tep_draw_hidden_field('products_' . $vendor_id, implode("_", $products_ids));
?>
				</td>
<?php
		}
?>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
		$radio_buttons++; // BUTTONS REMOVED, BUT THE PROCESS IS STILL NEEDED
	  }
	}
?>
			</table></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
	}
  }
?>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}
 } else {
// End MVS
$quotes = $shipping_modules->quote();

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

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

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

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

if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest();

?>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></td>
			<td class="main" width="50%" valign="top" align="right"><?php echo '<b>' . TITLE_PLEASE_SELECT . '</b><br>'; ?></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>




		  </tr>
<?php
}

if ($free_shipping == true) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td colspan="2" width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><b><?php echo FREE_SHIPPING_TITLE; ?></b> <?php echo $quotes[$i]['icon']; ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, 0)">
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" width="100%"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			</table></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

		  </tr>
<?php
} else {
  $radio_buttons = 0;
  for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
?>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><b><?php echo $quotes[$i]['module']; ?></b> <?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
	if (isset($quotes[$i]['error'])) {
?>
			  <tr>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" colspan="3"><?php echo $quotes[$i]['error']; ?></td>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
	} else {
	  for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
?>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				<td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
<?php
		if ( ($n > 1) || ($n2 > 1) ) {
?>
				<td class="main"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></td>
				<?php
		} else {
?>
				<td class="main" align="right" colspan="2"><?php echo $currencies->format(tep_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></td>
<?php
		}
?>
				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
<?php
		$radio_buttons++;
	  }
	}
?>
			</table></td>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
<?php
  }
}
?>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>

<?php
//MVS
}
	$cartID = $cart->cartID;
		   tep_session_register('shipcountry', $shipcountry);
		   tep_session_register('shippostcode', $shippostcode);
		   tep_session_register('shipping');
		   tep_session_register('est_shipping_ot', $cartID);
   echo tep_draw_hidden_field('est_shipping_ot', $cartID);

	 // end of the shipping selection
 }
 // Stock Check
 $any_out_of_stock = false;
 if (STOCK_CHECK == 'true') {
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
  if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
	$any_out_of_stock = true;
  }
}
// Out of Stock
if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
?>
	 <tr>
		<td colspan="2" align="center" class="main"><b><?php echo 'The item you have selected is currently out of stock, please close this window and select another product.'; ?></b></td>
	  </tr>
<?php
}
 }
// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
?>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
	  </tr>
	 <tr>
		<td colspan="2" align="center" class="main"><b><?php echo '<br>Currently there are no products in your Shopping Cart to estimate. <br><br>Please close this window and add products to your Shopping Cart.<br><br>Note: You do not need to log in to add items to a Shopping Cart.'; ?></b></td>
	  </tr>



<?php } ?>
	</table></td>
  </tr>
</table></td>
 </tr>
 <tr>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>
 </tr>
 <tr>
<td>
  <p class="smallText" align="center">
  <?php echo '<a href="java script:window.close()">' . tep_image_button('button_close_window.jpg', IMAGE_BUTTON_CLOSE) . '</a>'; ?>
  </p>
</td>
 </tr>
</table>
<!-- body_text_eof //-->
<?php

if ($debug == 'yes') {
//		echo '<font color="#FFFFFF">';
	echo '<br>the action is:  ' . $action;
	echo '<br>the $customer_id is:  ' . $customer_id;
	echo '<br>the shipping cost from the cart  ' . $order->info['shipping_cost'];
	echo '<br>the county array id from the cart  ' . $order->delivery['country']['id'];
	echo '<br>the delivery zipcode from the cart  ' . $order->delivery['postcode'];
	echo '<br>the shipping title from the cart  ' . $order->info['shipping_method'];
	echo '<br>the order->info tax:  ' . $order->info['tax'];
	echo '<br>the POSTED shipping:  ' . $HTTP_POST_VARS['shipping'];
	echo '<br>the shipping from $order->info[]:  ' . $order->info['shipping'];
	echo '<br>the subtotal:  ' . $order->info['subtotal'];
	echo '<br>the shipping tax:  ' . $shipping['shipping_tax_total'];
	echo '<br>the $shippostcode:  ' .  $shippostcode;
	echo '<br>the $shipcountry:  ' . $shipcountry;
//		echo '</font>';
	// require_once ('show_variables.php');
} //IF DEBUG
 ?>
</body>
</html>
<?php require_once (DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Have fun.

 

Regards

Jim

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

Link to comment
Share on other sites

Repost

 

Jim,

 

I just added new product that uses FedEx shipping, so since I haven't used FedEx for some time I thought i should test the module. The module works and I do get shipping rates, but I also get this error in the Ship Estimator window...

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

Here's the code from around line 75...

	function zone($vendors_id='1') {
  $this->zone = @constant('MODULE_SHIPPING_FEDEX1_ZONE_' . $vendors_id);
  return $this->zone;
}

function enabled($vendors_id='1') {
  $this->enabled = false;
  $status = @constant('MODULE_SHIPPING_FEDEX1_STATUS_' . $vendors_id);
					if (isset ($status) && $status != '') {
	$this->enabled = (($status == 'True') ? true : false);
  }
  if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_FEDEX1_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_FEDEX1_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;
}

As you can see, I do have the constant defined. Can you give me any suggestions for fixing this? I've used this FedEx in the past and don't recall getting this error. It wouldn't have anything to do with PHP5/MySQL5 would it?

 

Thanks,

Rick

Link to comment
Share on other sites

Repost

 

Jim,

 

I just added new product that uses FedEx shipping, so since I haven't used FedEx for some time I thought i should test the module. The module works and I do get shipping rates, but I also get this error in the Ship Estimator window...

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

Here's the code from around line 75...

<code shipped>

As you can see, I do have the constant defined. Can you give me any suggestions for fixing this? I've used this FedEx in the past and don't recall getting this error. It wouldn't have anything to do with PHP5/MySQL5 would it?

 

Thanks,

Rick

Is the constant set in your database? Try uninstalling and reinstalling the module for that vendor.

 

Regards

Jim

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

Link to comment
Share on other sites

Jim:

 

I uploaded your code onto my server.....there was no change in operation. When logged in - no estimate.

 

I spent some time trying to change the code to act is if your not logged in when you are.....I'm not efficient enough....

 

Is there a way to do this or possibly find a way to remove the estimate button when someone is logged in?

 

Thanks

Pete

Link to comment
Share on other sites

<snip>

When you get the "no shipping selected" error, have you actually selected a shipping method for all vendors?

Yes, other shipping methods work but still get this error using MVS verison of upsxml.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

 

Replacing $vendor_id with $vendors_id in upsxml.php removes the error, but checkout fails with the "no shipping selected" error; also replacing the 8 occurrences of $vendor_id with $vendors_id in checkout_shipping.php does not fix the "no shipping selected" error.

 

I think it's a register_globals=off issue, so do you know how I define the shipping method selected with register_globals=off?

 

Thanks,

EricK

Link to comment
Share on other sites

Yes, other shipping methods work but still get this error using MVS verison of upsxml.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

 

Replacing $vendor_id with $vendors_id in upsxml.php removes the error, but checkout fails with the "no shipping selected" error; also replacing the 8 occurrences of $vendor_id with $vendors_id in checkout_shipping.php does not fix the "no shipping selected" error.

 

I think it's a register_globals=off issue, so do you know how I define the shipping method selected with register_globals=off?

 

Thanks,

EricK

Try this:

put an "@" sign in front of the call to the constant, in the UPSXML file, like this:

 @constant('MODULE_SHIPPING_UPSXML_INSURE_' . $vendor_id)

This is just a warning however, so it really shouldn't effect whether or not you can get a quote logged in or not.

 

The fact that you don't have a number at the end of the line(MODULE_SHIPPING_UPSXML_INSURE_) shows that you need to change the "$vendor_id" to "$vendors_id", there should be a number at the end of that line.

 

It could be a "register_globals" issue, you would need to add some print statements within the areas of code that are being called when a user is logged, to see what data is missing and causing the error.

 

Good luck, Craig :)

Edited by blucollarguy

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Try this:

put an "@" sign in front of the call to the constant, in the UPSXML file,

<snip>

Craig, many thanks!

The @ fixed the error, and checkout using UPSXML still works.

So that was not caused by register_globals=off?

Kind regards,

EricK

Link to comment
Share on other sites

Is the constant set in your database? Try uninstalling and reinstalling the module for that vendor.

 

Regards

Jim

Thanks Jim,

 

Removing and re-installing worked. Strange thing is, I've had it working in the past, why would it need re-installing.

 

Thanks,

Rick

Link to comment
Share on other sites

Rick: I'm not certain why that would happen, I just know that error usually means that the constant didn't get declared in the database, and reinstalling is the easiest way to fix that. This can happen sometimes when you upload a newer or modified version of the module and don't reinstall.

 

Eric: Adding the @ doesn't really fix the problem, it just turns off the error message for that command. As Craig said, you need to have the number at the end of that constant. I would advise that you leave the @ off until you find out where the error is coming from, or you may get some incorrect quotes.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

I've just uploaded a new version of the MVS Shipping Estimator. The major change, and the original reason for doing this, was to add the capability of getting shipping estimates for individual products from the product pages. I ended up doing a lot of bug fixes and code cleanup along the way, so the whole thing should now work better. Or at least faster. I'm hoping that some of the problems that people were reporting with the old version are now solved. Anyway, I'd appreciate hearing how this works for everyone. I have it running on three heavily modified stores right now and it seems to be behaving.

 

Regards

Jim

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

Link to comment
Share on other sites

I've just uploaded a new version of the MVS Shipping Estimator. The major change, and the original reason for doing this, was to add the capability of getting shipping estimates for individual products from the product pages. I ended up doing a lot of bug fixes and code cleanup along the way, so the whole thing should now work better. Or at least faster. I'm hoping that some of the problems that people were reporting with the old version are now solved. Anyway, I'd appreciate hearing how this works for everyone. I have it running on three heavily modified stores right now and it seems to be behaving.

 

Regards

Jim

 

 

Hi thank you for updating this. I tried to use this once but it only works for US customers, am i able to USE this with UK and Royal Mail shipping rate?

Link to comment
Share on other sites

Hi thank you for updating this. I tried to use this once but it only works for US customers, am i able to USE this with UK and Royal Mail shipping rate?

There are no country-specific restrictions in this code. You can use any osCommerce shipping module that has been modified for MVS. If the modules you want to use have not been modified, you can do this yourself using the instructions provided with the MVS distribution, or pay someone to do this for you. If you don't need to use MVS, the Shipping Estimator will work on standard osCommerce shipping modules.

 

Regards

Jim

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

Link to comment
Share on other sites

I've just uploaded a new version of the MVS Shipping Estimator. The major change, and the original reason for doing this, was to add the capability of getting shipping estimates for individual products from the product pages. I ended up doing a lot of bug fixes and code cleanup along the way, so the whole thing should now work better. Or at least faster. I'm hoping that some of the problems that people were reporting with the old version are now solved. Anyway, I'd appreciate hearing how this works for everyone. I have it running on three heavily modified stores right now and it seems to be behaving.

 

Regards

Jim

 

 

Hi Jim,

 

Did you manage to get this new version to work with the UPSXML module?

(Just thought I'd ask before installing it to find out if it suits my needs yet)

Jim Bullen - President

The Cigar Hut Group of Companies

 

 

Installed add-ons: (that now need to be upgraded to OSC CE Phoenix)

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!

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