protected function _zw_getFromVariant() { if ($this->_oFromVariant === null && $this->isRangePrice()) { $this->_oFromVariant = false; $sPriceSuffix = $this->_getUserPriceSufix(); $dVarMinPrice = $this->_getVarMinPrice(); $dPrice = $this->_getPrice(); if ($dVarMinPrice !== null && $dPrice > $dVarMinPrice) { $sSql = 'SELECT oxid '; $sSql .= ' FROM ' . $this->getViewName(true) . ' WHERE ' . $this->getSqlActiveSnippet(true) . ' AND ( `oxparentid` = ' . oxDb::getDb()->quote($this->getId()) . ' ) AND (`oxprice' . $sPriceSuffix . '` = ' . oxDb::getDb()->quote($dVarMinPrice) . ' ) Limit 1'; $sOxid = oxdb::getDb()->getOne($sSql); $oVariant = oxnew('oxarticle'); if ($sOxid && $oVariant->load($sOxid)) { $this->_oFromVariant = $oVariant; } } } return $this->_oFromVariant; }
<?php require_once dirname(__FILE__) . "/bootstrap.php"; $oDb = oxdb::getDb(); //DELETE ALL ARTICLES $sql = "SELECT oxid FROM oxarticles WHERE oxparentid = ''"; $rs = $oDb->select($sql); if ($rs != false && $rs->recordCount() > 0) { while (!$rs->EOF) { $oArticle = oxNew("oxArticle"); echo "Article " . $rs->fields[0] . " deleted<br />"; $oArticle->setId($rs->fields[0]); $oArticle->delete(); $rs->moveNext(); } } //DELETE ALL CATEGORIES $sql = "SELECT oxid FROM oxcategories"; $rs = $oDb->select($sql); if ($rs != false && $rs->recordCount() > 0) { while (!$rs->EOF) { $oCat = oxNew("oxCategory"); echo "Category " . $rs->fields[0] . " deleted<br />"; $oCat->load($rs->fields[0]); $oCat->delete(); $rs->moveNext(); } } //DELETE ALL ATTRIBUTES $sql = "SELECT oxid FROM oxattribute"; $rs = $oDb->select($sql);
/** * Generates search string for similar list. * * @param string $sArticleTable Article table name * @param array $aList A list of original articles * * @return string */ protected function _generateSimListSearchStr($sArticleTable, $aList) { $sFieldList = $this->getSelectFields(); $aList = array_slice($aList, 0, $this->getConfig()->getConfigParam('iNrofSimilarArticles')); $sSearch = "select {$sFieldList} from {$sArticleTable} where " . $this->getSqlActiveSnippet() . " and {$sArticleTable}.oxissearch = 1 and {$sArticleTable}.oxid in ( "; $sSearch .= implode(',', oxdb::getDb()->quoteArray($aList)) . ')'; // #524A -- randomizing articles in attribute list $sSearch .= ' order by rand() '; return $sSearch; }
public function DoValidate() { $tmpl = new XTC2OXIDUI_Template(XTC2OXIDUI_BASEDIR . '/tmpl/step1.html'); $set = $this->GetSettingsFromRequest(); $this->SetSettings($tmpl, $set); $tmpl->Set('{STATUS}', ''); $errors = array(); $imgdir = $this->Filter($set['oxid-xtc-imgdir']); if (false == is_dir($imgdir)) { array_push($errors, 'Invalid XTC Image Directory: ' . $imgdir); } $oxiddir = $this->Filter($set['oxid-install-dir']); if (false == is_dir($oxiddir)) { array_push($errors, 'Invalid OXID Directory: ' . $oxiddir); } else { $this->InitOxid($oxiddir); global $myConfig; $myConfig = oxRegistry::getConfig(); #$user = oxSession::getVariable('usr'); #if (strpos($user, 'admin') === false) { # array_push($errors, 'You have to be logged in as an administrator in the shop front-end in order to use the importer!'); #} try { $oxDB = oxdb::getDb(true); $sql = 'SELECT COUNT(*) FROM ' . $set['oxid-xtc-db'] . '.products'; $oxDB->Execute($sql); $error = $oxDB->ErrorMsg(); if ($error) { array_push($errors, 'Invalid XTC Database: ' . $set['oxid-xtc-db']); } } catch (oxConnectionException $e) { array_push($errors, $e->getMessage()); } } if (count($errors) > 0) { $html = '<b>Error!</b><ul>'; foreach ($errors as $e) { $html .= '<li>' . $e . '</li>'; } $html .= '</ul>'; $tmpl->Set('{STATUS}', $html); } else { $step2 = new XTC2OXIDUI_Template(XTC2OXIDUI_BASEDIR . '/tmpl/step2.html'); $tmpl->Set('{STATUS}', $step2->Render()); $_SESSION['xtc2oxidui'] = $set; } echo $tmpl->Render(); }