All pastes #403241 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-20 07:56 UTC
rendered paste body
	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;
				
			}
			
		}

<?php if(is_numeric($this->shipping->shippingTotal($shipping_location))): ?>
    <input type="submit" value="Pay »" />
<?php else: ?>
    <?=$this->shipping->shippingTotal($shipping_location)?>
<?php endif; ?>