33 $this->
init(
'oxshops' );
35 if ( $iMax = $this->
getConfig()->getConfigParam(
'iMaxShopId') ) {
36 $this->setMaxShopId( $iMax );
50 $this->_aMultiShopTables = $aMultiShopTables;
62 public function generateViews( $blMultishopInheritCategories =
false, $aMallInherit = null )
67 $aAllShopLanguages = $oLang->getAllShopLanguageIds();
74 foreach ( $aTables as $sTable ) {
75 $aQueries[] =
'CREATE OR REPLACE SQL SECURITY INVOKER VIEW oxv_'.$sTable.
' AS SELECT * FROM '.$sTable.
' '.$this->
_getViewJoinAll($sTable);
77 if (in_array($sTable, $aMultilangTables)) {
79 $aQueries[] =
'CREATE OR REPLACE SQL SECURITY INVOKER VIEW oxv_'.$sTable.
'_'.$sLang.
' AS SELECT '.$this->
_getViewSelect($sTable, $iLang).
' FROM '.$sTable.
' '.$this->
_getViewJoinLang($sTable, $iLang);
85 foreach ($aQueries as $sQuery) {
86 if ( !$oDb->execute( $sQuery ) ) {
91 $oViewsValidator =
oxNew(
'oxShopViewValidator' );
93 $oViewsValidator->setShopId( $this->
getId() );
95 $oViewsValidator->setAllShopLanguages( $aAllShopLanguages );
96 $oViewsValidator->setMultiLangTables( $aMultilangTables );
97 $oViewsValidator->setMultiShopTables( $aMultishopTables );
99 $aViews = $oViewsValidator->getInvalidViews();
101 foreach ($aViews as $sView) {
102 $oDb->execute(
'DROP VIEW IF EXISTS '. $sView );
118 $oMetaData =
oxNew(
'oxDbMetaDataHandler');
119 $aFields = $oMetaData->getSinglelangFields($sTable, $iLang);
120 foreach ($aFields as $sCoreField => $sField) {
121 if ($sCoreField !== $sField) {
122 $aFields[$sCoreField] = $sField.
' AS '.$sCoreField;
126 return implode(
',', $aFields);
139 $oMetaData =
oxNew(
'oxDbMetaDataHandler');
140 $aTables = $oMetaData->getAllMultiTables($sTable);
141 if (count($aTables)) {
142 foreach ($aTables as $sTableKey => $sTableName) {
143 $sJoin .=
"LEFT JOIN {$sTableName} USING (OXID) ";
160 $sLangTable = getLangTableName($sTable, $iLang);
161 if ($sLangTable && $sLangTable !== $sTable) {
162 $sJoin .=
"LEFT JOIN {$sLangTable} USING (OXID) ";
175 return $this->oxshops__oxdefcat->value;
185 return (
bool) $this->oxshops__oxproductive->value;