<?php
class CalculateShipping extends Calculate {  
	function __construct(&$locator) {		
		$this->cart     =& $locator->get('cart');
		$this->config   =& $locator->get('config');
		$this->currency =& $locator->get('currency');
		$this->language =& $locator->get('language');
		$this->session  =& $locator->get('session');
		$this->shipping =& $locator->get('shipping');
		$this->tax      =& $locator->get('tax');
		
		$this->language->load('extension/calculate/shipping.php');
  	}
			
  	function calculate() {
		$total_data = array();
		
		//if (($this->config->get('shipping_status')) && ($this->cart->hasShipping())) { 
			$total_data[] = array(
        		'title' => 'Shipping['.$this->session->get('shipping_name').']:',
        		'text'  => '+'.$this->currency->format($this->session->get('shipping_cost')),
        		'value' => round($this->session->get('shipping_cost'), 2)
      		);
			
//			$this->cart->increaseTotal($this->tax->calculate($this->session->get('shipping_cost'), $this->shipping->getTaxClassId($this->session->get('shipping_cost'))));
//			$this->cart->addTax($this->shipping->getTaxClassId($this->session->get('shipping_cost')), $this->shipping->getCost($this->session->get('shipping_cost')) / 100 * $this->tax->getRate($this->shipping->getTaxClassId($this->session->get('shipping_cost'))));
    	//}
    
		return $total_data;
  	}

	function getSortOrder() {
		return $this->config->get('shipping_sort_order');
	}	
}
?>
