Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _xmlToQuote(){
- require_once(dirname(__FILE__) . DS . 'include.php');
- $startTag = 'eparcel/ratesAndServicesResponse/';
- require_once(dirname(__FILE__) . DS . 'xmlparser.php');
- $xmlParser = new xmlparser();
- $array = $xmlParser -> GetXMLTree($this -> xml_response);
- if (!empty($array['EPARCEL'][0]['ERROR'])) {
- $this -> error = true;
- $this -> error_msg = $array['EPARCEL'][0]['ERROR'][0]['STATUSMESSAGE'][0]['VALUE'];
- echo '<p>' . $this -> error_msg . '</p>';
- } else {
- $this -> error = false;
- $shipping_methods = array();
- foreach ($array['EPARCEL'][0]['RATESANDSERVICESRESPONSE'][0]['PRODUCT'] as $product) {
- $shipping_methods[] = array(
- 'name' => $product['NAME'][0]['VALUE'],
- 'rate' => $product['RATE'][0]['VALUE'],
- 'shippingDate' => $product['SHIPPINGDATE'][0]['VALUE'],
- 'deliveryDate' => $product['DELIVERYDATE'][0]['VALUE'],
- );
- }
- $this -> shipping_methods = $shipping_methods;
- /*
- $this -> error = false;
- $xd = new MiniXMLDoc($this -> xml_response);
- $startTag = 'eparcel/ratesAndServicesResponse/';
- $this -> statusCode = fetchValue($xd, $startTag . 'statusCode');
- $this -> statusMessage = fetchValue($xd, $startTag . 'statusMessage');
- $this -> shipping_comment = fetchValue($xd, $startTag . 'comment') ;
- $shipping_fields = array("name", "rate", "shippingDate", "deliveryDate", "deliveryDayOfWeek", "nextDayAM", "packingID");
- $this -> shipping_methods = fetchArray($xd, $startTag, 'product', $shipping_fields);
- echo 1;
- $this -> debug($this -> shipping_methods);
- */
- }
- /*
- $xd = new MiniXMLDoc($this -> xml_response);
- $this -> statusCode = fetchValue($xd, $startTag . 'statusCode');
- $this -> statusMessage = fetchValue($xd, $startTag . 'statusMessage');
- $this -> error = ('OK' == $this -> statusCode);
- $this -> error_msg = $this -> error ? $this -> statusMessage : "";
- if (!$this -> error) {
- $this -> shipping_comment = fetchValue($xd, $startTag . 'comment') ;
- $shipping_fields = array("name", "rate", "shippingDate", "deliveryDate", "deliveryDayOfWeek", "nextDayAM", "packingID");
- $this -> shipping_methods = fetchArray($xd, $startTag, 'product', $shipping_fields);
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment