/** * @param mixed * @param string * @param string * @param bool * @return void */ protected function addField($fieldset, $name, $label, $isField = true) { if ($isField) { $options = $this->list->getFields($this->_config->getConfig(self::NAME . '/' . $name, 'none')); } else { $options = $this->list->getSegments($this->_config->getConfig(self::NAME . '/' . $name, 'none')); } $fieldset->addField($name, 'select', ['label' => __($label), 'required' => false, 'name' => $name, 'options' => $options, 'disabled' => false]); }
/** * @param string * @return array */ public function getDataFromSqlToFields($valuePrimaryKey) { $tabFromSql = $this->getSqlLine('sales_order', 'entity_id', $valuePrimaryKey); $nameTab = array('coupon_code', 'store_id', 'total_due', 'is_virtual', 'total_qty_ordered', 'customer_is_guest', 'coupon_rule_name', 'created_at', 'updated_at', 'order_currency_code', 'shipping_method', 'customer_firstname', 'customer_lastname', 'customer_email', 'weight', 'shipping_address_id', 'customer_group_id'); $tabToFields = array(); if ($tabFromSql[0]['customer_is_guest'] == 1) { $guestInfos = $this->getGuestName($tabFromSql[0]['billing_address_id']); $tabFromSql[0]['customer_firstname'] = $guestInfos['firstname']; $tabFromSql[0]['customer_lastname'] = $guestInfos['lastname']; } /* Retrieve chosen fields IDs */ foreach ($nameTab as $key) { $fieldId = $this->cfg->getConfig('checkoutSuccess/' . $key, 'none'); if ($fieldId != 'none') { $tabToFields[$fieldId] = $tabFromSql[0][$key]; } } /* Put fields in right formart */ $fieldTab = $this->fields->getAllFields(); foreach ($fieldTab as $field) { foreach ($tabToFields as $key => &$value) { $this->reformat($field, $key, $value); } } return $tabToFields; }
/** * @return array */ public function getInfos() { return ['ACC_NAME' => $this->_config->getConfig('accountName', 'Undefined'), 'ACC_OWNER' => $this->_config->getConfig('accountUserName', 'Undefined'), 'ACC_EMAIL' => $this->_config->getConfig('accountEmail', 'Undefined'), 'ACC_DATE' => substr($this->_config->getConfig('accountExpire', 'Undefined'), 0, -10), 'ACC_XKEY' => $this->_config->getXKey()]; }