function shippingTotal($location) { switch($location->location_type) { case 'weight': $weight_search = array( 'chart_location' => $location->location_id, 'chart_break >=' => $this->totali_cart->cartWeightTotal(), ); $this->db->orderby('chart_break', 'ASC'); $query = $this->db->getwhere('shipping_charts', $weight_search, 1); if($query->num_rows() == 1) { $shipping_data = $query->row(); return $shipping_data->chart_value; } else { return "Sorry we don't have a rate for your location, please contact us and we'll work one out."; } break; case 'volume': $volume_search = array( 'chart_location' => $location->location_id, 'chart_break >=' => $this->totali_cart->cartVolumeTotal(), ); $this->db->orderby('chart_break', 'ASC'); $query = $this->db->getwhere('shipping_charts', $volume_search, 1); if($query->num_rows() == 1) { $shipping_data = $query->row(); return $shipping_data->chart_value; } else { return "Sorry we don't have a rate for your location, please contact us and we'll work one out."; } break; case 'free': return 0; break; } } shipping->shippingTotal($shipping_location))): ?> shipping->shippingTotal($shipping_location)?>