View difference between Paste ID: UPkFXzKB and E6Sv35nS
SHOW: | | - or go back to the newest paste.
1-
function _xmlToQuote(){
1+
function _xmlToQuote(){	
2
		require_once(dirname(__FILE__) . DS . 'include.php');
3
4
		$startTag = 'eparcel/ratesAndServicesResponse/';
5
		require_once(dirname(__FILE__) . DS . 'xmlparser.php');
6
		$xmlParser = new xmlparser();
7
        $array = $xmlParser -> GetXMLTree($this -> xml_response);
8
        
9
        if (!empty($array['EPARCEL'][0]['ERROR'])) {
10
	        $this -> error = true;
11
	        $this -> error_msg = $array['EPARCEL'][0]['ERROR'][0]['STATUSMESSAGE'][0]['VALUE'];
12
	        
13
	        echo '<p>' . $this -> error_msg . '</p>';
14
        } else {
15
        	$this -> error = false;
16
        	$shipping_methods = array();
17
        	
18
        	foreach ($array['EPARCEL'][0]['RATESANDSERVICESRESPONSE'][0]['PRODUCT'] as $product) {
19
	        	$shipping_methods[] = array(
20
	        		'name'					=>	$product['NAME'][0]['VALUE'],
21
	        		'rate'					=>	$product['RATE'][0]['VALUE'],
22
	        		'shippingDate'			=>	$product['SHIPPINGDATE'][0]['VALUE'],
23
	        		'deliveryDate'			=>	$product['DELIVERYDATE'][0]['VALUE'],
24
	        	);
25
        	}
26
        	
27
        	$this -> shipping_methods = $shipping_methods;
28
        
29
        	/*
30
	        $this -> error = false;
31
	        $xd = new MiniXMLDoc($this -> xml_response);
32
	        $startTag = 'eparcel/ratesAndServicesResponse/';
33
	        $this -> statusCode = fetchValue($xd, $startTag . 'statusCode'); 
34
	        $this -> statusMessage = fetchValue($xd, $startTag . 'statusMessage');
35
	        $this -> shipping_comment = fetchValue($xd, $startTag . 'comment') ;
36
			$shipping_fields = array("name", "rate", "shippingDate", "deliveryDate", "deliveryDayOfWeek",  "nextDayAM", "packingID");
37
			$this -> shipping_methods = fetchArray($xd, $startTag, 'product', $shipping_fields);
38
			
39
			echo 1;
40
			$this -> debug($this -> shipping_methods);
41
			*/
42
        }
43
44
        /*
45
		$xd = new MiniXMLDoc($this -> xml_response);		
46
		$this -> statusCode = fetchValue($xd, $startTag . 'statusCode'); 
47
		$this -> statusMessage = fetchValue($xd, $startTag . 'statusMessage');
48
		$this -> error = ('OK' == $this -> statusCode);
49
		$this -> error_msg = $this -> error ? $this -> statusMessage : "";
50
51
		if (!$this -> error) {
52
			$this -> shipping_comment = fetchValue($xd, $startTag . 'comment') ;
53
			$shipping_fields = array("name", "rate", "shippingDate", "deliveryDate", "deliveryDayOfWeek",  "nextDayAM", "packingID");
54
			$this -> shipping_methods = fetchArray($xd, $startTag, 'product', $shipping_fields);
55
		}
56
		*/
57
	}