Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Free shipping vs. International shipping (how to charge?)


kilroy13

Recommended Posts

Have a store running. Main product for sale is comics. For comic shipping to US persons shipping is free. I've setup this up by setting the weight of a comic to 0 and the system is setup to do freeship for 0 weight orders. Supplies however do have weight and shipping is charged. If someone orders comics and supplies then they are paying shipping on the supplies only. Works well. But, there is international shipping...

 

There has been a fair amount of international shipping lately. People like the prices. But, we want to charge shipping for international orders on supplies and comics. Someone orders 100 comics and its a lot more pricey.

 

Does anyone have an idea on how to get a work around on this? I've not seen any contribs to handle this and while I've been tooling around and tweaking out code, I'm not sure if I could fully write something to handle this (doing something like fixing weight to comics for international orders only).

 

Thanks all.

Link to comment
Share on other sites

You can try something like this.

 

	  global $order; //Get access to the order info.


	  //Adjust weight for international.			 
	  if (is_object($order) && !empty($order->delivery['country']['id']) && $order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY) {
		if ($product['products_weight'] == 0) {
		  $products_weight = 1;
		}
	  }

 

 

catalog/includes/classes/shopping_cart.php

 

  function calculate() {

  global $order; //Get access to the order info.

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

  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)) {
	  $prid = $product['products_id'];
	  $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
	  $products_price = $product['products_price'];

	  $products_weight = $product['products_weight'];

	  //Adjust weight for international.			 
	  if (is_object($order) && !empty($order->delivery['country']['id']) && $order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY) {
		if ($product['products_weight'] == 0) {
		  $products_weight = 1;
		}
	  }  


	  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }

	  $this->total += tep_add_tax($products_price, $products_tax) * $qty;
	  $this->weight += ($qty * $products_weight);
	}
.......

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...