Prestashop [Eğitim] Prestashop Bakım Modunu Cookie Kontrolü Ile Yapmak
son günlerde bazı kullanıcılar cloud bazlı sunucularda bakım modunun çalışmadığını çok defa söylediler,
yada sabit ip kullanan şirketlerde ip eklendiği zaman şirketteki herkes siteyi görebiliyor bu gibi durumlarda ip kontrolü yerine site url sine bir defaya mahsus eklenecek bir paremetre ile bilgisayarda bir cookie oluşturmak ve oluşturulan cookie ‘ye göre bakım modunu aktif pasif etmek için
classes/controller/FrontController.php
dosyasını açın ve
function displayMaintenancePage()
fonsiyonu aşağıdaki ile değiştirin.
http:/siteadresi.com/?deneme=1
şeklinde bir kere siteye girmeniz yeterlidir artık o bilgisayar bakım sayfasını görmeyecektir.
aşağıdaki fonksiyonun 3. satırındaki deneme yerine istediğiniz kelimeyi yazabilirsiniz.
protected function displayMaintenancePage() { if (Tools::getValue('deneme')){ $this->context->cookie->aktif =1; } if ($this->maintenance == true || !(int)Configuration::get('PS_SHOP_ENABLE')) { $this->maintenance = true; if ( $this->context->cookie->aktif != 1) { header('HTTP/1.1 503 temporarily overloaded'); $this->context->smarty->assign($this->initLogoAndFavicon()); $this->context->smarty->assign(array( 'HOOK_MAINTENANCE' => Hook::exec('displayMaintenance', array()), )); // If the controller is a module, then getTemplatePath will try to find the template in the modules, so we need to instanciate a real frontcontroller $front_controller = preg_match('/ModuleFrontController$/', get_class($this)) ? new FrontController() : $this; $this->smartyOutputContent($front_controller->getTemplatePath($this->getThemeDir().'maintenance.tpl')); exit; } } }