Exemplo n.º 1
0
 /**
  * @return array
  */
 public function toOptionArray()
 {
     $arr = [];
     foreach ($this->_carrierTablerate->getCode('condition_name') as $k => $v) {
         $arr[] = ['value' => $k, 'label' => $v];
     }
     return $arr;
 }
Exemplo n.º 2
0
 public function testToOptionArray()
 {
     $codes = [1, 2, 3, 4, 5];
     $expected = [];
     foreach ($codes as $k => $v) {
         $expected[] = ['value' => $k, 'label' => $v];
     }
     $this->carrierTablerateMock->expects($this->once())->method('getCode')->willReturn($codes);
     $this->assertEquals($expected, $this->model->toOptionArray());
 }
Exemplo n.º 3
0
 /**
  * Prepare table columns
  *
  * @return \Magento\Backend\Block\Widget\Grid\Extended
  */
 protected function _prepareColumns()
 {
     $this->addColumn('dest_country', ['header' => __('Country'), 'index' => 'dest_country', 'default' => '*']);
     $this->addColumn('dest_region', ['header' => __('Region/State'), 'index' => 'dest_region', 'default' => '*']);
     $this->addColumn('dest_zip', ['header' => __('Zip/Postal Code'), 'index' => 'dest_zip', 'default' => '*']);
     $label = $this->_tablerate->getCode('condition_name_short', $this->getConditionName());
     $this->addColumn('condition_value', ['header' => $label, 'index' => 'condition_value']);
     $this->addColumn('price', ['header' => __('Shipping Price'), 'index' => 'price']);
     return parent::_prepareColumns();
 }
Exemplo n.º 4
0
 /**
  * Return import condition full name by condition name code
  *
  * @param string $conditionName
  * @return string
  */
 protected function _getConditionFullName($conditionName)
 {
     if (!isset($this->_conditionFullNames[$conditionName])) {
         $name = $this->_carrierTablerate->getCode('condition_name_short', $conditionName);
         $this->_conditionFullNames[$conditionName] = $name;
     }
     return $this->_conditionFullNames[$conditionName];
 }