Gets one field from all of subcategories.
Default is set to 'OXID'

@param string $sField field to be retrieved from each subcategory
@param string $sOXID  Cetegory ID

@return array
484608
public function getFieldFromSubCategories($sField = 'OXID', $sOXID = null)
    {
        if (!$sOXID) {
            $sOXID = $this->getId();
        }
        if (!$sOXID) {
            return false;
        }

        $sTable = $this->getViewName();
        $sField = "`{$sTable}`.`{$sField}`";
        $sSql = "SELECT $sField FROM `{$sTable}` WHERE `OXROOTID` = ? AND `OXPARENTID` != 'oxrootid'";
        $aResult = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->getCol($sSql, [$sOXID]);

        return $aResult;
    }
305605
public function & GetFieldsByType ($fieldType = '') {
		$result = [];
		foreach ($this->fields as & $field) {
			if ($field->GetType() == $fieldType)
				$result[$field->GetName()] = $field;
		}
		return $result;
	}
469863
protected function _generateSelectCatStr($sOXID, $sCatId, $dPriceFromTo = false)
    {
        $sCategoryView = getViewName('oxcategories');
        $sO2CView = getViewName('oxobject2category');

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sOXID = $oDb->quote($sOXID);
        $sCatId = $oDb->quote($sCatId);

        if (!$dPriceFromTo) {
            $sSelect = "select oxobject2category.oxcatnid from $sO2CView as oxobject2category ";
            $sSelect .= "left join $sCategoryView as oxcategories on oxcategories.oxid = oxobject2category.oxcatnid ";
            $sSelect .= "where oxobject2category.oxcatnid=$sCatId and oxobject2category.oxobjectid=$sOXID ";
            $sSelect .= "and oxcategories.oxactive = 1 order by oxobject2category.oxtime ";
        } else {
            $dPriceFromTo = $oDb->quote($dPriceFromTo);
            $sSelect = "select oxcategories.oxid from $sCategoryView as oxcategories where ";
            $sSelect .= "oxcategories.oxid=$sCatId and $dPriceFromTo >= oxcategories.oxpricefrom and ";
            $sSelect .= "$dPriceFromTo <= oxcategories.oxpriceto ";
        }

        return $sSelect;
    }
728855
public function fields($fields, $context) {
		$type = $context->type();
		$schema = $context->schema()->fields();
		$alias = $context->alias();

		if (!is_array($fields)) {
			return $this->_fieldsReturn($type, $context, $fields, $schema);
		}

		$context->applyStrategy($this);
		$fields = $this->_fields($fields ? : $context->fields(), $context);
		$context->map($this->_schema($context, $fields));
		$toMerge = [];

		if (isset($fields[0])) {
			foreach ($fields[0] as $val) {
				$toMerge[] = (is_object($val) && isset($val->scalar)) ? $val->scalar : $val;
			}
			unset($fields[0]);
		}

		$fields = isset($fields[$alias]) ? [$alias => $fields[$alias]] + $fields : $fields;

		foreach ($fields as $field => $value) {
			if (is_array($value)) {
				if (isset($value['*'])) {
					$toMerge[] = $this->name($field) . '.*';
					continue;
				}
				foreach ($value as $fieldname => $mode) {
					$toMerge[] = $this->_fieldsQuote($field, $fieldname);
				}
			}
		}

		return $this->_fieldsReturn($type, $context, $toMerge, $schema);
	}
113660
public function getFirstNoneTabField($fields)
    {
        if (count($fields)) {
            $potentialFirst = $fields[0];
            if (strpos($potentialFirst, "--div--") !== false) {
                unset($fields[0]);
                return $this->getFirstNoneTabField($fields);
            } else {
                return $potentialFirst;
            }
        } else {
            return "";
        }
    }
538941
public function pluck($sFieldName)
    {
        if (empty($sFieldName) || $this->isEmpty()) {
            return null;
        }

        //Get all items
        $arItemList = $this->all();

        $arResult = [];
        foreach ($arItemList as $obItem) {
            if ($obItem->isEmpty()) {
                continue;
            }

            $arResult[] = $obItem->$sFieldName;
        }

        return $arResult;
    }
938413
public function delete($sOXID = null)
    {
        if (!$this->getId()) {
            $this->load($sOXID);
        }

        $sOXID = isset($sOXID) ? $sOXID : $this->getId();

        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $blRet = false;

        if ($this->oxcategories__oxright->value == ($this->oxcategories__oxleft->value + 1)) {
            $myUtilsPic = \OxidEsales\Eshop\Core\Registry::getUtilsPic();
            $sDir = $myConfig->getPictureDir(false);

            // only delete empty categories
            // #1173M - not all pic are deleted, after article is removed
            $myUtilsPic->safePictureDelete($this->oxcategories__oxthumb->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('TC'), 'oxcategories', 'oxthumb');
            $myUtilsPic->safePictureDelete($this->oxcategories__oxicon->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('CICO'), 'oxcategories', 'oxicon');
            $myUtilsPic->safePictureDelete($this->oxcategories__oxpromoicon->value, $sDir . \OxidEsales\Eshop\Core\Registry::getUtilsFile()->getImageDirByType('PICO'), 'oxcategories', 'oxpromoicon');

            $sAdd = " and oxshopid = '" . $this->getShopId() . "' ";

            $oDb->execute(
                "UPDATE oxcategories SET OXLEFT = OXLEFT - 2
                                           WHERE  OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . "
                            AND OXLEFT >   " . ((int) $this->oxcategories__oxleft->value) . $sAdd
            );

            $oDb->execute(
                "UPDATE oxcategories SET OXRIGHT = OXRIGHT - 2
                                           WHERE  OXROOTID = " . $oDb->quote($this->oxcategories__oxrootid->value) . "
                            AND OXRIGHT >   " . ((int) $this->oxcategories__oxright->value) . $sAdd
            );

            // delete entry
            $blRet = parent::delete($sOXID);

            $sOxidQuoted = $oDb->quote($sOXID);
            // delete links to articles
            $oDb->execute("delete from oxobject2category where oxobject2category.oxcatnid=$sOxidQuoted ");

            // #657 ADDITIONAL delete links to attributes
            $oDb->execute("delete from oxcategory2attribute where oxcategory2attribute.oxobjectid=$sOxidQuoted ");

            // A. removing assigned:
            // - deliveries
            $oDb->execute("delete from oxobject2delivery where oxobject2delivery.oxobjectid=$sOxidQuoted ");
            // - discounts
            $oDb->execute("delete from oxobject2discount where oxobject2discount.oxobjectid=$sOxidQuoted ");

            \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderCategory::class)->onDeleteCategory($this);
        }

        return $blRet;
    }
259872
private static function getFieldTypeArray($fields)
    {
        if (count($fields) === 0) {
            return;
        }

        $types = array();

        foreach ($fields as &$field) {
            $types[] = $field->type;
        }

        return $types;
    }
1098548
public function getFieldValue($document, $field)
    {
        if (isset($this->reflFields[$field])) {
            return $this->reflFields[$field]->getValue($document);
        }
    }
1285902
protected function _getEditValue($oObject, $sField)
    {
        $sEditObjectValue = '';
        if ($oObject && $sField && isset($oObject->$sField)) {
            if ($oObject->$sField instanceof \OxidEsales\Eshop\Core\Field) {
                $sEditObjectValue = $oObject->$sField->getRawValue();
            } else {
                $sEditObjectValue = $oObject->$sField->value;
            }

            $sEditObjectValue = $this->_processEditValue($sEditObjectValue);
            $oObject->$sField = new \OxidEsales\Eshop\Core\Field($sEditObjectValue, \OxidEsales\Eshop\Core\Field::T_RAW);
        }

        return $sEditObjectValue;
    }
748467
public function getUserPayments($sOXID = null)
    {
        if ($this->_oPayments === null) {
            if (!$sOXID) {
                $sOXID = $this->getId();
            }

            $sSelect = 'select * from oxuserpayments where oxuserid = ' . \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sOXID) . ' ';

            $this->_oPayments = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $this->_oPayments->init('oxUserPayment');
            $this->_oPayments->selectString($sSelect);
        }

        return $this->_oPayments;
    }
1109150
public function load( $sOxId )
    {
        $sSQL = sprintf(
            'SELECT `OXID`, `OXUSERID`, `OXPAYMENTSID`, DECODE( `OXVALUE`, "%s" ) AS `OXVALUE`,
              `OXPSPAYMORROWBANKNAME`, `OXPSPAYMORROWIBAN`, `OXPSPAYMORROWBIC`, `OXPSPAYMORROWORDERID`
              FROM `oxuserpayments` WHERE `OXID` = %s',
            $this->getPaymentKey(),
            oxDb::getDb()->quote( $sOxId )
        );

        return $this->assignRecord( $sSQL );
    }
650917
protected function getFieldValues($fields)
    {
        $result = array();
        foreach ($fields as $id => $field) {
            if (isset($field['value'])) {
                $result[$id] = $field['value'];
            }
            if (!empty($field['fields'])) {
                /** @noinspection SlowArrayOperationsInLoopInspection */
                $result = array_merge($result, $this->getFieldValues($field['fields']));
            }
        }
        return $result;
    }
605883
public function delete($sOxid = null)
    {
        if (!$sOxid) {
            $sOxid = $this->getId();
        }
        if (!$sOxid) {
            return false;
        }

        if ($blDelete = parent::delete($sOxid)) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $oDb->execute("delete from oxobject2group where oxobject2group.oxobjectid = " . $oDb->quote($sOxid));
        }

        return $blDelete;
    }
487804
protected function _getStdUrl($sOxid)
    {
        if ($sType = $this->_getType()) {
            $oObject = oxNew($sType);
            if ($oObject->load($sOxid)) {
                return $oObject->getBaseStdLink($this->getEditLang(), true, false);
            }
        }
    }
954456
public function delete($sOxId = null)
    {
        if (!$sOxId) {
            $sOxId = $this->getId();
        }

        $this->unsetDiscountRelations();
        $this->unsetUserGroups();
        $this->deleteVoucherList();

        return parent::delete($sOxId);
    }
81091
public function lists($field) {
        $result = $this->field($field)->get();
        $data   = [];
        if (!empty($result)) {
            $field = explode(',', $field);
            switch (count($field)) {
            case 1:
                foreach ($result as $row) {
                    $data[] = $row[$field[0]];
                }
                break;
            case 2:
                foreach ($result as $v) {
                    $data[$v[$field[0]]] = $v[$field[1]];
                }
                break;
            default:
                foreach ($result as $v) {
                    $data[$v[$field[0]]] = $v;
                }
                break;
            }

            return $data;
        }

        return [];
    }