Jump to content
dmGremlin

[contribution] individual product shipping prices

Recommended Posts

I've pretty much sorted the problems that I was having and they were all due to my template monster template in that the catagories are defined in the header file so deleting catagories.php solved most probs.

 

This contrib is now working but I would like to know if it's possible to make an addition.

 

I would like to add in the exact same way via admin a description of the delivery method so the customers now how the goods will arrive.

 

I.E

 

Shipping Method: Royal Mail - Recorded Delivery

Shipping Rate: ?1.33

 

If you can help then I would be most greatfull.

Share this post


Link to post
Share on other sites

I am getting this error message. I have not seen anyone else with this error message so I am posting. I use a CRE store so that might have something to do with it. The weird part is this error only shows up if an item that has individual shipping set for is put into the shopping cart by itself. So if I put a television with individual shipping set and a carrying case that uses the UPS module it will work fine.

 

Fatal error: Call to a member function on a non-object in /home/includes/classes/shopping_cart.php on line 406

 

<?php
/*
 $Id: shopping_cart.php,v 1.1.1.1 2004/03/04 23:40:47 ccwjr Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class shoppingCart {
var $contents, $total, $weight, $cartID, $content_type;
// mod indvship//phpmom
var $shiptotal;
// end indvship
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');
	}
//ICW ADDDED FOR CREDIT CLASS GV - END
  }

// 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
	$attributes_query = tep_db_query("select products_options_id, products_options_value_id 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'];
	}
  }

  $this->cleanup();
}

function reset($reset_database = false) {
  global $customer_id;

  $this->contents = array();
  $this->total = 0;
  $this->weight = 0;
// mod indvship//phpmom
$this->shiptotal = '';
// end indvship
  $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;

  $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)) {
		$this->contents[$products_id]['attributes'][$option] = $value;
// insert into database
		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) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$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)) {
	  $this->contents[$products_id]['attributes'][$option] = $value;
// update database
	  if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$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;

  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() {
  global $customer_id, $sendto, $ship_zip;
  $this->total_virtual = 0; // ICW Gift Voucher System
  $this->total = 0;
  $this->weight = 0;
  if (!is_array($this->contents)) return 0;
// get delivery postcode
  if (tep_session_is_registered('customer_id')) {
   $address_query = tep_db_query("select entry_postcode from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
   $address = tep_db_fetch_array($address_query);
   $ship_zip = $address['entry_postcode'];
 }

  reset($this->contents);
  while (list($products_id, ) = each($this->contents)) {
	$qty = $this->contents[$products_id]['qty'];

// products price
	$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	if ($product = tep_db_fetch_array($product_query)) {
// ICW ORDER TOTAL CREDIT CLASS Start Amendment
	  $no_count = 1;
	  $gv_query = tep_db_query("select products_model 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'], -1, -1, $ship_zip);		  
	  $products_price = $product['products_price'];
	  $products_weight = $product['products_weight'];

	  $special_price = tep_get_products_special_price($prid);
	  if ($special_price) {
		$products_price = $special_price;
	  }
	  $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;
	  $this->total += tep_add_tax($products_price, $products_tax) * $qty;
	  $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'] == '+') {
		  $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		} else {
		  $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		}
	  }
	}
  }
}

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() {
  global $languages_id;

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

  $products_array = array();
  reset($this->contents);
  while (list($products_id, ) = each($this->contents)) {
	$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
	if ($products = tep_db_fetch_array($products_query)) {
	  $prid = $products['products_id'];
	  $products_price = $products['products_price'];

	  $special_price = tep_get_products_special_price($prid);
	  if ($special_price) {
		$products_price = $special_price;
	  }
// bof indvship
$products_shipping_query = tep_db_query("select products_ship_price, products_ship_price_two, products_ship_zip, products_ship_methods_id from " . TABLE_PRODUCTS_SHIPPING . " where products_id = '" . $products['products_id'] . "'");// hadir//phpmom
$products_shipping = tep_db_fetch_array($products_shipping_query);// eof indvship

	  $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'],
								'final_price' => ($products_price + $this->attributes_price($products_id)),
								'tax_class_id' => $products['products_tax_class_id'],
// bof indvship//phpmom
'products_ship_price' => $products_shipping['products_ship_price'],
'products_ship_price_two' => $products_shipping['products_ship_price_two'],
'products_ship_zip' => $products_shipping['products_ship_zip'],
//end  indvship
								'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
	}
  }

  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() {
global $shipping_modules; //  indv ship
  $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) {
		} elseif (($this->show_weight() == 0) && (tep_not_null($shipping_modules->get_shiptotal()))) {//indv shipping
		reset($this->contents);
		while (list($products_id, ) = each($this->contents)) {
		  $virtual_check_query = tep_db_query("select products_weight 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_weight';
				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'];
  }
}
  // ------------------------ ICWILSON 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 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;
}
// ------------------------ ICWILSON CREDIT CLASS Gift Voucher Addittion-------------------------------End
 }
?>

 

That is from shopping_cart.php

Share this post


Link to post
Share on other sites

I am going through and trying to add all the changes into my store with this product but now I am getting

 

 

Fatal error: Call to undefined function: get_shiptotal() in D:\www\mydomain.com\includes\classes\shipping.php on line 23

 

 

Is this a common issue?

Share this post


Link to post
Share on other sites

I would like to use the contribution to be able to establish shipping price for:

 

product a - one shipping cost, $20.00 (a lot of different model numbers) to the 48 cont. states

product b - one shipping cost, $15.00 (a lot of different model numbers) to the 48 cont. states

product c - e would be free shipping to the 48 cont. states

 

International, Alaska & Hawaii would require a quote..I think I found the contribution for that; still making sure by reading all the topics and support topics

 

Would your contribution be suitable for my needs?

 

Thanks for all the support help you have given in the other topics that I have read

Share this post


Link to post
Share on other sites

I have this problem stated below.

 

TEXT_PRODUCTS_ZIPCODE [input box] null

Indv. Shipping Price:[input box] null

Each Additional Price:[input box] null

 

 

 

 

I have put a define for TEXT_PRODUCTS_ZIPCODE, but the others still appear null. the values I insert don't get saved.

 

 

Can anyone help?

Share this post


Link to post
Share on other sites

Further I get

 

 

Fatal error: Call to a member function on a non-object in D:\www\mydomain.com\includes\classes\shopping_cart.php on line 403

 

 

line 403 from shopping_cart.php

 

} elseif (($this->show_weight() == 0) && (tep_not_null($shipping_modules->get_shiptotal()))) {

 

 

I'm guessing that we don't know about $shipping_modules->get_shiptotal()

 

However, a few lines above that we have:

 

function get_content_type() {

// indv ship

global $shipping_modules;

// indv ship

 

 

 

This is the same as nilusprotocol's error.

 

 

 

I have this problem stated below.

 

TEXT_PRODUCTS_ZIPCODE [input box] null

Indv. Shipping Price:[input box] null

Each Additional Price:[input box] null

I have put a define for TEXT_PRODUCTS_ZIPCODE, but the others still appear null. the values I insert don't get saved.

Can anyone help?

Share this post


Link to post
Share on other sites

How to charge shipping only once per multiple product?

 

For example:

 

Item shipping cost is $5, when a customer add 3 items I want the shipping price for this item to be $5 instead of $15.

 

Help :blink:

Share this post


Link to post
Share on other sites

I just installed this contribution on a clean install of OSC's latest version.

 

I ran the SQL command and uploaded the files to their folders

 

I went to add a product and the Individual Shipping field is present

 

I went to Admin - Modules - Shipping and there is no Individual Shipping listed there to select

 

I repeated the above installation (except the SQL command) with the same end result

 

Also I did a test purchase and when I select CHECKOUT, I get the following error:

 

Fatal error: Call to undefined function: tep_get_configuration_key_value() in /hsphere/local/home/antique9/jrantiquesandgifts.com/catalog/checkout_shipping.php on line 18

 

Any suggestions would be greatly appreciated.

 

Michael

Share this post


Link to post
Share on other sites

After a lot of fighting, I got this contribution up and running.

 

One question. The software will multiply any shipping value I assign by 3 when it is displayed on the checkout. For example, if I input shipping as $2 it will appear as $6 in the cart. I can input the numbers to get around that, but it's a bit frustrating...

 

Any suggestions?

Share this post


Link to post
Share on other sites

I have a online digital magazine shop, customers can download the digital magazine after they finish payment process so there is no shipping fee. There are two prices per magazine, the single issue price and the subscribe price, and I want to show the two prices at porduct_info page, but the contribution only list these individual product prices at shipping page.

 

help me... thanks.

Share this post


Link to post
Share on other sites

tallwang

This is a SHIPPING price contribution not a PRODUCT ATTRIBUTE price one.

 

gezuvor

admin>configuration>shipping there is a setting for that.


q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| )

Share this post


Link to post
Share on other sites
tallwang

This is a SHIPPING price contribution not a PRODUCT ATTRIBUTE price one.

 

gezuvor

admin>configuration>shipping there is a setting for that.

 

thanks. but how to solve my question??

Share this post


Link to post
Share on other sites
tallwang

This is a SHIPPING price contribution not a PRODUCT ATTRIBUTE price one.

 

gezuvor

admin>configuration>shipping there is a setting for that.

 

Not sure if this has been answer but it is very confusing to follow the changes in thin modd.

I am getting this error!

1146 - Table 'bnmxgrp_xstore1.TABLE_PRODUCTS_SHIPPING' doesn't exist

 

SELECT * FROM TABLE_PRODUCTS_SHIPPING WHERE products_id=33

 

[TEP STOP]

 

When I go to edit the product info in admin. I thought the directions said to remove this table? If you have values in the table and you remove it it does not replace thouse if you add the table back in does it?

Share this post


Link to post
Share on other sites

Hi,

 

*For Multiple Orders*

 

Does anyone know if it is possible to make this contribution add the highest and lowest delivery costs together? ie, if a customer orders 3 items it will only add the highest delivery chanrge and the lowest delivery charge to create one final shipping charge.

 

Many Thanks

Share this post


Link to post
Share on other sites
I am going through and trying to add all the changes into my store with this product but now I am getting

Fatal error: Call to undefined function: get_shiptotal() in D:\www\mydomain.com\includes\classes\shipping.php on line 23

Is this a common issue?

 

Did you ever get this resolved?

Share this post


Link to post
Share on other sites
tallwang

This is a SHIPPING price contribution not a PRODUCT ATTRIBUTE price one.

 

gezuvor

admin>configuration>shipping there is a setting for that.

 

 

This would be a great mod if I can just get it to work. I have spent the last 3 days chasing errors, one after another. I have over 30 mods to my site and have not had this much trouble. The original one works fine but I like the functionality of crashwave's hacks. I had similar experience with The Easypopulate contribution. I had to give up on that one. I really really do not want to give up on this one.

 

With that being said here is were I am:

I am using php 5/mysql 5, the latest osc release, many mods to my site.

 

I first started with this error:

1146 - Table 'bnmxgrp_xstore1.TABLE_PRODUCTS_SHIPPING' doesn't exist

 

SELECT * FROM TABLE_PRODUCTS_SHIPPING WHERE products_id=33

 

[TEP STOP]

 

This is what happened when trying to install the original version and it says DROP TABLE IF EXISTS `products_shipping`;. This was not a good idea for me for whatever reason. So I restored my db and files and tried to load 4.1. I then get this error:

Parse error: parse error, unexpected T_DOUBLE_ARROW in /home/httpd/vhosts/impsportclothing.com/httpdocs/includes/classes/shopping_cart.php on line 326

I find out how to fix that, I then get this error:

Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/httpd/vhosts/artmozambique.com/httpdocs/catalog/includes/classes/shopping_cart.php on line 17. I had to make some changes to the code

//START COMMENT IF YOU DO NOT HAVE FREE SHIPPING MODULE

// BOF: WebMakers.com Added: Downloads Controller - Free Shipping and Payments

// Show either normal shipping modules or free shipping module when Free Shipping Module is On

// Free Shipping Only

elseif ((tep_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS')) && $cart->show_weight()==0 && ($shiptotal == '0' || !$shiptotal)) {

$include_modules[] = array('class'=> 'freeshipper', 'file' => 'freeshipper.php');

 

//END COMMENT IF YOU DO NOT HAVE FREE SHIPPING MODULE

// All Other Shipping Modules

} else { if(sizeof($products)>$indvcount){

while (list(, $value) = each($this->modules)) { //try foreach is faster//hadir

$class = substr($value, 0, strrpos($value, '.'));

// Don't show Free Shipping Module

if (($class !='freeshipper')/* && ($class != 'indvship')*/) {

$include_modules[] = array('class' => $class, 'file' => $value);

}

}

}

}//COMMENT IF YOU DO NOT HAVE FREE SHIPPING MODULE and you commented above

 

I had to play around with moving }'s since I commented out what was instructed.

After that I got and error saying unexpected $end... so I added another } around the bottom of classes/shipping.php

 

I then got the error from post #399 and 401 because I didn't use the very most up-to-date fix (crazy):

CODE

$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'],

/////////INDV SHIP/////////

'invcost' => $shipping_modules->get_shiptotal());

 

now I am getting this error:

Fatal error: Call to undefined function: get_shiptotal() in /usr/local/4admin/apache/vhosts/bnm-group.com/httpdocs/onlinestore/catalog/includes/classes/shipping.php on line 24

 

I am pretty sure this is not the last one! Could really use some help from the pros of this contribution! :blink: :(

Share this post


Link to post
Share on other sites

I have a very simple question. :blush: I am using OSCommerce 2.2 MS2 (051113), PHP version 4.3.11, and MySQL version 4.0.25-standard on a Unix server running Apache version 1.3.34. I have not installed any other contributions yet, so I should be able to simply copy and paste these files into my installation without modification, right? I tried first to install the V2.0 for installation on a FRESH OSC install, but that gave me an error saying that I must have register globals on? :blink: I am unable to turn them on, and wouldn't want to even if I could. Is this a known issue? Is there a fix for this problem? I may be asking something others have asked, but after reading 13 pages of this forum, I just decided to ask.

 

Basically, what I am asking is this:

Is there an easy way to install this contribution on a fresh OSC install with the register globals fix already installed without turning register globals on?

 

I have not yet tried manually making the modifications to the files rather than overwriting (which I will be trying while you are all reading this) but if doing this step by step manually does not work, then I am at a loss, and I really would like to get this contribution working. :(

 

Thank you all in advance for any help with this installation. I am somewhat new to OSC, but I am relatively familiar with PHP and very familiar with SQL. Thanks again for the help! :D

 

Jon

"I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams

Share this post


Link to post
Share on other sites

Nevermind my previous question, I got it working. I have a question for those of you who are more advanced with PHP scripting. I noticed that there were a few questions about being able to only charge the highest priced first shipping, and have all other items only charge the secondary shipping price for all of the items... Well, here is my idea for that. Since I do not know deeper level php (arrays and such) this is in pseudo code. Please let me know if anyone can turn this into working code:

 

create an array:

-------------------------------Fields to store in the array:

array[sizeof($products)](products_ship_price, products_ship_price_two)

 

As the calculate shipping occurs (at about 114 in classes/shipping.php), fill the array with each product's two prices.

 

sort the array from highest to lowest products_ship_price

 

create $shipping_price_correction

 

for ($i=1, $n=sizeof($products); $i<$n; $i++) { //Skip the highest priced shipping (we wanted it charged full price)

$shipping_price_correction += (array[$i](products_ship_price) - array[$i](products_ship_price_two))

}

$this->shiptotal += -$shipping_price_correction

 

That would charge the highest first shipping price, and still subtract the correct amount to make the cheaper shipping charged as the secondary shipping price for each item.

 

If any of you (especially phpmom with her obvious mad skills in php) would be willing to turn this into actual code, that would be wonderful. I will be working on it myself, but I still have to learn all of the PHP before I can start coding. For some, this would take less than a half hour to code. If you would be so kind, I would be very greatful for the addition to this wonderful contribution.

 

Thanks,

Jon

"I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams

Edited by falkner

Share this post


Link to post
Share on other sites
Nevermind my previous question, I got it working. I have a question for those of you who are more advanced with PHP scripting. I noticed that there were a few questions about being able to only charge the highest priced first shipping, and have all other items only charge the secondary shipping price for all of the items... Well, here is my idea for that. Since I do not know deeper level php (arrays and such) this is in pseudo code. Please let me know if anyone can turn this into working code:

 

create an array:

-------------------------------Fields to store in the array:

array[sizeof($products)](products_ship_price, products_ship_price_two)

 

As the calculate shipping occurs (at about 114 in classes/shipping.php), fill the array with each product's two prices.

 

sort the array from highest to lowest products_ship_price

 

create $shipping_price_correction

 

for ($i=1, $n=sizeof($products); $i<$n; $i++) { //Skip the highest priced shipping (we wanted it charged full price)

$shipping_price_correction += (array[$i](products_ship_price) - array[$i](products_ship_price_two))

}

$this->shiptotal += -$shipping_price_correction

 

That would charge the highest first shipping price, and still subtract the correct amount to make the cheaper shipping charged as the secondary shipping price for each item.

 

If any of you (especially phpmom with her obvious mad skills in php) would be willing to turn this into actual code, that would be wonderful. I will be working on it myself, but I still have to learn all of the PHP before I can start coding. For some, this would take less than a half hour to code. If you would be so kind, I would be very greatful for the addition to this wonderful contribution.

 

Thanks,

Jon

"I love deadlines. I like the whooshing sound they make as they fly by." - Douglas Adams

Share this post


Link to post
Share on other sites

Hi Everyone!

 

Is there any compilation done with all the files modified for a fresh OSC? I am not that excellent at scripting so I am not sure modifying 12 files would be the best to do for me...

 

Thanks!

Share this post


Link to post
Share on other sites

Hello All,

 

I have a tricky problem! I have searched through the forums for a couple of days now and did find several attempted solutions with varying degrees of success, but not for me!

 

I get this error:

 

Fatal error: Cannot redeclare class shipping in /catalog/includes/classes/shipping.php on line 13

 

When I place an item in my cart and try to proceed to checkout.

 

After too many attempts to correct this issue have crashed and burned for me I think I need to look at things a little differently. Is anyone willing to send their code? What I would like to see is a checkout_shipping.php from a working site using this contrib. I beleive this is the file that is causing the second attempt to initiate class shipping, however, I'm not sure why and exactly how. Each instance in the code serves a certain necessary purpose. So, if anyone out there has had this problem and were able to solve it on your own (answers I found in this forum did not work for me) please post here or PM me. I will continue to break my brain over this and post my unique answer, if I get there!

 

Thank you!


James Tomasello

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×