예제 #1
0
파일: Generic.php 프로젝트: aiesh/magento2
 /**
  * Returns array to be used in multiselect on back-end
  *
  * @return array
  */
 public function toOptionArray()
 {
     $configData = $this->_shippingDhl->getCode($this->_code);
     $arr = array();
     foreach ($configData as $code => $title) {
         $arr[] = array('value' => $code, 'label' => $title);
     }
     return $arr;
 }
예제 #2
0
 public function testCollectRates()
 {
     $this->_httpResponse->expects($this->any())->method('getBody')->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_dhl_response_rates.xml')));
     // for setRequest
     $request = $this->_helper->getObject('Magento\\Quote\\Model\\Quote\\Address\\RateRequest', require __DIR__ . '/_files/rates_request_data_dhl.php');
     $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates());
 }
예제 #3
0
 public function testCollectRatesFail()
 {
     $this->scope->expects($this->once())->method('isSetFlag')->willReturn(true);
     $request = new RateRequest();
     $request->setPackageWeight(1);
     $this->assertFalse(false, $this->_model->collectRates($request));
 }
예제 #4
0
 /**
  * Define params and variables
  *
  * @return void
  */
 public function _construct()
 {
     parent::_construct();
     $this->setInch($this->carrierDhl->getCode('unit_of_dimension_cut', 'I'));
     $this->setCm($this->carrierDhl->getCode('unit_of_dimension_cut', 'C'));
     $this->setHeight($this->carrierDhl->getCode('dimensions', 'height'));
     $this->setDepth($this->carrierDhl->getCode('dimensions', 'depth'));
     $this->setWidth($this->carrierDhl->getCode('dimensions', 'width'));
     $kgWeight = 70;
     $this->setDivideOrderWeightNoteKg(__('Select this to allow DHL to optimize shipping charges by splitting the order if it exceeds %1 %2.', $kgWeight, 'kg'));
     $weight = round($this->carrierHelper->convertMeasureWeight($kgWeight, \Zend_Measure_Weight::KILOGRAM, \Zend_Measure_Weight::POUND), 3);
     $this->setDivideOrderWeightNoteLbp(__('Select this to allow DHL to optimize shipping charges by splitting the order if it exceeds %1 %2.', $weight, 'pounds'));
     $this->setTemplate('unitofmeasure.phtml');
 }