Esempio n. 1
0
 function calculateCD($to_city, $weight, $length, $width, $height)
 {
     $calc = new CalculatePriceDeliveryCdek();
     $calc->setAuth('5a99149e089c2458efbc99c61e009f03', '02cdb2043ebc63a90029198528188a7e');
     $calc->setSenderCityId('438');
     $calc->setReceiverCityId($to_city);
     $tarifList = array('0' => '10', '1' => '11');
     $calc->setTariffId('11');
     $calc->addTariffPriority($tarifList);
     if ($width != 0 && $weight != 0 && $length != 0 && $height != 0) {
         $calc->addGoodsItemBySize($weight, $length, $width, $height);
     }
     if ($calc->calculate() === true) {
         $res = $calc->getResult();
         return $res;
     } else {
         $err = $calc->getError();
         return $err;
     }
 }
Esempio n. 2
0
 function calculateEkonom($to_city, $weight, $length, $width, $height)
 {
     $calc = new CalculatePriceDeliveryCdek();
     $calc->setAuth('741a658ed104752ff5a4ba27950ba72b', 'e95869780addf13d9753221b36b7bd00');
     $calc->setSenderCityId('44');
     $calc->setReceiverCityId('137');
     $tarifList = array('0' => '5', '1' => '62');
     $calc->setTariffId('5');
     $calc->addTariffPriority($tarifList);
     $calc->addGoodsItemBySize('70', '115', '40', '61');
     if ($calc->calculate() === true) {
         $res = $calc->getResult();
         return $res;
     } else {
         $err = $calc->getError();
         return $err;
     }
 }