So, dann will ich mal meine Tradition fortsetzen, einen [B]Wartungsmodus [/B]für den Shop zu erlauben…
Folgend ist eine modifizierte Datei “[B]views/oxcmp_shop.php[/B]”, die jetzt einen Wartungsmodus zu lässt…
(Da diese Klasse nur diese eine Routine hat, habe ich die komplett geändert. Man könnte/sollte das auch als Modul konzipieren…)
Die Idee ist, dass man den [B]Wartungsmodus [/B]dadurch anstößt, dass man in den Admin-Einstellungen den Shop [B]inaktiv [/B]setzt ("[B]Aktiv[/B]" in den Grundeinstellungen abwählen).
Um nun als Admin dennoch den Shop starten zu können, [B]muss [/B]man das Shop-Frontend mit den [B]Parametern [/B]"?[B]user[/B]=admin_user_name&[B]pass[/B]=admin_password" aufrufen. (Gültige Admin Login-Daten.)
Die geänderte Routine prüft diese Daten auf Gültigkeit, und startet dann den Shop (obwohl er eigentlich inaktiv ist) wenn diese OK sind.
Das erfolgreiche Login wird auch in der SESSION gespeichert, so dass bei Folgeaktionen die Information über das erfolgreiche Login auch ohne diese Parameter erhalten bleibt.
Gleichzeitig wurde auch das Verhalten geändert, wenn der Shop [B]wirklich inaktiv [/B]ist, und kein Admin sich wie zuvor beschrieben einloggt.
OXID generiert in diesem Fall normalerweise eine (ziemlich nichtssagende) “Exception”, jetzt wird der Shop auf die Datei “[B]offline.htm[/B]l” umgeleitet…
Diese Seite kann man dann schön gestalten, so dass man dem Besucher eine sinnvolle und professionelle Meldung über den (für ihn) inaktiven Shop gibt.
<?php
/**
* This file is part of OXID eShop Community Edition.
*
* OXID eShop Community Edition is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OXID eShop Community Edition is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OXID eShop Community Edition. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://www.oxid-esales.com
* @package views
* @copyright (C) OXID eSales AG 2003-2009
* @version OXID eShop CE
* $Id: oxcmp_shop.php 16306 2009-02-05 10:28:05Z rimvydas.paskevicius $
*/
/**
* Translarent shop manager (executed automatically), sets
* registration information and current shop object.
* @subpackage oxcmp
*/
class oxcmp_shop extends oxView
{
/**
* Marking object as component
* @var bool
*/
protected $_blIsComponent = true;
/**
* Executes parent::render() and returns active shop object.
*
* @return object $this->oActShop active shop object
*/
public function render()
{
parent::render();
$myConfig = $this->getConfig();
$sShopLogo = $myConfig->getConfigParam( 'sShopLogo' );
if ( $sShopLogo && file_exists( $myConfig->getAbsImageDir().'/'.$sShopLogo ) ) {
$this->_oParent->setShopLogo($sShopLogo);
// Passing to view. Left for compatibility reasons for a while. Will be removed in future
$this->_oParent->addTplParam( 'shoplogo', $this->_oParent->getShopLogo() );
}
// is shop active?
$oShop = $myConfig->getActiveShop();
if ( !$oShop->oxshops__oxactive->value && 'oxstart' != $myConfig->getActiveView()->getClassName() && !$this->isAdmin() )
{
//Avenger
$logged_in=false;
$sUser=$_GET['user'];
$sPassword=$_GET['pass'];
if ($sUser && $sPassword)
{
$_GET['lgn_usr']=$sUser ;
$_GET['lgn_pwd']=$sPassword;
$oUser=oxnew('oxcmp_user');
$logged_in=$oUser->login($sUser, $sPassword);
$_SESSION['logged_in']=$logged_in;
}
else
{
$logged_in=$_SESSION['logged_in'];
}
if (!$logged_in)
{
oxUtils::getInstance()->redirect( 'offline.html',false,302);
/*
$oEx = oxNew( 'oxShopException' );
$oEx->setMessage( 'EXCEPTION_SHOP_NOTACTIVE' );
throw $oEx;
*/
}
//Avenger
}
return $oShop;
}
}
?>
[B]Edit:[/B]
Wenn das kein Zufall ist: das ist mein 1.000 Post hier im Forum.
Ist also quasi mein Jubiläums-Geschenk…