Jump to content

Blank screen on General tab and customer information prestashop 1.6.0.9


kax

Recommended Posts

 

prestashop max v1.5.3

open file: config/config.inc.php

find this line: @ini_set('display_errors', 'off');

change to look like this: @ini_set('display_errors', 'on');

prestashop above v1.5.3

open: config/defines.inc.php

find this line: define('_PS_MODE_DEV_', false);

change to look like this: define('_PS_MODE_DEV_', true);

source: http://cart-help.com/topic/60-error-reporting-prestashop-16-15-14-13/

Link to comment
Share on other sites

blank page = errors

please turn on error reporting and paste error report here.

Here's the error: Notice: Undefined property: IndexController::$express_start_time in /home2/kaxus/public_html/override/classes/controller/FrontController.php on line 185

 

I've also checked that add new products or edit products "save / save and stay" buttons are not working so I can't even upload new products and edit the current ones. Front office working perfectly fine though :D  :D 

Link to comment
Share on other sites

blank page = errors

please turn on error reporting and paste error report here.

<?php

class FrontController extends FrontControllerCore
{
    protected function smartyOutputContent($content) {
            // var_dump($this->express_hooks);
            //if the module is disabled, do not process the override
            if(!Module::isInstalled('expresscache') || !Module::isEnabled('expresscache')) {
                parent::smartyOutputContent($content);
                return;
            }


            //Updating this module to work with 1.6.x - June 5, 2014 - Vikas
            if (version_compare(_PS_VERSION_, '1.6.0', '>=')) {
                //Copying over the new smartyOutputContent Function. 
                
                if (is_array($content))
                    foreach ($content as $tpl)
                        $html = $this->context->smarty->fetch($tpl);
                else
                    $html = $this->context->smarty->fetch($content);

                $html = trim($html);

                if ($this->controller_type == 'front' && !empty($html) && $this->getLayout())
                {
                    $dom_available = extension_loaded('dom') ? true : false;
                    if ($dom_available)
                        $html = Media::deferInlineScripts($html);
                    $html = trim(str_replace(array('</body>', '</html>'), '', $html))."\n";
                    $this->context->smarty->assign(array(
                        'js_def' => Media::getJsDef(),
                        'js_files' => array_unique($this->js_files),
                        'js_inline' => $dom_available ? Media::getInlineScript() : array()
                    ));
                    $javascript = $this->context->smarty->fetch(_PS_ALL_THEMES_DIR_.'javascript.tpl');
                    $html = $html.$javascript."\t</body>\n</html>";
                }
                
                $template = $html;
            } else {
                $template = $this->context->smarty->fetch($content,  null, null, null);
            }

            


            $isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
            $isLogged = isset($this->context->customer) ? $this->context->customer->isLogged() && Configuration::get('EXPRESSCACHE_LOGGEDIN_SKIP') : false;
            $isMobile = $this->context->getMobileDevice();
            //when to save the cache

            //normalise URL START
            $proto = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://';
            //TODO: Store in a configuration var. 

            $ignore_params = array('refresh_cache', 'no_cache');
            //$parts = parse_url();
            list($urlpart, $qspart) = array_pad(explode('?', $_SERVER['REQUEST_URI']), 2, '');
            parse_str($qspart, $query);                                        
            foreach ($ignore_params as $i_param) {
                // $url = str_replace('&'.$i_param, '', $proto.$_SERVER['REQUEST_URI']);
                // $url = str_replace('?'.$i_param, '?', $url);
                unset($query[$i_param]);
            }
            $queryString = http_build_query($query);
            if($queryString == '') {
                $url = $proto.$_SERVER['HTTP_HOST'].$urlpart;
            } else {
                $url = $proto.$_SERVER['HTTP_HOST'].$urlpart . '?' . $queryString;
            }

            //normalise URL END
            $cache_processed = false;
            if(!isset($_GET['no_cache']) && !$isAjax && !$isLogged && !$isMobile) {
                $page_name = Dispatcher::getInstance()->getController();
                $c_controllers = explode(',', Configuration::get('EXPRESSCACHE_CONTROLLERS'));
                if(in_array($page_name, $c_controllers) && !isset($_GET['live_edit']) && !isset($_GET['live_configurator_token'])) {

                    

                    $page_id = md5($url);
                    //$page_id = hexdec(substr($page_id ,0, 15));
                    $page_url = $url;
                    $id_langauge = (int)$this->context->language->id;
                    $id_currency = (int)$this->context->currency->id;
                    $id_country = (int)$this->context->country->id;
                    $id_shop = (int)$this->context->shop->id;
                    $entity_type = $page_name;
                    //TODO Add more.

                    $id_entity = Tools::getValue('id_product') ? Tools::getValue('id_product') : (Tools::getValue('id_category') ?  Tools::getValue('id_category') : (Tools::getValue('id_manufacturer') ? Tools::getValue('id_manufacturer') : 0));
                    if(!$id_entity) { $id_entity = 0 ;}    
                    //check if we should delete the cache for this page or save it
                    if(count($_POST) > 0) {
                        Db::getInstance(_PS_USE_SQL_SLAVE_)->execute("
                            UPDATE "._DB_PREFIX_."express_cache set cache='NULL'
                            WHERE page_id = '".$page_id."' and id_language = ".$id_langauge." and id_currency = ".$id_currency." and id_country = ".$id_country." and id_shop = ".$id_shop);
                    } else {

                

                        if(1 || !Configuration::get('EXPRESSCACHE_STORE_IN_DB')) {

                            


                            //if total cache size exceeds the configured size then delete the first cache
                            if(Configuration::get('EXPRESSCACHE_STORAGE_LIMIT') > 0 ) {

                                $cache_db = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow("
                                                SELECT sum(cache_size) as cache_size
                                                FROM "._DB_PREFIX_."express_cache");
                                if($cache_db['cache_size'] == NULL) {
                                    $cache_db['cache_size'] = 0;
                                }
                                $cache_size = $cache_db['cache_size'];

                                if($cache_size > 0) {
                                    
                                    $cache_size = round($cache_db['cache_size'] / (1024*1024), 2) ;
                                    // delete the cache and file.
                                    if($cache_size > Configuration::get('EXPRESSCACHE_STORAGE_LIMIT')) {
                                        $last_cache = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow("SELECT page_id, last_updated, cache FROM 
                                                "._DB_PREFIX_."express_cache WHERE cache != 'NULL' ORDER BY last_updated");
                                        
                                        //var_dump($last_cache);
                                        //echo Db::getInstance()->getMsgError();
                                        $del_page_id = $last_cache['page_id'];
                                        $del_last_updated = $last_cache['last_updated'];
                                        $file_to_delete = $last_cache['cache'];
                                        Db::getInstance(_PS_USE_SQL_SLAVE_)->execute("UPDATE "._DB_PREFIX_."express_cache
                                                set cache='NULL', cache_size = 0 
                                                where page_id = '$del_page_id' and last_updated = '$del_last_updated'");
                                        $cache_dir  = _PS_MODULE_DIR_.'expresscache/cache/';  
                                        $dir_name = substr($file_to_delete,0, 2);
                                        $dir_name = substr($dir_name,0,1).'/'.substr($dir_name,1,2).'/';
                                        //echo $dir_name.$file_to_delete;
                                        unlink($cache_dir.$dir_name.$file_to_delete);
                                        
                                    }
                                }
                            }


                            $cache = $template;
                            
                            
                            $filename = $page_id.$id_currency.$id_langauge.$id_country.$id_shop;
                            //store in filesystem with filename      
                            $cache_dir  = _PS_MODULE_DIR_.'expresscache/cache/';  
                            $dir_name = substr($filename,0, 2);
                            $dir_name = substr($dir_name,0,1).'/'.substr($dir_name,1,2).'/';
                            //echo $cache_dir.$dir_name;
                            if(!file_exists($cache_dir.$dir_name)){
                                mkdir($cache_dir.$dir_name, 0777, true);
                            }

                            if(Configuration::get('EXPRESSCACHE_GZIP')) {
                                $cache = gzdeflate($cache);
                            }

                            $cache_size = strlen($cache);

                            file_put_contents($cache_dir.$dir_name.$filename, $cache, LOCK_EX);
                            $cache = $filename;
                        } else {
                            //echo $template;
                            $cache_size = strlen($cache);
                            $cache = addslashes($template);
                        }

                        //echo "Caching..";
                        //echo $id_currency;
                        //$replace_insert = "INSERT";
                        //if(isset($_GET['refresh_cache'])) {
                        //   $replace_insert = "REPLACE";
                        //}

                        //miss is 1 be default
                        //((old time  * old hit count) + new time)/new count
                        //$new_time = 1.5;
                        $now = microtime(true);
                        $cache_time = round($now-($this->express_start_time), 3);
                        $cache_processed = true;
                        Db::getInstance()->execute(
                                        "INSERT INTO "._DB_PREFIX_."express_cache 
                                            (page_id, page_url, id_currency, id_language, id_country, id_shop, 
                                                cache, cache_size, hits, miss, hit_time,
                                                 miss_time, entity_type, id_entity, last_updated)
                                            VALUES ('$page_id', '$page_url', $id_currency, 
                                             $id_langauge, $id_country, $id_shop,'$cache', $cache_size,
                                             0, 1, 0, $cache_time, '$entity_type', $id_entity,
                                             '".date('Y-m-d H:i:s')."')
                                             ON DUPLICATE KEY UPDATE miss = miss + 1,
                                                         last_updated ='".date('Y-m-d H:i:s')."',
                                                         cache = '$cache', cache_size = $cache_size,
                                                         miss_time = ((miss_time*miss) + $cache_time) / (miss + 1)
                                            ");
                        


                        //echo Db::getInstance()->getMsgError();
                    }
                }
            }

            
            $html = $template;
            $content = $html;
            
            $expresscache_cookie = new Cookie('expresscache', '/');

            if(Configuration::get('ADVCACHEMGMT') && ($expresscache_cookie->advcachemgmt ||  Configuration::get('ADVCACHEMGMT') == 2) && !Tools::getValue('live_edit', 0)) {
                if(!isset($cache_time)) {
                    $now = microtime(true);
                    $cache_time = round($now-($this->express_start_time), 3);
                }
                $height = '30px';
                $background_color = 'black';
                if (version_compare(_PS_VERSION_, '1.6.0', '>=')) {
                    $height = '45px';
                    $background_color = 'rgb(52, 52, 52)';
                }
                $content .= '<div style=" background-color:000; background-color: rgba(0,0,0, 0.7); border-bottom: 1px solid #000; width:100%;height:'.$height.'; padding:5px 10px; position:fixed;top:0;left:0;z-index:9999;">';
                $content .= '<span style="color:red; float:left; padding: 8px; background-color: '.$background_color.'">Non-Cached Page</span>';
                $content .= '<span style="color:white; float:left; padding: 8px; background-color: '.$background_color.'; margin-left:10px">Load Time: '.$cache_time.' s</span>';
                if($cache_processed)  {
                    $content .= '<input onclick="window.location.href=\''.$url.'\'" type="submit" value="View Cached Page" name="no_cache" id="viewLivePage" class="exclusive" style="color:black;float:right; text-shadow: 0 -1px 0 #157402; margin-right:10px;">';
                } else {
                    $content .= '<span style="color:white;float:right; padding: 8px; background-color: '.$background_color.'; margin-right:10px;">This page was not processed for caching</span>';
                }
                
                $content .= '</div>';    
                //$content .= '</form></div>';    
            }

            $this->context->cookie->write();

            echo $content;
            //parent::smartyOutputContent($content);

        }
}
?>

Here's the code ^^^^^^^^^^^^^^^^^^

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...