Ejemplo n.º 1
0
    public function sendAcknowledgeResponse($status)
    {
        $response = <<<XML
<acknowledgeResponse>
\t<responseStatus>{$status}</responseStatus>
</acknowledgeResponse>
XML;
        Vikont_EVOConnector_Helper_Data::sendResponse($response);
    }
Ejemplo n.º 2
0
 public function orderAction()
 {
     $this->_authenticate();
     $requestBody = file_get_contents('php://input');
     Vikont_EVOConnector_Model_Log::log(sprintf('order action, request is: %s, body is: %s', $_SERVER['REQUEST_URI'], $requestBody));
     $requestXML = Vikont_EVOConnector_Helper_Data::parseXML($requestBody);
     if (!$requestXML) {
         Mage::helper('evoc/order')->sendAcknowledgeResponse('FAILURE');
         return;
     }
     $marker = 'evoc/index/order/';
     $uri = strtolower($_SERVER['REQUEST_URI']);
     $paramURIPart = trim(substr($uri, strlen($marker) + stripos($uri, $marker)), '/');
     if (false !== strpos($paramURIPart, '/item/')) {
         $itemId = null;
         @(list($orderId, $itemId) = explode('/item/', $paramURIPart));
         Mage::helper('evoc/order')->orderItem($orderId, $itemId, $requestXML);
         return;
     } elseif (false !== strpos($paramURIPart, '/shipment')) {
         // this is for order items shipment
         list($orderId) = explode('/shipment', $paramURIPart);
         Mage::helper('evoc/order')->orderShipment($orderId, $requestXML);
         return;
     } else {
         $orderId = $paramURIPart;
         Mage::helper('evoc/order')->orderVoid($orderId, $requestXML);
         return;
     }
 }
Ejemplo n.º 3
0
 public function testAction()
 {
     Vikont_EVOConnector_Helper_Data::sendResponse(Vikont_EVOConnector_Helper_Data::array2xml(array('root' => array('a' => 'b', 'spec' => '<&">', 'rus' => 'ёпрст'))));
 }
Ejemplo n.º 4
0
 protected function _getDistributorInfo($sku)
 {
     $result = array('itemNumber' => $sku, 'manufacturerID' => null, 'manufacturerName' => null, 'comment' => null);
     $data = Vikont_EVOConnector_Helper_OEM::getPartNumbers($sku);
     if ($data && is_array($data) && count($data)) {
         $data = reset($data);
     } else {
         return $result;
     }
     if ($data['d_trocky']) {
         $result['itemNumber'] = $data['d_trocky'];
         $result['manufacturerID'] = 'TR';
         $result['manufacturerName'] = 'Tucker Rocky';
         $result['comment'] = Vikont_EVOConnector_Helper_Data::combineArray(array('TR' => $data['d_trocky'], 'WP' => $data['d_wpower'], 'PU' => $data['d_punlim']));
     } else {
         if ($data['d_wpower']) {
             $result['itemNumber'] = $data['d_wpower'];
             $result['manufacturerID'] = 'WP';
             $result['manufacturerName'] = 'Western Power Sports';
             $result['comment'] = Vikont_EVOConnector_Helper_Data::combineArray(array('TR' => $data['d_trocky'], 'WP' => $data['d_wpower'], 'PU' => $data['d_punlim']));
         } else {
             if ($data['d_punlim']) {
                 $result['itemNumber'] = $data['d_punlim'];
                 $result['manufacturerID'] = 'PU';
                 $result['manufacturerName'] = 'Parts Unlimited';
                 $result['comment'] = Vikont_EVOConnector_Helper_Data::combineArray(array('TR' => $data['d_trocky'], 'WP' => $data['d_wpower'], 'PU' => $data['d_punlim']));
             } else {
                 $fields = Vikont_EVOConnector_Helper_Data::getDistributors();
                 unset($fields['TR']);
                 unset($fields['WP']);
                 unset($fields['PU']);
                 foreach ($fields as $tmsCode => $field) {
                     if ($data[$field[0]]) {
                         $result['itemNumber'] = $data[$field[0]];
                         $result['manufacturerID'] = $tmsCode;
                         $result['manufacturerName'] = $field[1];
                         break;
                     }
                 }
             }
         }
     }
     return $result;
 }