首页 > 解决方案 > 网站字体更改错误

问题描述

在基于 Opencart 主题的网站上,您可以在主题控制面板中更改字体。但是,当我在“Ralewey”上有一个标准字体(它在主题目录中)时,我收到 Opencart 这样的错误并且不会更改字体。你能告诉我如何修复它并且仍然将字体更改为所需的字体吗?

这是服务器给我的错误。 错误:

Warning: include_once(/home/us392481/volkhovskiy.com/storage/vendor/scss.inc.php): failed to open stream: No such file or directory in /home/us392481/volkhovskiy.com/www/admin/model/plaza/sass.php on line 5Warning: include_once(): Failed opening '/home/us392481/volkhovskiy.com/storage/vendor/scss.inc.php' for inclusion (include_path='.:/usr/local/pear/php73') in /home/us392481/volkhovskiy.com/www/admin/model/plaza/sass.php on line 5
Fatal error: Uncaught Error: Class 'Scssc' not found in /home/us392481/volkhovskiy.com/www/admin/model/plaza/sass.php:67 Stack trace: #0 /home/us392481/volkhovskiy.com/storage/modification/system/engine/loader.php(248): ModelPlazaSass->compileData(Array) #1 /home/us392481/volkhovskiy.com/www/system/engine/proxy.php(47): Loader->{closure}(Array, Array) #2 /home/us392481/volkhovskiy.com/www/admin/controller/extension/module/ptcontrolpanel.php(17): Proxy->__call('compileData', Array) #3 /home/us392481/volkhovskiy.com/storage/modification/system/engine/action.php(79): ControllerExtensionModulePtcontrolpanel->index() #4 /home/us392481/volkhovskiy.com/www/admin/controller/startup/router.php(26): Action->execute(Object(Registry), Array) #5 /home/us392481/volkhovskiy.com/storage/modification/system/engine/action.php(79): ControllerStartupRouter->index() #6 /home/us392481/volkhovskiy.com/www/system/engine/router.php(67): Action->execute(Object(Registry)) #7 /home/us392481/volkhovskiy.com/www/system/engine/router.php(56): Router->e in /home/us392481/volkhovskiy.com/www/admin/model/plaza/sass.php on line 67

这是错误中提到的文件。 萨斯.php:

<?php
class ModelPlazaSass extends Model
{
    public function compileData($data) {
        include_once(DIR_STORAGE . 'vendor/scss.inc.php');
 
        $this->load->model('setting/store');
        $this->load->model('setting/setting');
 
        $stores[] = array(
            'store_id' => 0,
            'name'     => $this->config->get('config_name') . $this->language->get('text_default')
        );
 
        foreach ($this->model_setting_store->getStores() as $store) {
            $stores[] = array(
                'store_id' => $store['store_id'],
                'name'     => $store['name']
            );
        }
 
        foreach ($stores as $store) {
            // Detech Directory By Store
            $theme = $this->model_setting_setting->getSettingValue('config_theme', $store['store_id']);
            $theme_directory_code = "theme_" . $theme . '_directory';
            $directory = $this->model_setting_setting->getSettingValue($theme_directory_code, $store['store_id']);
 
            $file = DIR_CATALOG . 'view/theme/' . $directory . '/stylesheet/plaza/theme.css';
 
            // Body
            $body_font_family = $data['module_ptcontrolpanel_body_font_family_name'][$store['store_id']];
            $body_font_cate = $data['module_ptcontrolpanel_body_font_family_cate'][$store['store_id']];
            $body_font_link = $data['module_ptcontrolpanel_body_font_family_link'][$store['store_id']];
            $body_font_size = $data['module_ptcontrolpanel_body_font_size'][$store['store_id']];
            if(!$body_font_size) $body_font_size = "14px";
            $body_font_weight = $data['module_ptcontrolpanel_body_font_weight'][$store['store_id']];
            $body_font_color = $data['module_ptcontrolpanel_body_color'][$store['store_id']];
 
            // Heading
            $heading_font_family = $data['module_ptcontrolpanel_heading_font_family_name'][$store['store_id']];
            $heading_font_cate = $data['module_ptcontrolpanel_heading_font_family_cate'][$store['store_id']];
            $heading_font_link = $data['module_ptcontrolpanel_heading_font_family_link'][$store['store_id']];
            $heading_font_weight = $data['module_ptcontrolpanel_heading_font_weight'][$store['store_id']];
            $heading_font_color = $data['module_ptcontrolpanel_heading_color'][$store['store_id']];
 
            // Link
            $link_color = $data['module_ptcontrolpanel_link_color'][$store['store_id']];
            $link_hover_color = $data['module_ptcontrolpanel_link_hover_color'][$store['store_id']];
 
            // Button
            $button_color = $data['module_ptcontrolpanel_button_color'][$store['store_id']];
            $button_hover_color = $data['module_ptcontrolpanel_button_hover_color'][$store['store_id']];
            $button_bg_color = $data['module_ptcontrolpanel_button_bg_color'][$store['store_id']];
            $button_bg_hover_color = $data['module_ptcontrolpanel_button_bg_hover_color'][$store['store_id']];
 
            // Custom
            $custom_css = $data['module_ptcontrolpanel_custom_css'][$store['store_id']];
 
            $css_line = "@import url(". $body_font_link .");";
            $css_line .= "@import url(". $heading_font_link .");";
            $css_line .= "body { font-family: '". $body_font_family ."', ". $body_font_cate ."; font-size: ". $body_font_size ."; font-weight: ". $body_font_weight ."; color: #". $body_font_color ."; }";
            $css_line .= "h1, h2, h3, h4, h5, h6 { font-family: '". $heading_font_family ."', ". $heading_font_cate ."; font-weight: ". $heading_font_weight ."; color: #". $heading_font_color ."; }";
            $css_line .= "a { color: #". $link_color ."; } a:hover { color: #". $link_hover_color ."; }";
            $css_line .= "button,.btn,.btn-primary { color: #". $button_color ."; background-color: #". $button_bg_color ."; border-color: #". $button_bg_color .";background-image: none;} button:hover,.btn:hover,.btn-primary:hover,.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover,.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus, .open>.dropdown-toggle.btn-primary:hover { color: #". $button_hover_color ."; background-color: #". $button_bg_hover_color ."; border-color: #". $button_bg_hover_color ."; }";
            $css_line .= $custom_css;
 
            $scss = new Scssc();
            $scss->setImportPaths(DIR_CATALOG . 'view/theme/' . $directory . '/stylesheet/sass/');
            $scss->setFormatter('scss_formatter_compressed');
 
            $output = $scss->compile($css_line);
 
            $handle = fopen($file, 'w');
 
            flock($handle, LOCK_EX);
 
            fwrite($handle, $output);
 
            fflush($handle);
 
            flock($handle, LOCK_UN);
 
            fclose($handle);
        }
    }
}

如果您需要任何其他文件的代码,请编写它。

标签: phpsassopencart

解决方案


您可以简单地更正scss.inc.php的路径

尝试替换这个

include_once(DIR_STORAGE . 'vendor/scss.inc.php');

有了这个

include_once(DIR_STORAGE . 'vendor/scssphp/scssphp/scss.inc.php');

或者直接将文件scss.inc.php复制到/home/us392481/volkhovskiy.com/storage/vendor/


推荐阅读