kilroy13 Posted January 1, 2006 Share Posted January 1, 2006 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 More sharing options...
user99999999 Posted January 1, 2006 Share Posted January 1, 2006 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 More sharing options...
kilroy13 Posted January 2, 2006 Author Share Posted January 2, 2006 This looks helpful. My shopping_cart.php is pretty modified but this should work. Does the first snippet go somewhere else? Link to comment Share on other sites More sharing options...
kilroy13 Posted January 2, 2006 Author Share Posted January 2, 2006 Ah, looks like it will take more work. I have gift certificates installed and I think its conflicting with me being able to reset my product weight. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.