4 define(
'OXARTICLE_LINKTYPE_CATEGORY', 0);
 
    5 define(
'OXARTICLE_LINKTYPE_VENDOR', 1);
 
    6 define(
'OXARTICLE_LINKTYPE_MANUFACTURER', 2);
 
    7 define(
'OXARTICLE_LINKTYPE_PRICECATEGORY', 3);
 
    8 define(
'OXARTICLE_LINKTYPE_TAG', 4);
 
    9 define(
'OXARTICLE_LINKTYPE_RECOMM', 5);
 
  372                                              'oxarticles__oxtimestamp',
 
  375                                              'oxarticles__oxparentid');
 
  383                                          'oxarticles__oxfreeshipping',
 
  384                                          'oxarticles__oxisdownloadable',
 
  385                                          'oxarticles__oxshowcustomagreement');
 
  455         if ($aParams && is_array($aParams)) {
 
  456             foreach ($aParams as $sParam => $mValue) {
 
  457                 $this->$sParam = $mValue;
 
  461         $this->
init(
'oxarticles');
 
  480         return $this->$sName;
 
  489     public function __set($sName, $sValue)
 
  517         $this->oxarticles__oxnid = $this->oxarticles__oxid;
 
  536         $sQ = 
" $sTable.oxactive = 1 ";
 
  539         if ($this->
getConfig()->getConfigParam(
'blUseTimeCheck')) {
 
  540             $sDate = date(
'Y-m-d H:i:s', 
oxRegistry::get(
"oxUtilsDate")->getTime());
 
  541             $sQ = 
"( $sQ or ( $sTable.oxactivefrom < '$sDate' and $sTable.oxactiveto > '$sDate' ) ) ";
 
  568         if (
$myConfig->getConfigParam(
'blUseStock')) {
 
  569             $sQ = 
" and ( $sTable.oxstockflag != 2 or ( $sTable.oxstock + $sTable.oxvarstock ) > 0  ) ";
 
  571             if (!
$myConfig->getConfigParam(
'blVariantParentBuyable')) {
 
  573                 if (
$myConfig->getConfigParam(
'blUseTimeCheck')) {
 
  574                     $sDate = date(
'Y-m-d H:i:s', 
oxRegistry::get(
"oxUtilsDate")->getTime());
 
  575                     $sTimeCheckQ = 
" or ( art.oxactivefrom < '$sDate' and art.oxactiveto > '$sDate' )";
 
  577                 $sQ = 
" $sQ and IF( $sTable.oxvarcount = 0, 1, ( select 1 from $sTable as art where art.oxparentid=$sTable.oxid and ( art.oxactive = 1 $sTimeCheckQ ) and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) ) ";
 
  598         $sQ = 
" and $sTable.oxparentid = '" . $this->
getId() . 
"' ";
 
  601         if ($this->
getConfig()->getConfigParam(
'blUseStock')) {
 
  602             $sQ .= 
" and ( $sTable.oxstock > 0 or ( $sTable.oxstock <= 0 and $sTable.oxstockflag != 2 ";
 
  603             if ($blRemoveNotOrderables) {
 
  604                 $sQ .= 
" and $sTable.oxstockflag != 3 ";
 
  619         return $this->oxarticles__oxunitquantity->value;
 
  629         $dSize = $this->oxarticles__oxlength->value *
 
  630                  $this->oxarticles__oxwidth->value *
 
  631                  $this->oxarticles__oxheight->value;
 
  643         return $this->oxarticles__oxweight->value;
 
  672         $this->_blSkipAssign = $blSkipAssign;
 
  680         $this->_blLoadPrice = 
false;
 
  688         $this->_blLoadPrice = 
true;
 
  708         $this->_sItemKey = $sItemKey;
 
  718         $this->_blLoadVariants = !$blLoadVariants;
 
  728         if ($this->_blNotBuyableParent) {
 
  762         $this->_blIsOnComparisonList = $blOnList;
 
  772         $this->_blLoadParentData = $blLoadParentData;
 
  795         switch ($sFieldName) {
 
  812         if ($this->_fPricePerUnit == null) {
 
  831         if (!$this->
getConfig()->getConfigParam(
'bl_perfLoadPrice') || !$this->_blLoadPrice) {
 
  836         if ((
double) $this->
getUnitQuantity() && $this->oxarticles__oxunitname->value) {
 
  887         if (!$this->
getConfig()->getConfigParam(
'bl_perfLoadPrice') || !$this->_blLoadPrice) {
 
  898         $oPrice->setPrice($dPrice);
 
  912         if (!$this->
getConfig()->getConfigParam(
'bl_perfLoadPrice') || !$this->_blLoadPrice) {
 
  926         $oPrice->setPrice($dPrice);
 
  939         if ($this->_blIsRangePrice === null) {
 
  948                 if ($dMinPrice != $dMaxPrice) {
 
  969         return $this->_blIsRangePrice = $blIsRangePrice;
 
  982             return $blCanPreview;
 
  986         $sNow = date(
'Y-m-d H:i:s');
 
  987         if (!$this->oxarticles__oxactive->value &&
 
  988             ($this->oxarticles__oxactivefrom->value > $sNow ||
 
  989              $this->oxarticles__oxactiveto->value < $sNow
 
  996         if ($this->
getConfig()->getConfigParam(
'blUseStock') && $this->oxarticles__oxstockflag->value == 2) {
 
  997             $iOnStock = $this->oxarticles__oxstock->value + $this->oxarticles__oxvarstock->value;
 
  998             if ($this->
getConfig()->getConfigParam(
'blPsBasketReservationEnabled')) {
 
  999                 $iOnStock += $this->
getSession()->getBasketReservations()->getReservedAmount($this->
getId());
 
 1001             if ($iOnStock <= 0) {
 
 1019         startProfile(
'articleAssign');
 
 1024         $this->oxarticles__oxnid = $this->oxarticles__oxid;
 
 1027         if ($this->_blSkipAssign) {
 
 1041         stopProfile(
'articleAssign');
 
 1058         $this->_blNotBuyableParent = 
false;
 
 1070             $this->_isLoaded = 
true;
 
 1086         $aSortingFields = !empty($aSortingFields) ? (array) $aSortingFields : array();
 
 1088         foreach ($aSortingFields as $sField) {
 
 1089             $sParameterName = 
'oxarticles__' . $sField;
 
 1090             if ($this->$sParameterName->value !== $this->_aSortingFieldsOnLoad[$sParameterName]) {
 
 1107         $dOldRating = $this->oxarticles__oxrating->value;
 
 1108         $dOldCnt = $this->oxarticles__oxratingcnt->value;
 
 1109         $this->oxarticles__oxrating->setValue(($dOldRating * $dOldCnt + $iRating) / ($dOldCnt + 1));
 
 1110         $this->oxarticles__oxratingcnt->setValue($dOldCnt + 1);
 
 1111         $dRating = ($dOldRating * $dOldCnt + $iRating) / ($dOldCnt + 1);
 
 1112         $dRatingCnt = (int) ($dOldCnt + 1);
 
 1115         $oDb->execute(
'update oxarticles set oxarticles.oxrating = ' . $dRating . 
',oxarticles.oxratingcnt = ' . $dRatingCnt . 
', oxarticles.oxtimestamp = oxarticles.oxtimestamp where oxarticles.oxid = ' . $oDb->quote($this->getId()));
 
 1126         $this->oxarticles__oxrating = 
new oxField($iRating);
 
 1136         $this->oxarticles__oxratingcnt = 
new oxField($iRatingCnt);
 
 1148         if (!$blIncludeVariants) {
 
 1149             return round($this->oxarticles__oxrating->value, 1);
 
 1151             $oRating = 
oxNew(
'oxRating');
 
 1166         if (!$blIncludeVariants) {
 
 1167             return $this->oxarticles__oxratingcnt->value;
 
 1169             $oRating = 
oxNew(
'oxRating');
 
 1183         $aIds = array($this->
getId());
 
 1185         if ($this->oxarticles__oxparentid->value) {
 
 1186             $aIds[] = $this->oxarticles__oxparentid->value;
 
 1190         if ($this->
getConfig()->getConfigParam(
'blShowVariantReviews')) {
 
 1192             if (is_array($aAdd)) {
 
 1193                 $aIds = array_merge($aIds, $aAdd);
 
 1197         $oReview = 
oxNew(
'oxreview');
 
 1198         $oRevs = $oReview->loadList(
'oxarticle', $aIds);
 
 1201         if ($oRevs->count() < 1) {
 
 1215         $oCrosslist = 
oxNew(
"oxarticlelist");
 
 1216         $oCrosslist->loadArticleCrossSell($this->oxarticles__oxid->value);
 
 1217         if ($oCrosslist->count()) {
 
 1232         if (!
$myConfig->getConfigParam(
'bl_perfLoadAccessoires')) {
 
 1236         $oAcclist = 
oxNew(
"oxarticlelist");
 
 1237         $oAcclist->setSqlLimit(0, 
$myConfig->getConfigParam(
'iNrofCrossellArticles'));
 
 1238         $oAcclist->loadArticleAccessoires($this->oxarticles__oxid->value);
 
 1240         if ($oAcclist->count()) {
 
 1254         if (!
$myConfig->getConfigParam(
'bl_perfLoadSimilar')) {
 
 1259         if(
$myConfig->getConfigParam(
'iNrofSimilarArticles') < 1) {
 
 1275         if (count($aList)) {
 
 1276             uasort($aList, 
'cmpart');
 
 1280             $oSimilarlist = 
oxNew(
'oxarticlelist');
 
 1281             $oSimilarlist->setSqlLimit(0, 
$myConfig->getConfigParam(
'iNrofSimilarArticles'));
 
 1282             $oSimilarlist->selectString($sSearch);
 
 1284             return $oSimilarlist;
 
 1297         if (!
$myConfig->getConfigParam(
'bl_perfLoadCustomerWhoBoughtThis')) {
 
 1304         $oArticles = 
oxNew(
'oxarticlelist');
 
 1305         $oArticles->setSqlLimit(0, 
$myConfig->getConfigParam(
'iNrofCustomerWhoArticles'));
 
 1306         $oArticles->selectString($sQ);
 
 1307         if ($oArticles->count()) {
 
 1321         if (!
$myConfig->getConfigParam(
'bl_perfLoadPrice') || !$this->_blLoadPrice || !$this->_blCalcPrice || !$this->
hasAmountPrice()) {
 
 1325         if ($this->_oAmountPriceInfo === null) {
 
 1326             $this->_oAmountPriceInfo = array();
 
 1346         $sKey = $this->
getId();
 
 1347         if (isset($sKeyPrefix)) {
 
 1348             $sKey = $sKeyPrefix . 
'__' . $sKey;
 
 1351         if (!isset(self::$_aSelList[$sKey])) {
 
 1355             $sQ = 
"select {$sSLViewName}.* from oxobject2selectlist join {$sSLViewName} on $sSLViewName.oxid=oxobject2selectlist.oxselnid 
 1356                    where oxobject2selectlist.oxobjectid=%s order by oxobject2selectlist.oxsort";
 
 1359             $oLists = 
oxNew(
'oxlist');
 
 1360             $oLists->init(
'oxselectlist');
 
 1361             $oLists->selectString(sprintf($sQ, $oDb->quote($this->getId())));
 
 1364             if ($oLists->count() == 0 && $this->oxarticles__oxparentid->value) {
 
 1365                 $oLists->selectString(sprintf($sQ, $oDb->quote($this->oxarticles__oxparentid->value)));
 
 1375             self::$_aSelList[$sKey] = array();
 
 1376             foreach ($oLists as $oSelectlist) {
 
 1377                 self::$_aSelList[$sKey][$iCnt] = $oSelectlist->getFieldList($dVat);
 
 1378                 self::$_aSelList[$sKey][$iCnt][
'name'] = $oSelectlist->oxselectlist__oxtitle->value;
 
 1383         return self::$_aSelList[$sKey];
 
 1393         return $this->oxarticles__oxvarcount->value;
 
 1413         return $this->oxarticles__oxshowcustomagreement->value && $this->oxarticles__oxnonmaterial->value && !$this->
hasDownloadableAgreement();
 
 1423         return $this->oxarticles__oxshowcustomagreement->value && $this->oxarticles__oxisdownloadable->value;
 
 1437         $iLimit = (int) $iLimit;
 
 1438         if (!isset($this->_aVariantSelections[$iLimit])) {
 
 1439             $aVariantSelections = 
false;
 
 1440             if ($this->oxarticles__oxvarcount->value) {
 
 1442                 $aVariantSelections = 
oxNew(
"oxVariantHandler")->buildVariantSelections($this->oxarticles__oxvarname->getRawValue(), $oVariants, $aFilterIds, $sActVariantId, $iLimit);
 
 1444                 if (!empty($oVariants) && empty($aVariantSelections[
'rawselections'])) {
 
 1445                     $aVariantSelections = 
false;
 
 1448             $this->_aVariantSelections[$iLimit] = $aVariantSelections;
 
 1451         return $this->_aVariantSelections[$iLimit];
 
 1464         $sId = $this->
getId() . ((int) $iLimit);
 
 1465         if (!array_key_exists($sId, self::$_aSelections)) {
 
 1470             $sQ = 
"select {$sSLViewName}.* from oxobject2selectlist join {$sSLViewName} on $sSLViewName.oxid=oxobject2selectlist.oxselnid 
 1471                    where oxobject2selectlist.oxobjectid=%s order by oxobject2selectlist.oxsort";
 
 1473             if (($iLimit = (
int) $iLimit)) {
 
 1474                 $sQ .= 
" limit $iLimit ";
 
 1479             if (($oPrice = $this->
getPrice()) != null) {
 
 1480                 $dVat = $oPrice->getVat();
 
 1484             $oList = 
oxNew(
'oxlist');
 
 1485             $oList->init(
'oxselectlist');
 
 1486             $oList->getBaseObject()->setVat($dVat);
 
 1487             $oList->selectString(sprintf($sQ, $oDb->quote($this->getId())));
 
 1490             if ($oList->count() == 0 && $this->oxarticles__oxparentid->value) {
 
 1491                 $oList->selectString(sprintf($sQ, $oDb->quote($this->oxarticles__oxparentid->value)));
 
 1494             self::$_aSelections[$sId] = $oList->count() ? $oList : 
false;
 
 1497         if (self::$_aSelections[$sId]) {
 
 1502                 foreach (self::$_aSelections[$sId] as $oSelection) {
 
 1503                     if (isset($aFilter[$iSelIdx])) {
 
 1504                         $oSelection->setActiveSelectionByIndex($aFilter[$iSelIdx]);
 
 1511         return self::$_aSelections[$sId];
 
 1524         return $this->
_loadVariantList(
false, $blRemoveNotOrderables, $blForceCoreTable);
 
 1536     public function getVariants($blRemoveNotOrderables = 
true, $blForceCoreTable = null)
 
 1548         if ($this->oxarticles__oxvarcount->value) {
 
 1563         $oVariants = 
oxNew(
'oxarticlelist');
 
 1564         if (($sId = $this->
getId())) {
 
 1566             $oBaseObj = $oVariants->getBaseObject();
 
 1568             if (is_null($sLanguage)) {
 
 1571                 $oBaseObj->setLanguage($sLanguage);
 
 1574             $sSql = 
"select * from " . $oBaseObj->getViewName() . 
" where oxparentid = '{$sId}' order by oxsort ";
 
 1575             $oVariants->selectString($sSql);
 
 1578             if (!$this->
getConfig()->getConfigParam(
'blVariantParentBuyable') && ($oVariants->count() > 0)) {
 
 1580                 $this->_blNotBuyableParent = 
true;
 
 1596         $oCategory = 
oxNew(
'oxcategory');
 
 1600         $sOXID = $this->
getId();
 
 1601         if (isset($this->oxarticles__oxparentid->value) && $this->oxarticles__oxparentid->value) {
 
 1602             $sOXID = $this->oxarticles__oxparentid->value;
 
 1607             if (!isset($this->_aCategoryCache[$sOXID])) {
 
 1608                 startPRofile(
'getCategory');
 
 1610                 $sWhere = $oCategory->getSqlActiveSnippet();
 
 1612                 $sSelect .= ($oStr->strstr($sSelect, 
'where') ? 
' and ' : 
' where ') . $sWhere . 
" order by oxobject2category.oxtime limit 1";
 
 1615                 if (!$oCategory->assignRecord($sSelect)) {
 
 1618                     $sSelect .= ($oStr->strstr($sSelect, 
'where') ? 
' and ' : 
' where ') . $sWhere . 
" limit 1";
 
 1621                     if (!$oCategory->assignRecord($sSelect)) {
 
 1626                 $this->_aCategoryCache[$sOXID] = $oCategory;
 
 1627                 stopPRofile(
'getCategory');
 
 1630                 $oCategory = $this->_aCategoryCache[$sOXID];
 
 1647         $sArticleId = $this->
getId();
 
 1649         if (!isset(self::$_aArticleCats[$sArticleId]) || $blSkipCache) {
 
 1657             self::$_aArticleCats[$sArticleId] = array_unique(array_merge($aCategoryIds, $aPriceCategoryIds));
 
 1660         return self::$_aArticleCats[$sArticleId];
 
 1675             $oVendor = 
oxNew(
'oxvendor');
 
 1676         } elseif (!$blShopCheck && $this->oxarticles__oxvendorid->value) {
 
 1677             $oVendor = 
oxNew(
'oxi18n');
 
 1678             $oVendor->init(
'oxvendor');
 
 1679             $oVendor->setReadOnly(
true);
 
 1680             $sVendorId = $this->oxarticles__oxvendorid->value;
 
 1682         if ($sVendorId && $oVendor->load($sVendorId) && $oVendor->oxvendor__oxactive->value) {
 
 1700         if ($this->oxarticles__oxvendorid->value) {
 
 1701             $sVendorId = $this->oxarticles__oxvendorid->value;
 
 1717         $sManufacturerId = 
false;
 
 1718         if ($this->oxarticles__oxmanufacturerid->value) {
 
 1720             $sManufacturerId = $this->oxarticles__oxmanufacturerid->value;
 
 1724         return $sManufacturerId;
 
 1738         $oManufacturer = 
oxNew(
'oxmanufacturer');
 
 1740             !$blShopCheck && $this->oxarticles__oxmanufacturerid->value
 
 1742             $oManufacturer->setReadOnly(
true);
 
 1743             $sManufacturerId = $this->oxarticles__oxmanufacturerid->value;
 
 1746         if ($sManufacturerId && $oManufacturer->load($sManufacturerId)) {
 
 1747             if (!$this->
getConfig()->getConfigParam(
'bl_perfLoadManufacturerTree')) {
 
 1748                 $oManufacturer->setReadOnly(
true);
 
 1750             $oManufacturer = $oManufacturer->oxmanufacturers__oxactive->value ? $oManufacturer : null;
 
 1752             $oManufacturer = null;
 
 1755         return $oManufacturer;
 
 1781         $sOXID = $this->
getId();
 
 1782         if (isset($this->oxarticles__oxparentid->value) && $this->oxarticles__oxparentid->value) {
 
 1783             $sOXID = $this->oxarticles__oxparentid->value;
 
 1788         $sOXID = $oDb->getOne($sSelect);
 
 1790         if (isset($sOXID) && $sOXID) {
 
 1795         if ($this->
getConfig()->getConfigParam(
'bl_perfLoadPrice') && $this->_blLoadPrice) {
 
 1796             $dPriceFromTo = $this->
getPrice()->getBruttoPrice();
 
 1797             if ($dPriceFromTo > 0) {
 
 1799                 $sOXID = $oDb->getOne($sSelect);
 
 1801                 if (isset($sOXID) && $sOXID) {
 
 1817         if (!$this->
getConfig()->getConfigParam(
'bl_perfLoadPrice') || !$this->_blLoadPrice) {
 
 1822         if ($this->_oTPrice !== null) {
 
 1828         $dBasePrice = $this->oxarticles__oxtprice->value;
 
 1831         $oPrice->setPrice($dBasePrice);
 
 1844         if ($oPrice->getPrice() <= $oPrice2->getPrice()) {
 
 1849         $this->_oTPrice = $oPrice;
 
 1862         if ($this->_blSkipDiscounts !== null) {
 
 1866         if ($this->oxarticles__oxskipdiscounts->value) {
 
 1871         $this->_blSkipDiscounts = 
false;
 
 1877             $sSelect = 
"select 1 from $sO2CView as $sO2CView left join {$sViewName} on {$sViewName}.oxid = $sO2CView.oxcatnid 
 1878                          where $sO2CView.oxobjectid=" . $oDb->quote($this->
getId()) . 
" and {$sViewName}.oxactive = 1 and {$sViewName}.oxskipdiscounts = '1' ";
 
 1879             $this->_blSkipDiscounts = ($oDb->getOne($sSelect) == 1);
 
 1892         $this->_oPrice = $oPrice;
 
 1937         if ($dAmount != 1 || $this->_oPrice === null) {
 
 1945             $oPrice->setPrice($dBasePrice);
 
 1948             if (!$this->_blCalcPrice && $dAmount == 1) {
 
 1949                 return $this->_oPrice = $oPrice;
 
 1953             if ($dAmount != 1) {
 
 1957             $this->_oPrice = $oPrice;
 
 1970         $this->_oUser = $oUser;
 
 1980         if ($this->_oUser) {
 
 1998         $oUser = $oBasket->getBasketUser();
 
 2001         $oBasketPrice = $this->
_getPriceObject($oBasket->isCalculationModeNetto());
 
 2012         $oBasketPrice->setPrice($dBasePrice);
 
 2014         $dVat = 
oxRegistry::get(
"oxVatSelector")->getBasketItemVat($this, $oBasket);
 
 2018         return $oBasketPrice;
 
 2029     public function delete($sOXID = null)
 
 2032             $sOXID = $this->
getId();
 
 2042         $this->
load($sOXID);
 
 2044         $this->
_onChangeResetCounts($sOXID, $this->oxarticles__oxvendorid->value, $this->oxarticles__oxmanufacturerid->value);
 
 2053         $this->
onChange(ACTION_DELETE, $sOXID, $this->oxarticles__oxparentid->value);
 
 2070         $iStockCount = $this->oxarticles__oxstock->value - $dAmount;
 
 2071         if (!$blAllowNegativeStock && ($iStockCount < 0)) {
 
 2072             $dAmount += $iStockCount;
 
 2075         $this->oxarticles__oxstock = 
new oxField($iStockCount);
 
 2078         $oDb->execute(
'update oxarticles set oxarticles.oxstock = ' . $oDb->quote($iStockCount) . 
' where oxarticles.oxid = ' . $oDb->quote($this->
getId()));
 
 2079         $this->
onChange(ACTION_UPDATE_STOCK);
 
 2099         if (!$this->oxarticles__oxparentid->value) {
 
 2101             $dAmount = (double) $dAmount;
 
 2103             $rs = $oDb->execute(
"update oxarticles set oxarticles.oxsoldamount = oxarticles.oxsoldamount + $dAmount where oxarticles.oxid = " . $oDb->quote($this->oxarticles__oxid->value));
 
 2104         } elseif ($this->oxarticles__oxparentid->value) {
 
 2107             if ($oUpdateArticle) {
 
 2108                 $oUpdateArticle->updateSoldAmount($dAmount);
 
 2124         return $oDb->execute(
"update oxarticles set oxarticles.oxremindactive = 2 where oxarticles.oxid = " . $oDb->quote($this->oxarticles__oxid->value));
 
 2136         if (($blRet = parent::save())) {
 
 2149         $sParentId = $this->oxarticles__oxparentid->value;
 
 2151         $this->_blAllowEmptyParentId = 
true;
 
 2153         $this->_blAllowEmptyParentId = 
false;
 
 2155         if ($sParentId !== 
'') {
 
 2156             $this->
onChange(ACTION_UPDATE, null, $sParentId);
 
 2173         $aArtPics = array();
 
 2174         $aArtIcons = array();
 
 2184         $iPicCount = 
$myConfig->getConfigParam(
'iPicCount');
 
 2185         $blCheckActivePicId = 
true;
 
 2187         for ($i = 1; $i <= $iPicCount; $i++) {
 
 2190             if (!$oStr->strstr($sIcoVal, 
'nopic_ico.jpg') && !$oStr->strstr($sIcoVal, 
'nopic.jpg') &&
 
 2191                 !$oStr->strstr($sPicVal, 
'nopic_ico.jpg') && !$oStr->strstr($sPicVal, 
'nopic.jpg') &&
 
 2197                 $aArtIcons[$i] = $sIcoVal;
 
 2198                 $aArtPics[$i] = $sPicVal;
 
 2201                 if ($iActPicId == $i) {
 
 2202                     $sActPic = $sPicVal;
 
 2203                     $blCheckActivePicId = 
false;
 
 2206             } elseif ($blCheckActivePicId && $iActPicId <= $i) {
 
 2214         $aZoomPics = array();
 
 2215         $iZoomPicCount = 
$myConfig->getConfigParam(
'iPicCount');
 
 2217         for ($j = 1, $c = 1; $j <= $iZoomPicCount; $j++) {
 
 2220             if ($sVal && !$oStr->strstr($sVal, 
'nopic.jpg')) {
 
 2222                 $aZoomPics[$c][
'id'] = $c;
 
 2223                 $aZoomPics[$c][
'file'] = $sVal;
 
 2226                     $aZoomPics[$c][
'file'] = 
"nopic.jpg";
 
 2232         $aPicGallery = array(
'ActPicID' => $iActPicId,
 
 2233                              'ActPic'   => $sActPic,
 
 2234                              'MorePics' => $blMorePic,
 
 2235                              'Pics'     => $aArtPics,
 
 2236                              'Icons'    => $aArtIcons,
 
 2237                              'ZoomPic'  => $blZoomPic,
 
 2238                              'ZoomPics' => $aZoomPics);
 
 2240         return $aPicGallery;
 
 2256     public function onChange($sAction = null, $sOXID = null, $sParentID = null)
 
 2260         if (!isset($sOXID)) {
 
 2261             if ($this->
getId()) {
 
 2262                 $sOXID = $this->
getId();
 
 2264             if (!isset ($sOXID)) {
 
 2265                 $sOXID = $this->oxarticles__oxid->value;
 
 2267             if ($this->oxarticles__oxparentid->value) {
 
 2268                 $sParentID = $this->oxarticles__oxparentid->value;
 
 2271         if (!isset($sOXID)) {
 
 2276         if (
$myConfig->getConfigParam(
'blUseStock')) {
 
 2279             if (!isset($sParentID)) {
 
 2281                 $sQ = 
'select oxparentid from oxarticles where oxid = ' . $oDb->quote($sOXID);
 
 2282                 $sParentID = $oDb->getOne($sQ);
 
 2295         $sId = ($sParentID) ? $sParentID : $sOXID;
 
 2302         if ($sAction === ACTION_UPDATE_STOCK) {
 
 2317         if (isset($this->oxarticles__oxvat->value)) {
 
 2318             return $this->oxarticles__oxvat->value;
 
 2333         if (!
$myConfig->getConfigParam(
'blUseStock')) {
 
 2339         $sQ = 
'select oxstock, oxstockflag from oxarticles where oxid = ' . $oDb->quote($this->
getId());
 
 2340         $rs = $oDb->select($sQ);
 
 2344         if ($rs !== 
false && $rs->recordCount() > 0) {
 
 2345             $iOnStock = $rs->fields[
'oxstock'] - $dArtStockAmount;
 
 2346             $iStockFlag = $rs->fields[
'oxstockflag'];
 
 2349             if ($iStockFlag == 1 || $iStockFlag == 4) {
 
 2352             if (!
$myConfig->getConfigParam(
'blAllowUnevenAmounts')) {
 
 2353                 $iOnStock = floor($iOnStock);
 
 2356         if ($this->
getConfig()->getConfigParam(
'blPsBasketReservationEnabled')) {
 
 2357             $iOnStock += $this->
getSession()->getBasketReservations()->getReservedAmount($this->
getId());
 
 2359         if ($iOnStock >= $dAmount) {
 
 2362             if ($iOnStock > 0) {
 
 2365                 $oEx = 
oxNew(
'oxArticleInputException');
 
 2366                 $oEx->setMessage(
'ERROR_MESSAGE_ARTICLE_ARTICLE_NOT_BUYABLE');
 
 2382         if ($this->_oLongDesc === null) {
 
 2384             $this->_oLongDesc = 
new oxField();
 
 2388             $sOxid = $this->
getId();
 
 2392             $sDbValue = $oDb->getOne(
"select oxlongdesc from {$sViewName} where oxid = " . $oDb->quote($sOxid));
 
 2394             if ($sDbValue != 
false) {
 
 2396             } elseif ($this->oxarticles__oxparentid->value) {
 
 2397                 if (!$this->
isAdmin() || $this->_blLoadParentData) {
 
 2400                         $this->_oLongDesc->setValue($oParent->getLongDescription()->getRawValue(), 
oxField::T_RAW);
 
 2442         if ($this->_oAttributeList === null) {
 
 2443             $this->_oAttributeList = 
oxNew(
'oxattributelist');
 
 2444             $this->_oAttributeList->loadAttributes($this->
getId(), $this->
getParentId());
 
 2457         if ($this->_oAttributeList === null) {
 
 2458             $this->_oAttributeList = 
oxNew(
'oxattributelist');
 
 2459             $this->_oAttributeList->loadAttributesDisplayableInBasket($this->
getId(), $this->
getParentId());
 
 2475             if ($iLang === null) {
 
 2479             $this->_aSeoAddParams[$iLang] = isset($this->_aSeoAddParams[$iLang]) ? $this->_aSeoAddParams[$iLang] . 
"&" : 
"";
 
 2480             $this->_aSeoAddParams[$iLang] .= $sAddParams;
 
 2497             return $oEncoder->getArticleUrl($this, $iLang, $this->
getLinkType());
 
 2500         return $oEncoder->getArticleMainUrl($this, $iLang);
 
 2511     public function getLink($iLang = null, $blMain = 
false)
 
 2517         if ($iLang === null) {
 
 2522         if (!isset($this->_aSeoUrls[$iLang][$iLinkType])) {
 
 2523             $this->_aSeoUrls[$iLang][$iLinkType] = $this->
getBaseSeoLink($iLang, $blMain);
 
 2526         $sUrl = $this->_aSeoUrls[$iLang][$iLinkType];
 
 2527         if (isset($this->_aSeoAddParams[$iLang])) {
 
 2528             $sUrl .= ((strpos($sUrl . $this->_aSeoAddParams[$iLang], 
'?') === 
false) ? 
'?' : 
'&') . $this->_aSeoAddParams[$iLang];
 
 2544         return $this->
getLink($iLang, 
true);
 
 2555         $this->_sDetailLink = null;
 
 2558         $this->_iLinkType = (int) $iType;
 
 2580             if ($iLang === null) {
 
 2584             $this->_aStdAddParams[$iLang] = isset($this->_aStdAddParams[$iLang]) ? $this->_aStdAddParams[$iLang] . 
"&" : 
"";
 
 2585             $this->_aStdAddParams[$iLang] .= $sAddParams;
 
 2603             $sUrl = $this->
getConfig()->getShopUrl($iLang, 
false);
 
 2606         $sUrl .= 
"index.php?cl=details" . ($blAddId ? 
"&anid=" . $this->
getId() : 
"");
 
 2608         return $sUrl . (isset($this->_aStdAddParams[$iLang]) ? 
"&" . $this->_aStdAddParams[$iLang] : 
"");
 
 2621         if ($iLang === null) {
 
 2625         if (!isset($this->_aStdUrls[$iLang])) {
 
 2629         return oxRegistry::get(
"oxUtilsUrl")->processUrl($this->_aStdUrls[$iLang], 
true, $aParams, $iLang);
 
 2639         if ($this->_aMediaUrls === null) {
 
 2640             $this->_aMediaUrls = 
oxNew(
"oxlist");
 
 2641             $this->_aMediaUrls->init(
"oxmediaurl");
 
 2642             $this->_aMediaUrls->getBaseObject()->setLanguage($this->
getLanguage());
 
 2645             $sQ = 
"select * from {$sViewName} where oxobjectid = '" . $this->
getId() . 
"'";
 
 2646             $this->_aMediaUrls->selectString($sQ);
 
 2669         if ($this->_aDispSelList === null) {
 
 2670             if ($this->
getConfig()->getConfigParam(
'bl_perfLoadSelectLists') && $this->
getConfig()->getConfigParam(
'bl_perfLoadSelectListsInAList')) {
 
 2685         if ($this->_sMoreDetailLink == null) {
 
 2688             $this->_sMoreDetailLink = $this->
getConfig()->getShopHomeURL() . 
'cl=moredetails';
 
 2692                 $this->_sMoreDetailLink .= 
'&cnid=' . $sActCat;
 
 2694             $this->_sMoreDetailLink .= 
'&anid=' . $this->
getId();
 
 2708         if ($this->_sToBasketLink == null) {
 
 2712                 $this->_sToBasketLink = $this->
getLink();
 
 2715                 $this->_sToBasketLink = 
$myConfig->getShopHomeURL();
 
 2719                 if ($sActClass == 
'thankyou') {
 
 2720                     $sActClass = 
'basket';
 
 2722                 $this->_sToBasketLink .= 
'cl=' . $sActClass;
 
 2726                     $this->_sToBasketLink .= 
'&cnid=' . $sActCat;
 
 2729                 $this->_sToBasketLink .= 
'&fnc=tobasket&aid=' . $this->
getId() . 
'&anid=' . $this->
getId();
 
 2732                     $this->_sToBasketLink .= 
'&tpl=' . $sTpl;
 
 2757         if ($this->oxarticles__oxdelivery->value != 
'0000-00-00') {
 
 2758             return oxRegistry::get(
"oxUtilsDate")->formatDBDate($this->oxarticles__oxdelivery->value);
 
 2803         if ($this->oxarticles__oxremindactive->value == 2 &&
 
 2804             $this->oxarticles__oxremindamount->value <= $this->oxarticles__oxstock->value
 
 2806             $this->oxarticles__oxremindactive->value = 1;
 
 2851         $this->_blNotBuyable = !$blBuyable;
 
 2861         $this->_aDispSelList = $aSelList;
 
 2876                 $sImgName = basename($this->{
"oxarticles__oxpic$iIndex"}->value);
 
 2879             $sSize = $this->
getConfig()->getConfigParam(
'aDetailImageSizes');
 
 2881             return oxRegistry::get(
"oxPictureHandler")->getProductPicUrl(
"product/{$iIndex}/", $sImgName, $sSize, 
'oxpic' . $iIndex);
 
 2896         $sDirname = 
"product/1/";
 
 2897         if ($iIndex && !$this->
_isFieldEmpty(
"oxarticles__oxpic{$iIndex}")) {
 
 2898             $sImgName = basename($this->{
"oxarticles__oxpic$iIndex"}->value);
 
 2899             $sDirname = 
"product/{$iIndex}/";
 
 2901             $sImgName = basename($this->oxarticles__oxicon->value);
 
 2902             $sDirname = 
"product/icon/";
 
 2904             $sImgName = basename($this->oxarticles__oxpic1->value);
 
 2907         $sSize = $this->
getConfig()->getConfigParam(
'sIconsize');
 
 2909         $sIconUrl = 
oxRegistry::get(
"oxPictureHandler")->getProductPicUrl($sDirname, $sImgName, $sSize, $iIndex);
 
 2924         $sDirname = 
"product/1/";
 
 2926             $sImgName = basename($this->oxarticles__oxthumb->value);
 
 2927             $sDirname = 
"product/thumb/";
 
 2929             $sImgName = basename($this->oxarticles__oxpic1->value);
 
 2932         $sSize = $this->
getConfig()->getConfigParam(
'sThumbnailsize');
 
 2934         return oxRegistry::get(
"oxPictureHandler")->getProductPicUrl($sDirname, $sImgName, $sSize, 0, $bSsl);
 
 2946         $iIndex = (int) $iIndex;
 
 2947         if ($iIndex > 0 && !$this->
_isFieldEmpty(
"oxarticles__oxpic" . $iIndex)) {
 
 2948             $sImgName = basename($this->{
"oxarticles__oxpic" . $iIndex}->value);
 
 2949             $sSize = $this->
getConfig()->getConfigParam(
"sZoomImageSize");
 
 2951             return oxRegistry::get(
"oxPictureHandler")->getProductPicUrl(
"product/{$iIndex}/", $sImgName, $sSize, 
'oxpic' . $iIndex);
 
 2975             $aDiscounts = $oDiscountList->getArticleDiscounts($this, $this->
getArticleUser());
 
 2978             foreach ($aDiscounts as $oDiscount) {
 
 2979                 $oPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
 
 2981             $oPrice->calculateDiscount();
 
 2992         if (($sParentId = $this->oxarticles__oxparentid->value)) {
 
 2993             $sIndex = $sParentId . 
"_" . $this->
getLanguage();
 
 2994             if (!isset(self::$_aLoadedParents[$sIndex])) {
 
 2995                 self::$_aLoadedParents[$sIndex] = 
oxNew(
'oxarticle');
 
 2996                 self::$_aLoadedParents[$sIndex]->_blLoadPrice = 
false;
 
 2997                 self::$_aLoadedParents[$sIndex]->_blLoadVariants = 
false;
 
 3001                     self::$_aLoadedParents[$sIndex] = 
false;
 
 3005             return self::$_aLoadedParents[$sIndex];
 
 3017             $sOxId = $oDb->quote($this->
getId());
 
 3018             $sOxShopId = $oDb->quote($this->
getShopId());
 
 3019             $iRemindActive = $oDb->quote($this->oxarticles__oxremindactive->value);
 
 3022                     set oxremindactive = $iRemindActive 
 3023                     where oxparentid = $sOxId and 
 3024                           oxshopid = $sOxShopId 
 3026             $oDb->execute($sUpdate);
 
 3038         return $this->
getId();
 
 3048         return $this->oxarticles__oxparentid->value;
 
 3068         return (
bool) (isset($this->oxarticles__oxparentid) ? $this->oxarticles__oxparentid->value : 
false);
 
 3078         $oMdVariant = 
oxNew(
"oxVariantHandler");
 
 3080         return $oMdVariant->isMdVariant($this);
 
 3095         $sSelectWhere = 
"select $sFields from " . $this->
_getObjectViewName(
'oxcategories') . 
" where";
 
 3096         $sQuotedPrice = 
oxDb::getDb()->quote($this->oxarticles__oxprice->value);
 
 3098         return "$sSelectWhere oxpricefrom != 0 and oxpriceto != 0 and oxpricefrom <= $sQuotedPrice and oxpriceto >= $sQuotedPrice" 
 3099                . 
" union $sSelectWhere oxpricefrom != 0 and oxpriceto = 0 and oxpricefrom <= $sQuotedPrice" 
 3100                . 
" union $sSelectWhere oxpricefrom = 0 and oxpriceto != 0 and oxpriceto >= $sQuotedPrice";
 
 3114         $sQuotedPrice = $oDb->quote($this->oxarticles__oxprice->value);
 
 3115         $sQuotedCnid = $oDb->quote($sCatNid);
 
 3117         return (
bool) $oDb->getOne(
 
 3118             "select 1 from " . $this->
_getObjectViewName(
'oxcategories') . 
" where oxid=$sQuotedCnid and" 
 3119             . 
"(   (oxpricefrom != 0 and oxpriceto != 0 and oxpricefrom <= $sQuotedPrice and oxpriceto >= $sQuotedPrice)" 
 3120             . 
" or (oxpricefrom != 0 and oxpriceto = 0 and oxpricefrom <= $sQuotedPrice)" 
 3121             . 
" or (oxpricefrom = 0 and oxpriceto != 0 and oxpriceto >= $sQuotedPrice)" 
 3133         if ($this->_oMdVariants) {
 
 3138         if ($oParentArticle) {
 
 3139             $oVariants = $oParentArticle->getVariants();
 
 3144         $oVariantHandler = 
oxNew(
"oxVariantHandler");
 
 3145         $this->_oMdVariants = $oVariantHandler->buildMdVariants($oVariants, $this->
getId());
 
 3171             $sFieldName = 
"oxarticles__" . $sFieldName . $iIndex;
 
 3173             return $this->$sFieldName->value;
 
 3187         $sPicName = basename($this->{
"oxarticles__oxpic" . $iIndex}->value);
 
 3189         if ($sPicName && $sPicName != 
"nopic.jpg") {
 
 3190             $sPicUrl = $this->
getConfig()->getPictureUrl(
"master/product/" . $iIndex . 
"/" . $sPicName);
 
 3191             if (!$sPicUrl || basename($sPicUrl) == 
"nopic.jpg") {
 
 3206         if ($this->oxarticles__oxunitname->value) {
 
 3220         if ($this->_aArticleFiles === null) {
 
 3222             $this->_aArticleFiles = 
false;
 
 3224             $sQ = 
"SELECT * FROM `oxfiles` WHERE `oxartid` = '" . $this->
getId() . 
"'";
 
 3226             if (!$this->
getConfig()->getConfigParam(
'blVariantParentBuyable') && $blAddFromParent) {
 
 3227                 $sQ .= 
" OR `oxartId` = '" . $this->oxarticles__oxparentid->value . 
"'";
 
 3230             $oArticleFiles = 
oxNew(
"oxlist");
 
 3231             $oArticleFiles->init(
"oxfile");
 
 3232             $oArticleFiles->selectString($sQ);
 
 3233             $this->_aArticleFiles = $oArticleFiles;
 
 3247         return $this->oxarticles__oxisdownloadable->value;
 
 3257         if (self::$_blHasAmountPrice === null) {
 
 3259             self::$_blHasAmountPrice = 
false;
 
 3262             $sQ = 
"SELECT 1 FROM `oxprice2article` LIMIT 1";
 
 3264             if ($oDb->getOne($sQ)) {
 
 3265                 self::$_blHasAmountPrice = 
true;
 
 3281     protected function _loadVariantList($blSimple, $blRemoveNotOrderables = 
true, $blForceCoreTable = null)
 
 3283         $oVariants = array();
 
 3284         if (($sId = $this->
getId())) {
 
 3286             self::$_aLoadedParents[$sId . 
"_" . $this->
getLanguage()] = $this;
 
 3290             if (!$this->_blLoadVariants ||
 
 3292                 (!$this->
isAdmin() && !$this->oxarticles__oxvarcount->value)
 
 3298             $sCacheKey = $blSimple ? 
"simple" : 
"full";
 
 3299             if ($blRemoveNotOrderables) {
 
 3300                 if (isset($this->_aVariants[$sCacheKey])) {
 
 3301                     return $this->_aVariants[$sCacheKey];
 
 3303                     $this->_aVariants[$sCacheKey] = & $oVariants;
 
 3305             } elseif (!$blRemoveNotOrderables) {
 
 3306                 if (isset($this->_aVariantsWithNotOrderables[$sCacheKey])) {
 
 3307                     return $this->_aVariantsWithNotOrderables[$sCacheKey];
 
 3309                     $this->_aVariantsWithNotOrderables[$sCacheKey] = & $oVariants;
 
 3313             if (($this->_blHasVariants = $this->
_hasAnyVariant($blForceCoreTable))) {
 
 3317                     $oVariants = 
oxNew(
'oxsimplevariantlist');
 
 3318                     $oVariants->setParent($this);
 
 3321                     $oVariants = 
oxNew(
'oxarticlelist');
 
 3322                     $oVariants->getBaseObject()->modifyCacheKey(
'_variants');
 
 3325                 startProfile(
"selectVariants");
 
 3326                 $blUseCoreTable = (bool) $blForceCoreTable;
 
 3327                 $oBaseObject = $oVariants->getBaseObject();
 
 3331                 $sArticleTable = $this->
getViewName($blUseCoreTable);
 
 3333                 $sSelect = 
"select " . $oBaseObject->getSelectFields($blUseCoreTable) . 
" from $sArticleTable where " .
 
 3336                            " order by $sArticleTable.oxsort";
 
 3337                 $oVariants->selectString($sSelect);
 
 3340                 if (
$myConfig->getConfigParam(
'blUseMultidimensionVariants')) {
 
 3341                     $oMdVariants = 
oxNew(
"oxVariantHandler");
 
 3342                     $this->_blHasMdVariants = $oMdVariants->isMdVariant($oVariants->current());
 
 3344                 stopProfile(
"selectVariants");
 
 3349                 $this->_blNotBuyableParent = 
true;
 
 3354                 $this->_blNotBuyable = 
true;
 
 3372         $aResult = $oDb->getAll($sSql);
 
 3376         foreach ($aResult as $aValue) {
 
 3377             $aValue = array_change_key_case($aValue, CASE_LOWER);
 
 3380             $aReturn[] = $aValue[$sField];
 
 3398         $sArticleIdSql = 
'oxobject2category.oxobjectid=' . 
oxDb::getDb()->quote($this->
getId());
 
 3400             $sArticleIdSql = 
'(' . $sArticleIdSql . 
' or oxobject2category.oxobjectid=' . 
oxDb::getDb()->quote($this->
getParentId()) . 
')';
 
 3405                         oxobject2category.oxcatnid as oxcatnid 
 3406                      from $sO2CView as oxobject2category 
 3407                         left join $sCatView as oxcategories on oxcategories.oxid = oxobject2category.oxcatnid 
 3408                     where $sArticleIdSql and oxcategories.oxid is not null and oxcategories.oxactive = 1 $sActiveCategorySql 
 3409                     order by oxobject2category.oxtime";
 
 3422         $sActiveCategorySql = 
"and oxcategories.oxhidden = 0 and (select count(cats.oxid) from $sCatView as cats where cats.oxrootid = oxcategories.oxrootid and cats.oxleft < oxcategories.oxleft and cats.oxright > oxcategories.oxright and ( cats.oxhidden = 1 or cats.oxactive = 0 ) ) = 0 ";
 
 3424         return $sActiveCategorySql;
 
 3441         $sSelect = 
"select oxobject2category.oxcatnid as oxcatnid from $sO2CView as oxobject2category left join $sCatView as oxcategories on oxcategories.oxid = oxobject2category.oxcatnid ";
 
 3442         $sSelect .= 
'where oxobject2category.oxobjectid=' . 
oxDb::getDb()->quote($sOXID) . 
' and oxcategories.oxid is not null and oxcategories.oxactive = 1 ';
 
 3444             $sSelect .= 
"and oxcategories.oxhidden = 0 and (select count(cats.oxid) from $sCatView as cats where cats.oxrootid = oxcategories.oxrootid and cats.oxleft < oxcategories.oxleft and cats.oxright > oxcategories.oxright and ( cats.oxhidden = 1 or cats.oxactive = 0 ) ) = 0 ";
 
 3446         $sSelect .= 
'order by oxobject2category.oxtime ';
 
 3462         if (isset($dVat) || !$this->
getConfig()->getConfigParam(
'bl_perfCalcVatOnlyForBasketOrder')) {
 
 3471             $aDiscounts = $oDiscountList->getArticleDiscounts($this, $this->
getArticleUser());
 
 3474             foreach ($aDiscounts as $oDiscount) {
 
 3475                 $oPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
 
 3477             $oPrice->calculateDiscount();
 
 3493         if (($sId = $this->
getId())) {
 
 3494             if ($this->oxarticles__oxshopid->value == $this->getConfig()->getShopId()) {
 
 3495                 $blHas = (bool) $this->oxarticles__oxvarcount->value;
 
 3497                 $sArticleTable = $this->
getViewName($blForceCoreTable);
 
 3498                 $blHas = (bool) 
oxDb::getDb()->getOne(
"select 1 from $sArticleTable where oxparentid='{$sId}'");
 
 3522         return $this->
_isStockStatusChanged() && ($this->_iStockStatus == -1 || $this->_iStockStatusOnLoad == -1);
 
 3534         if (in_array(
"oxlongdesc", $this->_aSkipSaveFields)) {
 
 3538         if ($this->_blEmployMultilanguage) {
 
 3540             if ($sValue !== null) {
 
 3541                 $oArtExt = 
oxNew(
'oxI18n');
 
 3542                 $oArtExt->init(
'oxartextends');
 
 3543                 $oArtExt->setLanguage((
int) $this->
getLanguage());
 
 3544                 if (!$oArtExt->load($this->getId())) {
 
 3545                     $oArtExt->setId($this->
getId());
 
 3551             $oArtExt = 
oxNew(
'oxI18n');
 
 3552             $oArtExt->setEnableMultilang(
false);
 
 3553             $oArtExt->init(
'oxartextends');
 
 3554             $aObjFields = $oArtExt->_getAllFields(
true);
 
 3555             if (!$oArtExt->load($this->getId())) {
 
 3556                 $oArtExt->setId($this->
getId());
 
 3559             foreach ($aObjFields as $sKey => $sValue) {
 
 3560                 if (preg_match(
'/^oxlongdesc(_(\d{1,2}))?$/', $sKey)) {
 
 3563                     if (isset($this->$sField)) {
 
 3565                         if ($this->$sField instanceof 
oxField) {
 
 3566                             $sLongDesc = $this->$sField->getRawValue();
 
 3567                         } elseif (is_object($this->$sField)) {
 
 3568                             $sLongDesc = $this->$sField->value;
 
 3570                         if (isset($sLongDesc)) {
 
 3571                             $sAEField = $oArtExt->_getFieldLongName($sKey);
 
 3588         $this->_aSkipSaveFields = array();
 
 3590         $this->_aSkipSaveFields[] = 
'oxtimestamp';
 
 3592         $this->_aSkipSaveFields[] = 
'oxinsert';
 
 3595         if (!$this->_blAllowEmptyParentId && (!isset($this->oxarticles__oxparentid->value) || $this->oxarticles__oxparentid->value == 
'')) {
 
 3596             $this->_aSkipSaveFields[] = 
'oxparentid';
 
 3612         foreach ($aItemDiscounts as $sKey => $oDiscount) {
 
 3614             if (array_key_exists($sKey, $aDiscounts)) {
 
 3615                 $aDiscounts[$sKey]->dDiscount += $oDiscount->dDiscount;
 
 3617                 $aDiscounts[$sKey] = $oDiscount;
 
 3632         $sVarName = 
"oxarticles__oxprice{$sPriceSufix}";
 
 3633         $dPrice = $this->$sVarName->value;
 
 3636         if ($this->
getConfig()->getConfigParam(
'blOverrideZeroABCPrices') && (
double) $dPrice == 0) {
 
 3637             $dPrice = $this->oxarticles__oxprice->value;
 
 3653         startProfile(
"_getAmountPrice");
 
 3657         foreach ($oAmtPrices as $oAmPrice) {
 
 3658             if ($oAmPrice->oxprice2article__oxamount->value <= $dAmount
 
 3659                 && $dAmount <= $oAmPrice->oxprice2article__oxamountto->value
 
 3660                 && $dPrice > $oAmPrice->oxprice2article__oxaddabs->value
 
 3662                 $dPrice = $oAmPrice->oxprice2article__oxaddabs->value;
 
 3666         stopProfile(
"_getAmountPrice");
 
 3683         if (
$myConfig->getConfigParam(
'bl_perfLoadSelectLists') && 
$myConfig->getConfigParam(
'bl_perfUseSelectlistPrice')) {
 
 3687             foreach ($aSelLists as $key => $aSel) {
 
 3688                 if (isset($aChosenList[$key]) && isset($aSel[$aChosenList[$key]])) {
 
 3689                     $oSel = $aSel[$aChosenList[$key]];
 
 3690                     if ($oSel->priceUnit == 
'abs') {
 
 3691                         $dPrice += $oSel->price;
 
 3692                     } elseif ($oSel->priceUnit == 
'%') {
 
 3714         foreach ($aAmPriceList as $sId => $oItem) {
 
 3717             if ($oItem->oxprice2article__oxaddabs->value) {
 
 3719                 $dBasePrice = $oItem->oxprice2article__oxaddabs->value;
 
 3722                 $oItemPrice->setPrice($dBasePrice);
 
 3728                 $oItemPrice->setPrice($dBasePrice);
 
 3729                 $oItemPrice->subtractPercent($oItem->oxprice2article__oxaddperc->value);
 
 3733             $aAmPriceList[$sId]->fbrutprice = $oLang->formatCurrency($this->
_getPriceForView($oItemPrice));
 
 3736         return $aAmPriceList;
 
 3749         $sId = $this->
getId();
 
 3751             $sActiveSqlSnippet = 
"";
 
 3752             if ($blActiveVariants) {
 
 3756             $sQ = 
"select oxid from " . $this->
getViewName(
true) . 
" where oxparentid = " . $oDb->quote($sId) .
 
 3757                   $sActiveSqlSnippet . 
" order by oxsort";
 
 3758             $oRs = $oDb->select($sQ);
 
 3759             if ($oRs != 
false && $oRs->recordCount() > 0) {
 
 3760                 while (!$oRs->EOF) {
 
 3761                     $aSelect[] = reset($oRs->fields);
 
 3791         if (!isset($this->_dArticleVat)) {
 
 3792             $this->_dArticleVat = 
oxRegistry::get(
"oxVatSelector")->getArticleVat($this);
 
 3806         startProfile(__FUNCTION__);
 
 3807         $oPrice->setVAT($dVat);
 
 3810         if (($dVat = $oVatSelector->getArticleUserVat($this)) !== 
false) {
 
 3813         stopProfile(__FUNCTION__);
 
 3825             $oCur = $this->
getConfig()->getActShopCurrencyObject();
 
 3842         $sSelect = 
'select oxattrid from oxobject2attribute where oxobject2attribute.oxobjectid=' . $oDb->quote($this->
getId());
 
 3844             $sSelect .= 
' OR oxobject2attribute.oxobjectid=' . $oDb->quote($this->
getParentId());
 
 3846         $sAttributeSql = 
'';
 
 3847         $aAttributeIds = $oDb->getCol($sSelect);
 
 3848         if (is_array($aAttributeIds) && count($aAttributeIds)) {
 
 3849             $aAttributeIds = array_unique($aAttributeIds);
 
 3850             $iCnt = count($aAttributeIds);
 
 3851             $sAttributeSql .= 
't1.oxattrid IN ( ' . implode(
',', $oDb->quoteArray($aAttributeIds)) . 
') ';
 
 3866         $iAttrPercent = $this->
getConfig()->getConfigParam(
'iAttributesPercent') / 100;
 
 3868         if (!$iAttrPercent || $iAttrPercent < 0 || $iAttrPercent > 1) {
 
 3869             $iAttrPercent = 0.70;
 
 3872         $iHitMin = ceil($iCnt * $iAttrPercent);
 
 3874         $aExcludeIds = array();
 
 3875         $aExcludeIds[] = $this->
getId();
 
 3881         $sSelect = 
"select oxobjectid from oxobject2attribute as t1 where 
 3883                     and t1.oxobjectid NOT IN (" . implode(
', ', 
oxDb::getDb()->quoteArray($aExcludeIds)) . 
") 
 3884                     group by t1.oxobjectid having count(*) >= $iHitMin LIMIT 0, 20";
 
 3900         $aList = array_slice($aList, 0, $this->
getConfig()->getConfigParam(
'iNrofSimilarArticles'));
 
 3902         $sSearch = 
"select $sFieldList from $sArticleTable where " . $this->
getSqlActiveSnippet() . 
"  and $sArticleTable.oxissearch = 1 and $sArticleTable.oxid in ( ";
 
 3904         $sSearch .= implode(
',', 
oxdb::getDb()->quoteArray($aList)) . 
')';
 
 3907         $sSearch .= 
' order by rand() ';
 
 3927         if (!$blSearchPriceCat) {
 
 3928             $sSelect = 
"select {$sCatView}.* from {$sO2CView} as oxobject2category left join {$sCatView} on 
 3929                          {$sCatView}.oxid = oxobject2category.oxcatnid 
 3930                          where oxobject2category.oxobjectid=" . 
oxDb::getDb()->quote($sOXID) . 
" and {$sCatView}.oxid is not null ";
 
 3932             $sSelect = 
"select {$sCatView}.* from {$sCatView} where 
 3933                          '{$this->oxarticles__oxprice->value}' >= {$sCatView}.oxpricefrom and 
 3934                          '{$this->oxarticles__oxprice->value}' <= {$sCatView}.oxpriceto ";
 
 3951         $sIn = 
" '{$this->oxarticles__oxid->value}' ";
 
 3952         if ($this->oxarticles__oxparentid->value) {
 
 3955             $sIn .= 
", '{$this->oxarticles__oxparentid->value}' ";
 
 3956             $sParentIdForVariants = $this->oxarticles__oxparentid->value;
 
 3959             $sParentIdForVariants = $this->
getId();
 
 3964         $oRs = $oDb->select(
"select oxid from {$sArtTable} where oxparentid = " . $oDb->quote($sParentIdForVariants) . 
" and oxid != " . $oDb->quote($this->oxarticles__oxid->value));
 
 3965         if ($oRs != 
false && $oRs->recordCount() > 0) {
 
 3966             while (!$oRs->EOF) {
 
 3967                 $sIn .= 
", " . $oDb->quote(current($oRs->fields)) . 
" ";
 
 3972         $iLimit = (int) $this->
getConfig()->getConfigParam(
'iNrofCustomerWhoArticles');
 
 3973         $iLimit = $iLimit ? ($iLimit * 10) : 50;
 
 3976         $sQ = 
"select distinct {$sArtTable}.* from ( 
 3977                    select d.oxorderid as suborderid from {$sOrderArtTable} as d use index ( oxartid ) where d.oxartid in ( {$sIn} ) limit {$iLimit} 
 3979                left join {$sOrderArtTable} force index ( oxorderid ) on suborder.suborderid = {$sOrderArtTable}.oxorderid 
 3980                left join {$sArtTable} on {$sArtTable}.oxid = {$sOrderArtTable}.oxartid 
 3981                where {$sArtTable}.oxid not in ( {$sIn} ) 
 3982                and ( {$sArtTable}.oxissearch = 1 or {$sArtTable}.oxparentid <> '' ) and " . $this->
getSqlActiveSnippet();
 
 4011         $sOXID = $oDb->quote($sOXID);
 
 4012         $sCatId = $oDb->quote($sCatId);
 
 4014         if (!$dPriceFromTo) {
 
 4015             $sSelect = 
"select oxobject2category.oxcatnid from $sO2CView as oxobject2category ";
 
 4016             $sSelect .= 
"left join $sCategoryView as oxcategories on oxcategories.oxid = oxobject2category.oxcatnid ";
 
 4017             $sSelect .= 
"where oxobject2category.oxcatnid=$sCatId and oxobject2category.oxobjectid=$sOXID ";
 
 4018             $sSelect .= 
"and oxcategories.oxactive = 1 order by oxobject2category.oxtime ";
 
 4020             $dPriceFromTo = $oDb->quote($dPriceFromTo);
 
 4021             $sSelect = 
"select oxcategories.oxid from $sCategoryView as oxcategories where ";
 
 4022             $sSelect .= 
"oxcategories.oxid=$sCatId and $dPriceFromTo >= oxcategories.oxpricefrom and ";
 
 4023             $sSelect .= 
"$dPriceFromTo <= oxcategories.oxpriceto ";
 
 4036         if ($this->_oAmountPriceList === null) {
 
 4037             $oAmPriceList = 
oxNew(
'oxAmountPricelist');
 
 4041                 $oAmPriceList->load($this);
 
 4045                 foreach ($oAmPriceList as $oAmPrice) {
 
 4046                     if ($oAmPrice->oxprice2article__oxaddperc->value) {
 
 4053             $this->_oAmountPriceList = $oAmPriceList;
 
 4068         $mValue = $this->$sFieldName->value;
 
 4070         if (is_null($mValue)) {
 
 4074         if ($mValue === 
'') {
 
 4079         $aZeroValueFields = array(
'oxarticles__oxprice', 
'oxarticles__oxvat', 
'oxarticles__oxunitquantity');
 
 4081         if (!$mValue && in_array($sFieldName, $aZeroValueFields)) {
 
 4086         if (!strcmp($mValue, 
'0000-00-00 00:00:00') || !strcmp($mValue, 
'0000-00-00')) {
 
 4090         $sFieldName = strtolower($sFieldName);
 
 4092         if ($sFieldName == 
'oxarticles__oxicon' && (strpos($mValue, 
"nopic_ico.jpg") !== 
false || strpos($mValue, 
"nopic.jpg") !== 
false)) {
 
 4096         if (strpos($mValue, 
"nopic.jpg") !== 
false && ($sFieldName == 
'oxarticles__oxthumb' || substr($sFieldName, 0, 17) == 
'oxarticles__oxpic' || substr($sFieldName, 0, 18) == 
'oxarticles__oxzoom')) {
 
 4119         if ($oParentArticle->$sCopyFieldName != null) {
 
 4122             if (substr($sCopyFieldName, 0, 12) != 
'oxarticles__') {
 
 4127             if (in_array($sCopyFieldName, $this->_aNonCopyParentFields)) {
 
 4138                 $this->$sCopyFieldName = clone $oParentArticle->$sCopyFieldName;
 
 4152         $blIsImageField = (stristr($sFieldName, 
'_oxthumb') || stristr($sFieldName, 
'_oxicon') || stristr($sFieldName, 
'_oxzoom') || stristr($sFieldName, 
'_oxpic'));
 
 4154         return $blIsImageField;
 
 4162         startProfile(
'articleAssignParentInternal');
 
 4163         if ($this->oxarticles__oxparentid->value) {
 
 4165             if (!$this->
isAdmin() || ($this->_blLoadParentData && $this->
isAdmin())) {
 
 4166                 foreach ($this->_aFieldNames as $sFieldName => $sVal) {
 
 4171         stopProfile(
'articleAssignParentInternal');
 
 4179         if (!$this->
getConfig()->getConfigParam(
'blVariantParentBuyable') &&
 
 4180             ($this->_blHasVariants || $this->oxarticles__oxvarstock->value || $this->oxarticles__oxvarcount->value)
 
 4182             $this->_blNotBuyableParent = 
true;
 
 4198         if (!
$myConfig->getConfigParam(
'blAllowUnevenAmounts') && !$this->
isAdmin()) {
 
 4199             $this->oxarticles__oxstock = 
new oxField((
int) floor($this->oxarticles__oxstock->value));
 
 4202         $this->_iStockStatus = 0;
 
 4205         if (
$myConfig->getConfigParam(
'blUseStock') && 
 
 4206             $this->oxarticles__oxstockflag->value != 4
 
 4209             $iStock = $this->oxarticles__oxstock->value;
 
 4211             if ($this->_blNotBuyableParent) {
 
 4212                 $iStock = $this->oxarticles__oxvarstock->value;
 
 4216             if ($iStock <= $myConfig->getConfigParam(
'sStockWarningLimit') && $iStock > 0) {
 
 4217                 $this->_iStockStatus = 1;
 
 4222                 $this->_iStockStatus = -1;
 
 4228         if (
$myConfig->getConfigParam(
'blUseStock') && ($this->oxarticles__oxstockflag->value == 3 || $this->oxarticles__oxstockflag->value == 2)) {
 
 4229             $iOnStock = $this->oxarticles__oxstock->value;
 
 4230             if ($this->
getConfig()->getConfigParam(
'blPsBasketReservationEnabled')) {
 
 4231                 $iOnStock += $this->
getSession()->getBasketReservations()->getReservedAmount($this->
getId());
 
 4233             if ($iOnStock <= 0) {
 
 4239         if ($this->_blNotBuyable && $this->oxarticles__oxvarstock->value) {
 
 4242             $this->_blNotBuyableParent = 
true;
 
 4248         if (!
$myConfig->getConfigParam(
'blVariantParentBuyable') && !
$myConfig->getConfigParam(
'blLoadVariants') && $this->oxarticles__oxvarstock->value) {
 
 4253         if (!$this->_blNotBuyable && $this->_blNotBuyableParent && $this->oxarticles__oxvarcount->value == 0) {
 
 4265         if (isset($aPersParam) && isset($aPersParam[$this->
getId()])) {
 
 4266             $this->_aPersistParam = $aPersParam[$this->
getId()];
 
 4277         $sThisShop = $this->oxarticles__oxshopid->value;
 
 4279         $this->_sDynImageDir = 
$myConfig->getPictureUrl(null, 
false);
 
 4280         $this->dabsimagedir = 
$myConfig->getPictureDir(
false); 
 
 4281         $this->nossl_dimagedir = 
$myConfig->getPictureUrl(null, 
false, 
false, null, $sThisShop); 
 
 4282         $this->ssl_dimagedir = 
$myConfig->getPictureUrl(null, 
false, 
true, null, $sThisShop); 
 
 4293         if (isset($aItems[$this->
getId()])) {
 
 4294             $this->_blIsOnComparisonList = 
true;
 
 4308         $sNow = date(
'Y-m-d H:i:s', 
oxRegistry::get(
"oxUtilsDate")->getTime());
 
 4309         $this->oxarticles__oxinsert = 
new oxField($sNow);
 
 4310         if (!is_object($this->oxarticles__oxsubclass) || $this->oxarticles__oxsubclass->value == 
'') {
 
 4311             $this->oxarticles__oxsubclass = 
new oxField(
'oxarticle');
 
 4353         $sOXID = $oDb->quote($sOXID);
 
 4356         $sDelete = 
'delete from oxobject2article where oxarticlenid = ' . $sOXID . 
' or oxobjectid = ' . $sOXID . 
' ';
 
 4357         $oDb->execute($sDelete);
 
 4359         $sDelete = 
'delete from oxobject2attribute where oxobjectid = ' . $sOXID . 
' ';
 
 4360         $oDb->execute($sDelete);
 
 4362         $sDelete = 
'delete from oxobject2category where oxobjectid = ' . $sOXID . 
' ';
 
 4363         $oDb->execute($sDelete);
 
 4365         $sDelete = 
'delete from oxobject2selectlist where oxobjectid = ' . $sOXID . 
' ';
 
 4366         $oDb->execute($sDelete);
 
 4368         $sDelete = 
'delete from oxprice2article where oxartid = ' . $sOXID . 
' ';
 
 4369         $oDb->execute($sDelete);
 
 4371         $sDelete = 
'delete from oxreviews where oxtype="oxarticle" and oxobjectid = ' . $sOXID . 
' ';
 
 4372         $oDb->execute($sDelete);
 
 4374         $sDelete = 
'delete from oxratings where oxobjectid = ' . $sOXID . 
' ';
 
 4375         $rs = $oDb->execute($sDelete);
 
 4377         $sDelete = 
'delete from oxaccessoire2article where oxobjectid = ' . $sOXID . 
' or oxarticlenid = ' . $sOXID . 
' ';
 
 4378         $oDb->execute($sDelete);
 
 4381         $sDelete = 
'delete from oxobject2delivery where oxobjectid = ' . $sOXID . 
' and oxtype=\'oxarticles\' ';
 
 4382         $oDb->execute($sDelete);
 
 4384         $sDelete = 
'delete from oxartextends where oxid = ' . $sOXID . 
' ';
 
 4385         $oDb->execute($sDelete);
 
 4389             $oDb->execute(
"delete from $sSetTbl where oxid = {$sOXID}");
 
 4392         $sDelete = 
'delete from oxactions2article where oxartid = ' . $sOXID . 
' ';
 
 4393         $rs = $oDb->execute($sDelete);
 
 4395         $sDelete = 
'delete from oxobject2list where oxobjectid = ' . $sOXID . 
' ';
 
 4396         $rs = $oDb->execute($sDelete);
 
 4412             $sQ = 
'select oxid from ' . $this->
getViewName() . 
' where oxparentid = ' . $oDb->quote($sOXID);
 
 4413             $rs = $oDb->select($sQ, 
false, 
false);
 
 4414             $oArticle = 
oxNew(
"oxArticle");
 
 4415             if ($rs != 
false && $rs->recordCount() > 0) {
 
 4417                     $oArticle->setId($rs->fields[0]);
 
 4418                     $oArticle->delete();
 
 4435         $oPictureHandler->deleteMainIcon($this);
 
 4438         $oPictureHandler->deleteThumbnail($this);
 
 4440         $sAbsDynImageDir = 
$myConfig->getPictureDir(
false);
 
 4443         $iPicCount = 
$myConfig->getConfigParam(
'iPicCount');
 
 4444         for ($i = 1; $i <= $iPicCount; $i++) {
 
 4445             $oPictureHandler->deleteArticleMasterPicture($this, $i);
 
 4461             $myUtilsCount->resetVendorArticleCount($sVendorId);
 
 4464         if ($sManufacturerId) {
 
 4465             $myUtilsCount->resetManufacturerArticleCount($sManufacturerId);
 
 4470         foreach ($aCategoryIds as $sCatId) {
 
 4471             $myUtilsCount->resetCatArticleCount($sCatId, 
false);
 
 4484             $sParentIdQuoted = $oDb->quote($sParentID);
 
 4485             $sQ = 
'select oxstock, oxvendorid, oxmanufacturerid from oxarticles where oxid = ' . $sParentIdQuoted;
 
 4486             $rs = $oDb->select($sQ, 
false, 
false);
 
 4487             $iOldStock = $rs->fields[0];
 
 4488             $iVendorID = $rs->fields[1];
 
 4489             $iManufacturerID = $rs->fields[2];
 
 4491             $sQ = 
'select sum(oxstock) from ' . $this->
getViewName(
true) . 
' where oxparentid = ' . $sParentIdQuoted . 
' and ' . $this->
getSqlActiveSnippet(
true) . 
' and oxstock > 0 ';
 
 4492             $iStock = (float) $oDb->getOne($sQ, 
false, 
false);
 
 4494             $sQ = 
'update oxarticles set oxvarstock = ' . $iStock . 
' where oxid = ' . $sParentIdQuoted;
 
 4502             if ($iOldStock < 0) {
 
 4505             if ($this->oxarticles__oxstockflag->value == 2 && $iOldStock xor $iStock) {
 
 4522         if (
$myConfig->getConfigParam(
'blUseStock') && $this->oxarticles__oxstockflag->value == 2 &&
 
 4523             ($this->oxarticles__oxstock->value + $this->oxarticles__oxvarstock->value) <= 0
 
 4526             $this->
_onChangeResetCounts($sOxid, $this->oxarticles__oxvendorid->value, $this->oxarticles__oxmanufacturerid->value);
 
 4539             $sParentIdQuoted = $oDb->quote($sParentID);
 
 4540             $sQ = 
"select count(*) as varcount from oxarticles where oxparentid = {$sParentIdQuoted}";
 
 4541             $iVarCount = (int) $oDb->getOne($sQ, 
false, 
false);
 
 4543             $sQ = 
"update oxarticles set oxvarcount = {$iVarCount} where oxid = {$sParentIdQuoted}";
 
 4559                     MIN( IF( `oxarticles`.`oxprice` > 0, `oxarticles`.`oxprice`, `p`.`oxprice` ) ) AS `varminprice`, 
 4560                     MAX( IF( `oxarticles`.`oxprice` > 0, `oxarticles`.`oxprice`, `p`.`oxprice` ) ) AS `varmaxprice` 
 4561                 FROM ' . $this->
getViewName(
true) . 
' AS `oxarticles` 
 4562                     LEFT JOIN ' . $this->
getViewName(
true) . 
' AS `p` ON ( `p`.`oxid` = `oxarticles`.`oxparentid` AND `p`.`oxprice` > 0 ) 
 4564                     AND ( `oxarticles`.`oxparentid` = ' . $oDb->quote($sParentId) . 
' )';
 
 4566             $aPrices = $oDb->getRow($sQ, 
false, 
false);
 
 4567             if (!is_null($aPrices[
'varminprice']) || !is_null($aPrices[
'varmaxprice'])) {
 
 4571                         `oxvarminprice` = ' . $oDb->quote($aPrices[
'varminprice']) . 
', 
 4572                         `oxvarmaxprice` = ' . $oDb->quote($aPrices[
'varmaxprice']) . 
' 
 4574                         `oxid` = ' . $oDb->quote($sParentId);
 
 4579                         `oxvarminprice` = `oxprice`, 
 4580                         `oxvarmaxprice` = `oxprice` 
 4582                         `oxid` = ' . $oDb->quote($sParentId);
 
 4597         $sPicName = basename($this->{
"oxarticles__oxpic" . $iIndex}->value);
 
 4599         if ($sPicName == 
"nopic.jpg" || $sPicName == 
"") {
 
 4604             $this->
getParentArticle()->{
"oxarticles__oxpic" . $iIndex}->value == $this->{
"oxarticles__oxpic" . $iIndex}->value
 
 4609         $sMasterPic = 
'product/' . $iIndex . 
"/" . $sPicName;
 
 4611         if ($this->
getConfig()->getMasterPicturePath($sMasterPic)) {
 
 4625         $blResult = (bool) $this->
getConfig()->getConfigParam(
'blShowNetPrice');
 
 4628             $blResult = $oUser->isPriceViewModeNetto();
 
 4644         $oPrice = 
oxNew(
'oxPrice');
 
 4646         if ($blCalculationModeNetto === null) {
 
 4650         if ($blCalculationModeNetto) {
 
 4651             $oPrice->setNettoPriceMode();
 
 4653             $oPrice->setBruttoPriceMode();
 
 4670             $dPrice = $oPrice->getNettoPrice();
 
 4672             $dPrice = $oPrice->getBruttoPrice();
 
 4688     protected function _preparePrice($dPrice, $dVat, $blCalculationModeNetto = null)
 
 4690         if ($blCalculationModeNetto === null) {
 
 4694         $oCurrency = $this->
getConfig()->getActShopCurrencyObject();
 
 4696         $blEnterNetPrice = $this->
getConfig()->getConfigParam(
'blEnterNetPrice');
 
 4697         if ($blCalculationModeNetto && !$blEnterNetPrice) {
 
 4699         } elseif (!$blCalculationModeNetto && $blEnterNetPrice) {
 
 4717             if ($oUser->inGroup(
'oxidpricea')) {
 
 4718                 $sPriceSuffix = 
'a';
 
 4719             } elseif ($oUser->inGroup(
'oxidpriceb')) {
 
 4720                 $sPriceSuffix = 
'b';
 
 4721             } elseif ($oUser->inGroup(
'oxidpricec')) {
 
 4722                 $sPriceSuffix = 
'c';
 
 4726         return $sPriceSuffix;
 
 4738         if ($sPriceSuffix === 
'') {
 
 4739             $dPrice = $this->oxarticles__oxprice->value;
 
 4741             if ($this->
getConfig()->getConfigParam(
'blOverrideZeroABCPrices')) {
 
 4742                 $dPrice = ($this->{oxarticles__oxprice . $sPriceSuffix}->value != 0) ? $this->{oxarticles__oxprice . $sPriceSuffix}->value : $this->oxarticles__oxprice->value;
 
 4744                 $dPrice = $this->{oxarticles__oxprice . $sPriceSuffix}->value;
 
 4759         if ($this->_dVarMinPrice === null) {
 
 4763             if (is_null($dPrice)) {
 
 4765                 if ($sPriceSuffix === 
'') {
 
 4766                     $dPrice = $this->oxarticles__oxvarminprice->value;
 
 4769                     if ($this->
getConfig()->getConfigParam(
'blOverrideZeroABCPrices')) {
 
 4770                         $sSql .= 
'MIN( IF(`oxprice' . $sPriceSuffix . 
'` = 0, `oxprice`, `oxprice' . $sPriceSuffix . 
'`) ) AS `varminprice` ';
 
 4772                         $sSql .= 
'MIN(`oxprice' . $sPriceSuffix . 
'`) AS `varminprice` ';
 
 4783             $this->_dVarMinPrice = $dPrice;
 
 4798         if ($this->
getConfig()->getConfigParam(
'blMallCustomPrice') && $sShopId != $this->oxarticles__oxshopid->value) {
 
 4801             if ($sPriceSuffix != 
'' && $this->
getConfig()->getConfigParam(
'blOverrideZeroABCPrices')) {
 
 4802                 $sSql .= 
'MIN(IF(`oxfield2shop`.`oxprice' . $sPriceSuffix . 
'` = 0, `oxfield2shop`.`oxprice`, `oxfield2shop`.`oxprice' . $sPriceSuffix . 
'`)) AS `varminprice` ';
 
 4804                 $sSql .= 
'MIN(`oxfield2shop`.`oxprice' . $sPriceSuffix . 
'`) AS `varminprice` ';
 
 4806             $sSql .= 
' FROM ' . 
getViewName(
'oxfield2shop') . 
' AS oxfield2shop 
 4807                         INNER JOIN ' . $this->
getViewName(
true) . 
' AS oxarticles ON `oxfield2shop`.`oxartid` = `oxarticles`.`oxid` 
 4809                             AND ( `oxarticles`.`oxparentid` = ' . 
oxDb::getDb()->quote($this->
getId()) . 
' ) 
 4810                             AND ( `oxfield2shop`.`oxshopid` = ' . 
oxDb::getDb()->quote($sShopId) . 
' )';
 
 4824         if ($this->_dVarMaxPrice === null) {
 
 4828             if (is_null($dPrice)) {
 
 4830                 if ($sPriceSuffix === 
'') {
 
 4831                     $dPrice = $this->oxarticles__oxvarmaxprice->value;
 
 4834                     if ($this->
getConfig()->getConfigParam(
'blOverrideZeroABCPrices')) {
 
 4835                         $sSql .= 
'MAX( IF(`oxprice' . $sPriceSuffix . 
'` = 0, `oxprice`, `oxprice' . $sPriceSuffix . 
'`) ) AS `varmaxprice` ';
 
 4837                         $sSql .= 
'MAX(`oxprice' . $sPriceSuffix . 
'`) AS `varmaxprice` ';
 
 4848             $this->_dVarMaxPrice = $dPrice;
 
 4863         if ($this->
getConfig()->getConfigParam(
'blMallCustomPrice') && $sShopId != $this->oxarticles__oxshopid->value) {
 
 4866             if ($sPriceSuffix != 
'' && $this->
getConfig()->getConfigParam(
'blOverrideZeroABCPrices')) {
 
 4867                 $sSql .= 
'MAX(IF(`oxfield2shop`.`oxprice' . $sPriceSuffix . 
'` = 0, `oxfield2shop`.`oxprice`, `oxfield2shop`.`oxprice' . $sPriceSuffix . 
'`)) AS `varmaxprice` ';
 
 4869                 $sSql .= 
'MAX(`oxfield2shop`.`oxprice' . $sPriceSuffix . 
'`) AS `varmaxprice` ';
 
 4871             $sSql .= 
' FROM ' . 
getViewName(
'oxfield2shop') . 
' AS oxfield2shop 
 4872                         INNER JOIN ' . $this->
getViewName(
true) . 
' AS oxarticles ON `oxfield2shop`.`oxartid` = `oxarticles`.`oxid` 
 4874                             AND ( `oxarticles`.`oxparentid` = ' . 
oxDb::getDb()->quote($this->
getId()) . 
' ) 
 4875                             AND ( `oxfield2shop`.`oxshopid` = ' . 
oxDb::getDb()->quote($sShopId) . 
' )';
 
 4910             $sValue = isset($this->$sField->value) ? $this->$sField->value : 0;
 
 4911             $sSqlSets[] = 
'`' . str_replace(
'oxarticles__', 
'', $sField) . 
'` = ' . $oDb->quote($sValue);
 
 4914         $sSql = 
"UPDATE `oxarticles` SET ";
 
 4915         $sSql .= implode(
', ', $sSqlSets) . 
'';
 
 4916         $sSql .= 
" WHERE `oxparentid` = " . $oDb->quote($this->
getId());
 
 4918         return $oDb->execute($sSql);
 
 4940                 $this->$sField = 
new oxField($sParent->$sField->value);
 
 4953         $aSortingFields = !empty($aSortingFields) ? (array) $aSortingFields : array();
 
 4955         foreach ($aSortingFields as $sField) {
 
 4957             $this->_aSortingFieldsOnLoad[$sFullField] = $this->$sFullField->value;