Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New UPS XML Shipping Module available


Recommended Posts

It is an interesting challenge but time-consuming and time or more precisely the lack of it is what prevents most code from getting written (or published) ;)

 

My thoughts at the moment on how this could be done is adding a table that holds the data on the split products (id, products_id, l, w, h, fraction of total weight for this box, fraction of total price of the item for this box, ready-to-ship 0/1) and probably best to add a new function to the class shopping_cart that collects the information UPSXML needs, including the split products ($cart->get_products generates lots of queries; at least two per product in the cart).

 

This is the easy part I think. The most time-consuming will be to code the admin part. Perhaps a pop-up window could be used (CCGV has that, I used one in the Nov 14, 2006 SPPC attributes mod rev. 1 for the admin of group prices for attributes). However, for spreading the weight and value (insurance) over the boxes you have to add some Javascript to try to make sure the fractions add up to 1...

 

 

Could it be as easy as creating a "shadow product" that is linked to a master product? We are currently using the Americart shopping cart service and it works like this. You add code to your HTML page that indicates that there is an extra box needed for a product, the service sees that then adds a separate product item to the shopping cart called something like "Widet1" (with the full item cost and weight of first box) and "Widget 1 Second Box" with a zero cost but the weight of the second box. The fact that it's added as two separate items before it gets to the shipping modules allows you to use any shipping method. Not sure how to go about getting that done though. That method wouldn't involve messing around with the UPSXML module and wouldn't be gemain to this topic anyway...

Link to comment
Share on other sites

Could it be as easy as creating a "shadow product" that is linked to a master product? We are currently using the Americart shopping cart service and it works like this. You add code to your HTML page that indicates that there is an extra box needed for a product, the service sees that then adds a separate product item to the shopping cart called something like "Widet1" (with the full item cost and weight of first box) and "Widget 1 Second Box" with a zero cost but the weight of the second box. The fact that it's added as two separate items before it gets to the shipping modules allows you to use any shipping method. Not sure how to go about getting that done though. That method wouldn't involve messing around with the UPSXML module and wouldn't be gemain to this topic anyway...

Sounds like a terrible hack to me. For starters: what if the customers deletes the second box in the shopping_cart page?

 

Perhaps you would like to test this (I haven't tested this with a split product with attributes but I coded it with that in mind):

catalog/includes/database_tables.php

**ADD**

 define('TABLE_PRODUCTS_SPLIT', 'products_split');

----------------
Run the following sql in phpMyAdmin or similar tool:

DROP TABLE IF EXISTS products_split;
CREATE TABLE products_split (
 id int UNSIGNED NOT NULL auto_increment,
 products_id int(11) NOT NULL DEFAULT '0',
 products_length DECIMAL(6,2) DEFAULT '12' NOT NULL,
 products_width DECIMAL(6,2) DEFAULT '12' NOT NULL,
 products_height DECIMAL(6,2) DEFAULT '12' NOT NULL,
 products_ready_to_ship enum('0','1') NOT NULL,
 value_fraction FLOAT(5,2) DEFAULT '0.50' NOT NULL,
 weight_fraction FLOAT(5,2) DEFAULT '0.50' NOT NULL,
 PRIMARY KEY (id),
 INDEX (products_id)
);

----------------
catalog/includes/classes/shopping_cart.php

ADD the following code (before the last } )


// get_products_for_packaging is a special function for upsxml dimensions
// assumes that you have added the sql for upsxml, which adds the table products_split
  function get_products_for_packaging() {

  if (!is_array($this->contents)) return false;
  $products_array = array();
  foreach ($this->contents as $products_id => $subarray) {
	$products_id_array[] = tep_get_prid($products_id);
  }
  // due to attributes there might be multiple instances of products_id's
  $products_id_array = array_unique($products_id_array);
  $no_of_products_ids = count($products_id_array);

	$products_query = tep_db_query("select p.products_id, p.products_price, p.products_length, p.products_weight, p.products_width, p.products_height, p.products_ready_to_ship, p.products_tax_class_id from " . TABLE_PRODUCTS . " p where p.products_id in (" . implode(",", $products_id_array) . ")");
	while ($_products = tep_db_fetch_array($products_query)) {
	  $products[] = $_products;
	}

	  $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in (" . implode(",", $products_id_array) . ") and status = '1'");
	  while ($_specials = tep_db_fetch_array($specials_query)) {
		$specials_prices[] = array ('products_id' => $_specials['products_id'], 'specials_new_products_price' => $_specials['specials_new_products_price']);
	  }

// replace products price for specials_new_products_price
		for ($x = 0; $x < $no_of_products_ids; $x++) {
		if(!empty($specials_prices)) {
			for ($i = 0; $i < count($specials_prices); $i++) {
				if($products[$x]['products_id'] == $specials_prices[$i]['products_id'] ) {
				   $products[$x]['products_price'] = $specials_prices[$i]['specials_new_products_price'];
				}
			}
		  } // end if(!empty($specials_prices)
		} // end for ($x = 0; $x < $no_of_products_ids; $x++)

// get split products information
   $split_query = tep_db_query("select products_id, products_length, products_width, products_height, products_ready_to_ship, weight_fraction, value_fraction from " . TABLE_PRODUCTS_SPLIT . " where products_id in (" . implode(",", $products_id_array) . ") order by products_id");
   while ($_split_products = tep_db_fetch_array($split_query)) {
	 $split_products[] = $_split_products;
   }

	foreach ($this->contents as $products_id => $subarray) {
	  for ($y = 0; $y < $no_of_products_ids; $y++) {
		if (tep_get_prid($products_id) == $products[$y]['products_id']) {
	  $products_array[] = array(
	  'id' => $products_id,
	  'price' => $products[$y]['products_price'],
	  'quantity' => $this->contents[$products_id]['qty'],
	  'weight' => $products[$y]['products_weight'],
	  'length' => $products[$y]['products_length'],
	  'width' => $products[$y]['products_width'],
	  'height' => $products[$y]['products_height'],
	  'ready_to_ship' => $products[$y]['products_ready_to_ship'],
	  'final_price' => ($products[$y]['products_price'] + $this->attributes_price($products_id)),
	  'tax_class_id' => $products[$y]['products_tax_class_id']);
	  }
	} // end for ($y = 0; $y < $no_of_products_ids; $y++)
  } // end foreach ($this->contents as $products_id => $subarray)

// expand products_array using the split products information if it is not empty
  if (!empty($split_products)) {
  $no_in_split_products = count($split_products);
  $no_in_products_array = count($products_array);
  for ($i = 0; $i < $no_in_products_array; $i++) {
	for ($z = 0; $z < $no_in_split_products; $z++) {
	  if (tep_get_prid($products_array[$i]['id']) == $split_products[$z]['products_id']) {
		$products_array[] = array(
		'id' => $products_array[$i]['id'],
		// price and final price are rounded to 4 decimals, weight to 3 decimals
		'price' => round(($split_products[$z]['value_fraction'] * $products_array[$i]['price']),4),
		'quantity' => $products_array[$i]['quantity'],
		'weight' => round(($split_products[$z]['weight_fraction'] * $products_array[$i]['weight']),3),
				'length' => $split_products[$z]['products_length'],
		'width' => $split_products[$z]['products_width'],
		'height' => $split_products[$z]['products_height'],
		'ready_to_ship' => $split_products[$z]['products_ready_to_ship'],
		'final_price' => round(($split_products[$z]['value_fraction'] * $products_array[$i]['final_price']),4),
		'tax_class_id' => $products_array[$i]['tax_class_id']);
		// to delete original product later when all splitting has been done
		// the key in that array is stored (make it unique later)
		$products_array_keys_to_unset[] = $i;
	  }
	} // end for ($z = 0; $z < $no_in_split_products; $z++)
  } // end for ($i = 0; $i < $no_in_products_array; $i++)
  if (!empty($products_array_keys_to_unset)) {
  $products_array_keys_to_unset = array_unique($products_array_keys_to_unset);
  // make sure that numerical indexes stay indexed, a simple unset gives problems in upsxml.php
  $_products_array = array();
	 foreach($products_array as $key => $sub_products_array) {
	   if (!in_array($key, $products_array_keys_to_unset)) {
		$_products_array[] = $sub_products_array;
	   }
	 }
	 unset($products_array);
	 $products_array = $_products_array;
  } // end if (!empty($products_array_keys_to_unset)
} // end !empty($split_products)

  return $products_array;
}

----------------
catalog/includes/modules/shipping/upsxml.php

around line 225:

**REPLACE**

	$productsArray = $cart->get_products();
			if ($this->dimensions_support > 0) {

**WITH**

	if (method_exists($cart, 'get_products_for_packaging') ) {
	  $productsArray = $cart->get_products_for_packaging();
	} else {
	  $productsArray = $cart->get_products();
	}
			if ($this->dimensions_support > 0) {

----------------
Use phpMyAdmin or similar tool to insert the split products into the table products_split
Make sure the value_fraction (and weight_fraction similarly) for the entries for a products_id add up to 1 (otherwise the weight shown to the customer doesn't equal the weight that UPS uses for the calculation, the splitting of the value will have ramifications on insurance values!)

Apart from the fact that it hasn't got an admin part it is terribly flexible. You can split a product in any number of items, ready-to-ship or not (for example if it consists of a large ready-to-ship item and a smaller item that can be packed with other things).

Link to comment
Share on other sites

Apparently, there is a problem but I can't tell you where to look. Did you add all the necessary changes for the dimensions support (like in the class shopping_cart.php)? Does is happen with one particular product, all products, ready-to-ship products?

 

Only thing to do is debugging like that, trying to find a pattern. One of the first things you could do is debug the input around line 227 in upsxml.php and change it to:

		$this->_upsDest($order->delivery['city'], $state, $order->delivery['country']['iso_code_2'], $order->delivery['postcode']);
	$productsArray = $cart->get_products();
			if ($this->dimensions_support > 0) {
				$productsArray = $this->more_dimensions_to_productsArray($productsArray);
	  // debug only
	  echo '<pre>Products to pack:<br>';
	  print_r($productsArray);
	  exit;
			}

	if ($this->dimensions_support == '2') {

The code stops on the exit and will print out something like this:

Products to pack:
Array
(
[0] => Array
	(
		[id] => 324
		[name] => Bamboo Pencil Red
		[model] => 
		[image] => bamboo_pencil_red.jpg
		[price] => 5.7500
		[quantity] => 1
		[weight] => 1.000
		[length] => 33.00
		[width] => 1.50
		[height] => 1.50
		[ready_to_ship] => 0
		[final_price] => 5.75
		[tax_class_id] => 1
		[attributes] => 
		[x] => 1.50
		[y] => 1.50
		[z] => 33.00
		[volume] => 74.25
	)

The variables weight, length, width, height, ready-to-ship, x, y, z, and volume should be meaningfull (and correspond with the values you entered in the admin of course).

Here is the output from debugging:

Products to pack:Array

(

[0] => Array

(

[id] => 104

[name] => Product 1

[model] => TPO-101-W

[image] => TPO-101-W.gif

[price] => 150.0000

[quantity] => 1

[weight] => 3.10

[length] =>

[width] =>

[height] =>

[ready_to_ship] =>

[final_price] => 150

[tax_class_id] => 1

[attributes] =>

[attributes_values] =>

[eligible_discounts] =>

[education_discount] =>

[government_discount] =>

[gsa_pricing] =>

[x] => 5

[y] => 5

[z] => 5

[volume] => 125

)

 

[1] => Array

(

[id] => 69

[name] => Product 2

[model] => SPR-05-B

[image] => SPR-05-B.gif

[price] => 30.5000

[quantity] => 1

[weight] => 0.30

[length] =>

[width] =>

[height] =>

[ready_to_ship] =>

[final_price] => 30.5

[tax_class_id] => 1

[attributes] =>

[attributes_values] =>

[eligible_discounts] =>

[education_discount] =>

[government_discount] =>

[gsa_pricing] =>

[x] => 2.3

[y] => 2.3

[z] => 2.3

[volume] => 12.167

)

 

)

There are no values for length, width, height and some values for x, y, z. Why there are no values for length, width, height and what are x, y,z?

 

Thanks.

Link to comment
Share on other sites

There are no values for length, width, height and some values for x, y, z. Why there are no values for length, width, height and what are x, y,z?

Hmm, I thought I had all the bases covered providing standard dimensions based on density if a weight is given but no dimensions. However, the module hangs due to a single line (554 in upsxml.php):

			// sanity checks on the product, should not be done for ready-to-ship times
		if ($product['ready_to_ship'] == '0') {

This assumes a value of either 0 or 1, but doesn't take into account NULL.

 

It should be changed into:

			// sanity checks on the product, no need for ready-to-ship items
		if ((int)$product['ready_to_ship'] == 0) {

in a future version.

 

Nonetheless, the error is caused because you haven't changed the $products_query in includes/classes/shopping_cart.php in the function get_products to include length, width, height, and ready-to-ship. Can't hurt to fix both of course.

 

The values x, y, z are used internally for fitting of the product in the box. Both the dimensions of boxes and products are sorted from low to high first (function more_dimensions_to_productsArray). If for example the product is (l x b x h) 30 x 5 x 5 but your largest box is 20 x 20 x 40 it still wouldn't fit if you only look at length.

Link to comment
Share on other sites

Hmm, I thought I had all the bases covered providing standard dimensions based on density if a weight is given but no dimensions. However, the module hangs due to a single line (554 in upsxml.php):

			// sanity checks on the product, should not be done for ready-to-ship times
		if ($product['ready_to_ship'] == '0') {

This assumes a value of either 0 or 1, but doesn't take into account NULL.

 

It should be changed into:

			// sanity checks on the product, no need for ready-to-ship items
		if ((int)$product['ready_to_ship'] == 0) {

in a future version.

 

Nonetheless, the error is caused because you haven't changed the $products_query in includes/classes/shopping_cart.php in the function get_products to include length, width, height, and ready-to-ship. Can't hurt to fix both of course.

 

The values x, y, z are used internally for fitting of the product in the box. Both the dimensions of boxes and products are sorted from low to high first (function more_dimensions_to_productsArray). If for example the product is (l x b x h) 30 x 5 x 5 but your largest box is 20 x 20 x 40 it still wouldn't fit if you only look at length.

The $products_query in my includes/classes/shopping_cart.php is different from the original and I'm not sure where exactly to include length, width, height, and ready-to-ship. Here is my file below. Please let me know if I missed anything.

<?php

/*

$Id: shopping_cart.php,v 1.35 2003/07/24 21:14:33 Strider Exp $

$Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $

$Id: shopping_cart.php,v 1.3.2.6 2003/05/12 23:11:20 wilt Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class shoppingCart {

var $contents, $total, $weight, $cartID, $content_type;

 

function shoppingCart() {

$this->reset();

}

 

function restore_contents() {

//ICW replace line

global $customer_id, $gv_id, $REMOTE_ADDR;

// global $customer_id;

 

if (!tep_session_is_registered('customer_id')) return false;

 

// insert current cart contents in database

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$qty = $this->contents[$products_id]['qty'];

$product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

if (!tep_db_num_rows($product_query)) {

tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");

}

}

} else {

tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

}

}

//ICW ADDDED FOR CREDIT CLASS GV - START

if (tep_session_is_registered('gv_id')) {

$gv_query = tep_db_query("insert into " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_id . "', '" . (int)$customer_id . "', now(),'" . $REMOTE_ADDR . "')");

$gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_id . "'");

tep_gv_account_update($customer_id, $gv_id);

tep_session_unregister('gv_id');

}

// End Added CCGV Contribution

}

 

// reset per-session cart contents, but not the database contents

$this->reset(false);

 

$products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");

while ($products = tep_db_fetch_array($products_query)) {

$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);

// attributes

//CLR 020606 update query to pull attribute value_text. This is needed for text attributes.

$attributes_query = tep_db_query("select products_options_id, products_options_value_id, products_options_value_text from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];

//CLR 020606 if text attribute, then set additional information

if ($attributes['products_options_value_id'] == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {

$this->contents[$products['products_id']]['attributes_values'][$attributes['products_options_id']] = $attributes['products_options_value_text'];

}

}

}

 

$this->cleanup();

}

 

function reset($reset_database = false) {

global $customer_id;

 

$this->contents = array();

$this->total = 0;

$this->weight = 0;

$this->content_type = false;

 

if (tep_session_is_registered('customer_id') && ($reset_database == true)) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");

}

 

unset($this->cartID);

if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');

}

 

function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {

global $new_products_id_in_cart, $customer_id;

global $languages_id;

 

$pf = new PriceFormatter;

$pf->loadProduct($products_id, $languages_id);

$qty = $pf->adjustQty($qty);

 

$products_id = tep_get_uprid($products_id, $attributes);

if ($notify == true) {

$new_products_id_in_cart = $products_id;

tep_session_register('new_products_id_in_cart');

}

 

if ($this->in_cart($products_id)) {

$this->update_quantity($products_id, $qty, $attributes);

} else {

$this->contents[] = array($products_id);

$this->contents[$products_id] = array('qty' => $qty);

// insert into database

if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

//CLR 020606 check if input was from text box. If so, store additional attribute information

//CLR 020708 check if text input is blank, if so do not add to attribute lists

//CLR 030228 add htmlspecialchars processing. This handles quotes and other special chars in the user input.

$attr_value = NULL;

$blank_value = FALSE;

if (strstr($option, TEXT_PREFIX)) {

if (trim($value) == NULL)

{

$blank_value = TRUE;

} else {

$option = substr($option, strlen(TEXT_PREFIX));

$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);

$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;

$this->contents[$products_id]['attributes_values'][$option] = $attr_value;

}

}

 

if (!$blank_value)

{

$this->contents[$products_id]['attributes'][$option] = $value;

// insert into database

//CLR 020606 update db insert to include attribute value_text. This is needed for text attributes.

//CLR 030228 add tep_db_input() processing

if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "', '" . tep_db_input($attr_value) . "')");

}

}

}

}

$this->cleanup();

 

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure

$this->cartID = $this->generate_cart_id();

}

 

function update_quantity($products_id, $quantity = '', $attributes = '') {

global $customer_id;

 

if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true..

 

$this->contents[$products_id] = array('qty' => $quantity);

// update database

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

 

if (is_array($attributes)) {

reset($attributes);

while (list($option, $value) = each($attributes)) {

//CLR 020606 check if input was from text box. If so, store additional attribute information

//CLR 030108 check if text input is blank, if so do not update attribute lists

//CLR 030228 add htmlspecialchars processing. This handles quotes and other special chars in the user input.

$attr_value = NULL;

$blank_value = FALSE;

if (strstr($option, TEXT_PREFIX)) {

if (trim($value) == NULL)

{

$blank_value = TRUE;

} else {

$option = substr($option, strlen(TEXT_PREFIX));

$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);

$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;

$this->contents[$products_id]['attributes_values'][$option] = $attr_value;

}

}

 

if (!$blank_value)

{

$this->contents[$products_id]['attributes'][$option] = $value;

// update database

//CLR 020606 update db insert to include attribute value_text. This is needed for text attributes.

//CLR 030228 add tep_db_input() processing

if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'");

}

}

}

}

 

function cleanup() {

global $customer_id;

 

reset($this->contents);

while (list($key,) = each($this->contents)) {

if ($this->contents[$key]['qty'] < 1) {

unset($this->contents[$key]);

// remove from database

if (tep_session_is_registered('customer_id')) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");

}

}

}

}

 

function count_contents() { // get total number of items in cart

$total_items = 0;

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$total_items += $this->get_quantity($products_id);

}

}

 

return $total_items;

}

 

function get_quantity($products_id) {

if (isset($this->contents[$products_id])) {

return $this->contents[$products_id]['qty'];

} else {

return 0;

}

}

 

function in_cart($products_id) {

if (isset($this->contents[$products_id])) {

return true;

} else {

return false;

}

}

 

function remove($products_id) {

global $customer_id;

 

//CLR 030228 add call tep_get_uprid to correctly format product ids containing quotes

$products_id = tep_get_uprid($products_id, $attributes);

 

unset($this->contents[$products_id]);

// remove from database

if (tep_session_is_registered('customer_id')) {

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");

}

 

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure

$this->cartID = $this->generate_cart_id();

}

 

function remove_all() {

$this->reset();

}

 

function get_product_id_list() {

$product_id_list = '';

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$product_id_list .= ', ' . $products_id;

}

}

 

return substr($product_id_list, 2);

}

 

function calculate() {

// BEGIN - Tax Exempt and Organization Discounts

global $customer_id;

 

$discount_type_array = array(

array('id' => '0', 'text' => TEXT_ORG_DISCOUNT_TYPE_NONE),

array('id' => '1', 'text' => TEXT_ORG_DISCOUNT_TYPE_EDUCATION),

array('id' => '2', 'text' => TEXT_ORG_DISCOUNT_TYPE_GOVERNMENT));

// END - Tax Exempt and Organization Discounts

global $languages_id;

$this->total_virtual = 0; // ICW Gift Voucher System

$this->total = 0;

$this->weight = 0;

if (!is_array($this->contents)) return 0;

$pf = new PriceFormatter;

 

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$qty = $this->contents[$products_id]['qty'];

 

// products price

if ($product = $pf->loadProduct($products_id, $languages_id)) {

// ICW ORDER TOTAL CREDIT CLASS Start Amendment

$no_count = 1;

$gv_query = tep_db_query("select products_model, products_education_discount, products_government_discount from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$gv_result = tep_db_fetch_array($gv_query);

if (ereg('^GIFT', $gv_result['products_model'])) {

$no_count = 0;

}

// ICW ORDER TOTAL CREDIT CLASS End Amendment

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $pf->computePrice($qty);

$products_weight = $product['products_weight'];

// BEGIN - Tax Exempt and Organization Discounts

$products_education_discount = $product['products_education_discount'];

$products_government_discount = $product['products_government_discount'];

// END - Tax Exempt and Organization Discounts

 

$this->total_virtual += tep_add_tax($products_price, $products_tax) * $qty * $no_count;// ICW CREDIT CLASS;

$this->weight_virtual += ($qty * $products_weight) * $no_count;// ICW CREDIT CLASS;

// BEGIN - Tax Exempt and Organization Discounts

// old $this->total += tep_add_tax($products_price, $products_tax) * $qty;

$product_total = tep_add_tax($products_price, $products_tax) * $qty;

// END - Tax Exempt and Organization Discounts

$this->weight += ($qty * $products_weight);

}

 

// attributes price

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");

$attribute_price = tep_db_fetch_array($attribute_price_query);

if ($attribute_price['price_prefix'] == '+') {

// BEGIN - Tax Exempt and Organization Discounts

// old $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

$product_total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

// END - Tax Exempt and Organization Discounts

} else {

// BEGIN - Tax Exempt and Organization Discounts

// old $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

$product_total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);

// END - Tax Exempt and Organization Discounts

}

}

}

// BEGIN - Tax Exempt and Organization Discounts

 

// organization discount

 

if ($customer_id > 0) {

 

$discount_type_query = tep_db_query("select o.org_type_discount from " . TABLE_ORGANIZATION_TYPE . " as o, " . TABLE_CUSTOMERS . " as c where o.org_type_id = c.customers_org_type and c.customers_id = " . $customer_id);

$discount_type_row = tep_db_fetch_array($discount_type_query);

$discount_type = $discount_type_row['org_type_discount'];

 

if ($discount_type_array[$discount_type]['text'] == TEXT_ORG_DISCOUNT_TYPE_GOVERNMENT) {

if ($products_government_discount > 0) {

$product_total -= $product_total * ($products_government_discount / 100);

}

} elseif ($discount_type_array[$discount_type]['text'] == TEXT_ORG_DISCOUNT_TYPE_EDUCATION) {

if ($products_education_discount > 0) {

$product_total -= $product_total * ($products_education_discount / 100);

}

}

}

 

$this->total += $product_total;

 

// END - Tax Exempt and Organization Discounts

}

}

 

function attributes_price($products_id) {

$attributes_price = 0;

 

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {

$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");

$attribute_price = tep_db_fetch_array($attribute_price_query);

if ($attribute_price['price_prefix'] == '+') {

$attributes_price += $attribute_price['options_values_price'];

} else {

$attributes_price -= $attribute_price['options_values_price'];

}

}

}

 

return $attributes_price;

}

 

function get_products() {

// BEGIN - Tax Exempt and Organization Discounts

// old: global $languages_id;

global $languages_id, $customer_id;

// END - Tax Exempt and Organization Discounts

 

if (!is_array($this->contents)) return false;

$pf = new PriceFormatter;

 

$products_array = array();

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

if ($products = $pf->loadProduct($products_id, $languages_id)) {

 

// BEGIN - Tax Exempt and Organization Discounts

$products_eligible_discounts = $products['products_eligible_discounts'];

$products_education_discount = $products['products_education_discount'];

$products_government_discount = $products['products_government_discount'];

$products_gsa_pricing = $products['products_gsa_pricing'];

// END - Tax Exempt and Organization Discounts

 

$products_price = $pf->computePrice($this->contents[$products_id]['qty']);

 

//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.

$products_array[] = array('id' => $products_id,

'name' => $products['products_name'],

'model' => $products['products_model'],

'image' => $products['products_image'],

'price' => $products_price,

'quantity' => $this->contents[$products_id]['qty'],

'weight' => $products['products_weight'],

'length' => $products['products_length'],

'width' => $products['products_width'],

'height' => $products['products_height'],

'ready_to_ship' => $products['products_ready_to_ship'],

'final_price' => ($products_price + $this->attributes_price($products_id)),

'tax_class_id' => $products['products_tax_class_id'],

// BEGIN - Tax Exempt and Organization Discounts

// old 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''),

// old 'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : ''));

'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''),

'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : ''),

'eligible_discounts' => $products_eligible_discounts,

'education_discount' => $products_education_discount,

'government_discount' => $products_government_discount,

'gsa_pricing' => $products_gsa_pricing);

// END - Tax Exempt and Organization Discounts

}

}

 

return $products_array;

}

 

function show_total() {

$this->calculate();

 

return $this->total;

}

 

function show_weight() {

$this->calculate();

 

return $this->weight;

}

// CREDIT CLASS Start Amendment

function show_total_virtual() {

$this->calculate();

 

return $this->total_virtual;

}

 

function show_weight_virtual() {

$this->calculate();

 

return $this->weight_virtual;

}

// CREDIT CLASS End Amendment

 

function generate_cart_id($length = 5) {

return tep_create_random_value($length, 'digits');

}

 

function get_content_type() {

$this->content_type = false;

 

if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

if (isset($this->contents[$products_id]['attributes'])) {

reset($this->contents[$products_id]['attributes']);

while (list(, $value) = each($this->contents[$products_id]['attributes'])) {

$virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");

$virtual_check = tep_db_fetch_array($virtual_check_query);

 

if ($virtual_check['total'] > 0) {

switch ($this->content_type) {

case 'physical':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'virtual';

break;

}

} else {

switch ($this->content_type) {

case 'virtual':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'physical';

break;

}

}

}

// ICW ADDED CREDIT CLASS - Begin

} elseif ($this->show_weight() == 0) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$virtual_check_query = tep_db_query("select products_weight, products_length, products_width, products_height, products_ready_to_ship from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");

$virtual_check = tep_db_fetch_array($virtual_check_query);

if ($virtual_check['products_weight'] == 0) {

switch ($this->content_type) {

case 'physical':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'virtual';

break;

}

} else {

switch ($this->content_type) {

case 'virtual':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'physical';

break;

}

}

}

// ICW ADDED CREDIT CLASS - End

} else {

switch ($this->content_type) {

case 'virtual':

$this->content_type = 'mixed';

 

return $this->content_type;

break;

default:

$this->content_type = 'physical';

break;

}

}

}

} else {

$this->content_type = 'physical';

}

 

return $this->content_type;

}

 

function unserialize($broken) {

for(reset($broken);$kv=each($broken);) {

$key=$kv['key'];

if (gettype($this->$key)!="user function")

$this->$key=$kv['value'];

}

}

 

// ------------------------ ICW CREDIT CLASS Gift Voucher Addittion-------------------------------Start

// amend count_contents to show nil contents for shipping

// as we don't want to quote for 'virtual' item

// GLOBAL CONSTANTS if NO_COUNT_ZERO_WEIGHT is true then we don't count any product with a weight

// which is less than or equal to MINIMUM_WEIGHT

// otherwise we just don't count gift certificates

 

function count_contents_virtual() { // get total number of items in cart disregard gift vouchers

$total_items = 0;

if (is_array($this->contents)) {

reset($this->contents);

while (list($products_id, ) = each($this->contents)) {

$no_count = false;

$gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");

$gv_result = tep_db_fetch_array($gv_query);

if (ereg('^GIFT', $gv_result['products_model'])) {

$no_count=true;

}

if (NO_COUNT_ZERO_WEIGHT == 1) {

$gv_query = tep_db_query("select products_weight, products_length, products_width, products_height, products_ready_to_ship from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($products_id) . "'");

$gv_result=tep_db_fetch_array($gv_query);

if ($gv_result['products_weight']<=MINIMUM_WEIGHT) {

$no_count=true;

}

}

if (!$no_count) $total_items += $this->get_quantity($products_id);

}

}

return $total_items;

}

// ------------------------ ICW CREDIT CLASS Gift Voucher Addittion-------------------------------End

}

 

?>

Link to comment
Share on other sites

The $products_query in my includes/classes/shopping_cart.php is different from the original and I'm not sure where exactly to include length, width, height, and ready-to-ship. Here is my file below. Please let me know if I missed anything.

From the looks of it is highly likely that you didn't add those fields to the $sql in the class PriceFormatter.php (function loadProduct).

 

If you use version 1.2.3 of Quantity Price Breaks Per Product you would also need to add it to the $sql in function PriceFormatterStore (class PriceFormatterStore) and make the necessary changes to the function addPriceBreakData in that class like:

				'products_length' => $productinfo['products_length'],

etcetera.

Link to comment
Share on other sites

From the looks of it is highly likely that you didn't add those fields to the $sql in the class PriceFormatter.php (function loadProduct).

 

If you use version 1.2.3 of Quantity Price Breaks Per Product you would also need to add it to the $sql in function PriceFormatterStore (class PriceFormatterStore) and make the necessary changes to the function addPriceBreakData in that class like:

				'products_length' => $productinfo['products_length'],

etcetera.

Thanks for your help, Jan. I added length, width, height to the $sql query in the class PriceFormatter.php and now I'm getting the quotes from UPS. The only problem is the quotes are high. If, for example, I add to the shopping cart product: weight 3.1LB, length 22", width 16", height 2" the quotes are very close to real quotes from UPS web site. However, if I add another product with weight 0.3LB, length 9", width 6", height 1" it shows 2 pkg(s), 6 lbs total and double quotes from UPS. That's way too high and, more over, I'm using just one box to ship these two products and not two and the total weight is max 4LBs, not 6LBs. Is there something I'm doing wrong and how can I fix it?

 

Thanks.

Link to comment
Share on other sites

Is there something I'm doing wrong and how can I fix it?

So far I haven't met anyone here who is psychic.... Debug, debug, debug. Use that code I showed to see what info it is getting now. A few lines further is a piece of code with "Boxes to ship" that can be uncommented. See what that shows.

Link to comment
Share on other sites

Sounds like a terrible hack to me. For starters: what if the customers deletes the second box in the shopping_cart page?

 

Perhaps you would like to test this (I haven't tested this with a split product with attributes but I coded it with that in mind):

<code>

----------------

Use phpMyAdmin or similar tool to insert the split products into the table products_split

Make sure the value_fraction (and weight_fraction similarly) for the entries for a products_id add up to 1 (otherwise the weight shown to the customer doesn't equal the weight that UPS uses for the calculation, the splitting of the value will have ramifications on insurance values!)[/code]

Apart from the fact that it hasn't got an admin part it is terribly flexible. You can split a product in any number of items, ready-to-ship or not (for example if it consists of a large ready-to-ship item and a smaller item that can be packed with other things).

 

Well, your right, that probably isn't the best method to go after what I'm looking for. Even though I can hack through someone else's code to make what I need, I am not close to understanding everything that goes in in an order process yet.

 

I think that your method has a lot of merit and I will integrate it into the code sometime tomorrow (I hope) and get back with you on it. Even though there isn't an admin panel, the number of products that we need to do this for isn't high enough to make it a pain to do through phpmyadmin until the time comes when someone has a few spare minutes to rub together to make it nice.

 

Thanks for the help. You've saved my bacon (hopefully)....

Link to comment
Share on other sites

So far I haven't met anyone here who is psychic.... Debug, debug, debug. Use that code I showed to see what info it is getting now. A few lines further is a piece of code with "Boxes to ship" that can be uncommented. See what that shows.

Jan, I'd like to thank you for all your help with configuring this module. It works fine and the quotes are very close to real. The only thing I'd like to add is an option to display or hide package weight in admin/modules/shipping/UPS XML module configuration. Below is how I think to modify the code. I just what to know your opinion on this. I hope you can help me with this one, please.

$upsQuote = $this->_upsGetQuote();

if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) {

if (MODULE_SHIPPING_UPSXML_WEIGHT1 == 'True') {

if ($this->dimensions_support > 0) {

$this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,0) . ' ' . strtolower($this->unit_weight) . ' total)');

} else {

$this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . round($shipping_weight,0) . ' ' . strtolower($this->unit_weight) . ' total)');

} else {

$this->quotes = array('id' => $this->code, 'module' => $this->title);

}

then add the following db query to the function install():

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Weight', 'MODULE_SHIPPING_UPSXML_WEIGHT1', 'True', 'Do you want to show package weight?', '6', '27', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

and lastly add to the function keys():

'MODULE_SHIPPING_UPSXML_WEIGHT1'
Link to comment
Share on other sites

Hi Jan,

 

We are running into another problem with a shipping certain scenario. We have the cart set up so that there is a maximum weight of 50 lbs that goes into any one box for most items. But we have some single products that are over 50 lbs. The cart then separates these single products into 2 boxes. Is there a way to make the shopping cart put these items into once single box if a single item is over the max weight that should go into one box?

 

I know this sounds a little weird, but we have many heavy products and many light products. We want to limit the weight of a single box that contains multiple pieces to prevent extra charges, but still have the heavier single items be considered a 1 box item. I hope I'm making this issue understandable. Thanks.

Link to comment
Share on other sites

Sounds like a terrible hack to me. For starters: what if the customers deletes the second box in the shopping_cart page?

 

Perhaps you would like to test this (I haven't tested this with a split product with attributes but I coded it with that in mind):

 

Jan that worked like a charm! Excellent work. And so fast to! I don't know if you are a man or a woman, but I'd kiss you on the lips for this either way! Thank you, Thank you!

Link to comment
Share on other sites

Below is how I think to modify the code. I just what to know your opinion on this.
Looks OK to me, although I think there is one } missing in the first piece of code:

$upsQuote = $this->_upsGetQuote();
if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) {
if (MODULE_SHIPPING_UPSXML_WEIGHT1 == 'True') {
if ($this->dimensions_support > 0) {
$this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
} else {
$this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . round($shipping_weight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
} // extra } added
} else {
$this->quotes = array('id' => $this->code, 'module' => $this->title);
}

Link to comment
Share on other sites

We want to limit the weight of a single box that contains multiple pieces to prevent extra charges, but still have the heavier single items be considered a 1 box item. I hope I'm making this issue understandable.

You can't solve that by making that particular product ready-to-ship? It would mean installing the dimensions stuff on that site, but you don't need to enter all dimensions for all products. Just of the ready-to-ship items.

Link to comment
Share on other sites

Thanks for the contribution and all the helpful support.

 

I have a couple of questions that I couldn't find answers to in the forum.

 

First I would like to add a COD fee for each box. I found the value $shipping_num_boxes in upsxml.php but I don't know how to access that value in ot_cod_fee.php. I don't believe the number of boxes is stored in the database. I have written some basic programs with php but am struggling to understand classes and functions especially with oscommerce so I am trying to be very careful about changing anything in those areas.

 

Second is there a contribution that works with upsxml that gives shipping quotes without going through the entire checkout process? Something that would take the contents of a shopping cart and a zip code and estimate UPS shipping charges?

 

Thanks again for all the wonderful support.

Link to comment
Share on other sites

First I would like to add a COD fee for each box. I found the value $shipping_num_boxes in upsxml.php but I don't know how to access that value in ot_cod_fee.php. I don't believe the number of boxes is stored in the database.
That is indeed not available from the database as such. Actually, it is calculated in the class shipping.php (available as a global) and only accurate when you don't use the dimensions support part (additional stuff to install) of upsxml.

 

You might perhaps add it to the page in a hidden field and store it in the session (look at how that is done with comments in checkout_shipping.php, looks like the part that starts with: // process the selected shipping method around line 95).

Second is there a contribution that works with upsxml that gives shipping quotes without going through the entire checkout process? Something that would take the contents of a shopping cart and a zip code and estimate UPS shipping charges?

I think there is something like Ship in Cart as a contribution, but in my recollection it uses the "old" UPS shipping method.

Link to comment
Share on other sites

Looks OK to me, although I think there is one } missing in the first piece of code:

$upsQuote = $this->_upsGetQuote();
if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) {
if (MODULE_SHIPPING_UPSXML_WEIGHT1 == 'True') {
if ($this->dimensions_support > 0) {
$this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
} else {
$this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . round($shipping_weight,0) . ' ' . strtolower($this->unit_weight) . ' total)');
} // extra } added
} else {
$this->quotes = array('id' => $this->code, 'module' => $this->title);
}

Something is not right in my code or is missing. I'm just getting a blank input field for the new MODULE_SHIPPING_UPSXML_WEIGHT1 variable. It's not that easy as I thought. :'(

Link to comment
Share on other sites

Something is not right in my code or is missing. I'm just getting a blank input field for the new MODULE_SHIPPING_UPSXML_WEIGHT1 variable. It's not that easy as I thought. :'(

You should have a radio button. Did you de-install UPSXML, then upload the new file and do a new install? If you didn't do a de-install, do it with the new file (shouldn't be a problem) and then install again.

Link to comment
Share on other sites

You should have a radio button. Did you de-install UPSXML, then upload the new file and do a new install? If you didn't do a de-install, do it with the new file (shouldn't be a problem) and then install again.

Yep, this is exactly how I did it: removed, uploaded, installed. No radio button, just a blank input field and not even option name, just a blank space for it. There is something missing in the code. The question is what exactly.

Link to comment
Share on other sites

There is something missing in the code. The question is what exactly.

Just tried the exact same code you posted and the radio buttons come up fine. Can input the settings correctly too...

Link to comment
Share on other sites

Just tried the exact same code you posted and the radio buttons come up fine. Can input the settings correctly too...

Hmm... It's strange. Why it's not working for me? May be because I have cache enabled...

Link to comment
Share on other sites

Hmm... It's strange. Why it's not working for me? May be because I have cache enabled...

I can change value for the new MODULE_SHIPPING_UPSXML_WEIGHT1 field only in database. I don't have those radio buttons in admin UPS XML settings and don't know how to fix it. :'( If I change its value to False in db, it does work, indeed, the package weight is hidden from customers. However, when I change value for "Time in Transit View Type" to either Raw or Detailed, there are no EDDs in checkout_shipping.php. No matter how I play with the settings, no EDD is shown to customer. I didn't even touch that part for Time in Transit. It's playing tricks with me. :(

Link to comment
Share on other sites

hey everyone, i deleted a bunch of shipping methods from includes/modules/shipping/upsxml.php

 

in my admin it only shows teh 4 that i left in the file, but when checking out, i still get a bunch of options that i dont need

Link to comment
Share on other sites

tis ok, i got it figured out...i had configed teh file wrong, leaving in the ones i wanted and taking out the ones i didnt want, when, in fact, it should have been reversed, leaving the ones i dont want and removing the ones i do want :)

Link to comment
Share on other sites

Hello Irin,

 

I hope you can figure it out for yourself. I want to thank you for the code job on this feature. I added the code plus Jan's addition and did what Jan said in removing and reinstalling UPSXML and it works for me just fine with the radio buttons in the Admin backend UPSXML shipping section. I wish I could help you, but I'm just a cut and paster.

 

Best wishes,

 

Alan

Production:
osCommerce V. 2.3.4BS
VPS Box

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