0

我是 OpenCart eshop 的初学者。我正在为产品描述创建一个自定义页面。我已经在我的本地机器上从头开始为自定义页面创建了控制器、模型和视图文件。它的工作完美。模型、控制器和视图名称是Custreview 我在迁移到实时服务器后面临这个错误:

Warning: require() [function.require]: Filename cannot be empty in /home/demoosiz/public_html/cart/OpenCart/vqmod/vqcache/vq2-system_engine_controller.php on line 68
Warning: require() [function.require]: Filename cannot be empty in /home/demoosiz/public_html/cart/OpenCart/vqmod/vqcache/vq2-system_engine_controller.php on line 68 
Warning: require() [function.require]: Filename cannot be empty in /home/demoosiz/public_html/cart/OpenCart/vqmod/vqcache/vq2-system_engine_controller.php on line 68
Fatal error: require() [function.require]: Failed opening required '' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/demoosiz/public_html/cart/OpenCart/vqmod/vqcache/vq2-system_engine_controller.php on line 68

这是我的控制器文件...

<?php
class ControllerInformationCustReview extends Controller {
    private $error = array();

    public function index() {
        /*if (!$this->customer->isLogged()) {
            $this->session->data['redirect'] = $this->url->link('account/custreview', '', 'SSL');

            $this->redirect($this->url->link('account/login', '', 'SSL'));
        } */

        $this->language->load('information/custreview');

        $this->document->setTitle($this->config->get('config_name') . ' - ' . $this->language->get('heading_title'));

        $this->load->model('account/custreview');

        $this->getForm();
    } 

    public function insert() {
        $this->load->language('information/custreview');

        $this->document->setTitle($this->config->get('config_name') . ' - ' . $this->language->get('heading_title'));

        $this->load->model('account/custreview');

        if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validateForm()) {
            $this->model_account_custreview->addReview($this->request->post);

            $this->session->data['success'] = $this->language->get('text_success');

            $this->redirect($this->url->link('information/custreview'));
        }

        $this->getForm();
    }

    private function getForm() {
        $this->data['heading_title'] = $this->language->get('heading_title');
        $this->data['entry_prefix'] = $this->language->get('entry_prefix');
        $this->data['entry_desc'] = $this->language->get('entry_desc');
        $this->data['entry_industry'] = $this->language->get('entry_industry');
        $this->data['entry_design'] = $this->language->get('entry_design');
        $this->data['entry_prefix1'] = $this->language->get('entry_prefix1');
        $this->data['entry_other'] = $this->language->get('entry_other');
        $this->data['entry_prefix2'] = $this->language->get('entry_prefix2');
        $this->data['entry_prefix3'] = $this->language->get('entry_prefix3');
        $this->data['entry_prefix4'] = $this->language->get('entry_prefix4');

        $this->data['logged'] = $this->customer->getFirstname() . ' ' . $this->customer->getLastName();

        $this->data['text_none'] = $this->language->get('text_none');
        $this->data['text_select'] = $this->language->get('text_select');

        $this->data['entry_product'] = $this->language->get('entry_product');
        $this->data['entry_author'] = $this->language->get('entry_author');
        $this->data['entry_rating'] = $this->language->get('entry_rating');
        $this->data['entry_review'] = $this->language->get('entry_review');
        $this->data['entry_good'] = $this->language->get('entry_good');
        $this->data['entry_bad'] = $this->language->get('entry_bad');

        $this->data['button_save'] = $this->language->get('continue_shop');
$this->data['button_checkout'] = $this->language->get('check_out');

        if (isset($this->error['warning'])) {
            $this->data['error_warning'] = $this->error['warning'];
        } else {
            $this->data['error_warning'] = '';
        }

        if (isset($this->session->data['success'])) {
            $this->data['success'] = $this->session->data['success'];

            unset($this->session->data['success']);
        } else {
            $this->data['success'] = '';
        }

        if (isset($this->error['product'])) {
            $this->data['error_product'] = $this->error['product'];
        } else {
            $this->data['error_product'] = '';
        }

        if (isset($this->error['product_id'])) {
            $this->data['error_product_id'] = $this->error['product_id'];
        } else {
            $this->data['error_product_id'] = '';
        }

        if (isset($this->error['author'])) {
            $this->data['error_author'] = $this->error['author'];
        } else {
            $this->data['error_author'] = '';
        }

        if (isset($this->error['text'])) {
            $this->data['error_text'] = $this->error['text'];
        } else {
            $this->data['error_text'] = '';
        }

        if (isset($this->error['rating'])) {
            $this->data['error_rating'] = $this->error['rating'];
        } else {
            $this->data['error_rating'] = '';
        }   
        if (isset($this->error['cdesc'])) {
            $this->data['error_desc'] = $this->error['cdesc'];
        } else {
            $this->data['error_desc'] = '';
        }
        if (isset($this->error['industry'])) {
            $this->data['error_industry'] = $this->error['industry'];
        } else {
            $this->data['error_industry'] = '';
        }
        if (isset($this->error['design'])) {
            $this->data['error_design'] = $this->error['design'];
        } else {
            $this->data['error_design'] = '';
        }
        if (isset($this->error['other'])) {
            $this->data['error_other'] = $this->error['other'];
        } else {
            $this->data['error_other'] = '';
        }
        if (isset($this->error['file'])) {
            $this->data['error_file'] = $this->error['file'];
        } else {
            $this->data['error_file'] = '';
        }

        $this->data['breadcrumbs'] = array();

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('text_home'),
            'href'      => $this->url->link('common/home', 'SSL'),
            'separator' => false
        );

        $this->data['breadcrumbs'][] = array(
            'text'      => $this->language->get('heading_title'),
            'href'      => $this->url->link('information/custreview','SSL'),
            'separator' => ' :: '
        );

        if (!isset($this->request->get['review_id'])) { 
            $this->data['action'] = $this->url->link('information/custreview/insert');
        }

        $this->data['cancel'] = $this->url->link('information/custreview','SSL');

        if (isset($this->request->get['review_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
            $review_info = $this->model_account_custreview->getReview($this->request->get['review_id']);
        }

        $this->load->model('catalog/category');

        $this->data['categories'] = $this->model_catalog_category->getCategories(0);

        $this->load->model('catalog/product');

        if (isset($this->request->post['product_id'])) {
            $this->data['product_id'] = $this->request->post['product_id'];

            $product_info = $this->model_catalog_product->getProduct($this->request->post['product_id']);

            if ($product_info) {
                $this->data['product'] = $product_info['name'];
            } else {
                $this->data['product'] = '';
            }
        } elseif (isset($review_info)) {
            $this->data['product_id'] = $review_info['product_id'];

            $product_info = $this->model_catalog_product->getProduct($review_info['product_id']);

            if ($product_info) {
                $this->data['product'] = $product_info['name'];
            } else {
                $this->data['product'] = '';
            }
        } else {
            $this->data['product_id'] = '';
        }

        if (isset($this->request->post['product_id'])) {
            $this->data['product_id'] = $this->request->post['product_id'];
        } elseif (isset($review_info)) {
            $this->data['product_id'] = $review_info['product_id'];
        } else {
            $this->data['product_id'] = '';
        }

        if (isset($this->request->post['product'])) {
            $this->data['product'] = $this->request->post['product'];
        } elseif (isset($review_info)) {
            $this->data['product'] = $review_info['product'];
        } else {
            $this->data['product'] = '';
        }

        if (isset($this->request->post['author'])) {
            $this->data['author'] = $this->request->post['author'];
        } elseif (isset($review_info)) {
            $this->data['author'] = $review_info['author'];
        } else {
            $this->data['author'] = '';
        }

        if (isset($this->request->post['text'])) {
            $this->data['text'] = $this->request->post['text'];
        } elseif (isset($review_info)) {
            $this->data['text'] = $review_info['text'];
        } else {
            $this->data['text'] = '';
        }

        if (isset($this->request->post['rating'])) {
            $this->data['rating'] = $this->request->post['rating'];
        } elseif (isset($review_info)) {
            $this->data['rating'] = $review_info['rating'];
        } else {
            $this->data['rating'] = '';
        }

        if (isset($this->request->post['cdesc'])) {
            $this->data['cdesc'] = $this->request->post['cdesc'];
        } elseif (isset($review_info)) {
            $this->data['cdesc'] = $review_info['cdesc'];
        } else {
            $this->data['cdesc'] = '';
        }
        if (isset($this->request->post['industry'])) {
            $this->data['industry'] = $this->request->post['industry'];
        } elseif (isset($review_info)) {
            $this->data['industry'] = $review_info['industry'];
        } else {
            $this->data['industry'] = '';
        }
        if (isset($this->request->post['design'])) {
            $this->data['design'] = $this->request->post['design'];
        } elseif (isset($review_info)) {
            $this->data['design'] = $review_info['design'];
        } else {
            $this->data['design'] = '';
        }
        if (isset($this->request->post['other'])) {
            $this->data['other'] = $this->request->post['other'];
        } elseif (isset($review_info)) {
            $this->data['other'] = $review_info['other'];
        } else {
            $this->data['other'] = '';
        }
        if (isset($this->request->post['file'])) {
            $this->data['file'] = $this->request->post['file'];
        } elseif (isset($review_info)) {
            $this->data['file'] = $review_info['file'];
        } else {
            $this->data['file'] = '';
        }

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/information/custreview.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/information/custreview.tpl';
        } else {
            $this->template = 'default/template/information/custreview.tpl';
        }

        $this->children = array(
            'common/column_left',
            'common/column_right',
            'common/content_top',
            'common/content_bottom',
            'common/footer',
            'common/header'     
        );


        $this->response->setOutput($this->render());
    }

    private function validateForm() {

        /*if (!$this->request->post['product_id']) {
            $this->error['product'] = $this->language->get('error_product');
        }

        if (!$this->request->post['product_id']) {
            $this->error['product_id'] = $this->language->get('error_product_id');
        }*/

        if ((strlen(utf8_decode($this->request->post['author'])) < 3) || (strlen(utf8_decode($this->request->post['author'])) > 64)) {
            $this->error['author'] = $this->language->get('error_author');
        }
/*
        if (strlen(utf8_decode($this->request->post['text'])) < 1) {
            $this->error['text'] = $this->language->get('error_text');
        }*/

        /*if (!isset($this->request->post['rating'])) {
            $this->error['rating'] = $this->language->get('error_rating');
        }*/
        if (!isset($this->request->post['file'])) {
            $this->error['file'] = $this->language->get('error_file');
        }
        if ((strlen(utf8_decode($this->request->post['cdesc'])) < 3) || (strlen(utf8_decode($this->request->post['cdesc'])) > 1000)) {
            $this->error['cdesc'] = $this->language->get('error_desc');
        }
        if ((strlen(utf8_decode($this->request->post['industry'])) < 3) || (strlen(utf8_decode($this->request->post['industry'])) > 1000)) {
            $this->error['industry'] = $this->language->get('error_industry');
        }
        if ((strlen(utf8_decode($this->request->post['design'])) < 3) || (strlen(utf8_decode($this->request->post['design'])) > 1000)) {
            $this->error['design'] = $this->language->get('error_design');
        }
        if ((strlen(utf8_decode($this->request->post['other'])) < 3) || (strlen(utf8_decode($this->request->post['other'])) > 1000)) {
            $this->error['other'] = $this->language->get('error_other');
        }

        if (!$this->error) {
            return true;
        } else {
            return false;
        }
    }   

    public function autocomplete() {
        $json = array();

        if (isset($this->request->post['filter_name'])) {
            $this->load->model('catalog/product');

            $data = array(
                'filter_name' => $this->request->post['filter_name'],
                'start'       => 0,
                'limit'       => 20
            );

            $results = $this->model_catalog_product->getProducts($data);

            foreach ($results as $result) {
                $json[] = array(
                    'product_id' => $result['product_id'],
                    'name'       => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'),   
                    'model'      => $result['model'],
                    'price'      => $result['price']                
                );  
            }
        }

        $this->load->library('json');

        $this->response->setOutput(Json::encode($json));
    }   
}
?>

这是我的 tpl 文件:

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
       <?php echo $entry_author; ?><br />
       <!-- <input type="text" name="author" value="<?php echo $logged; ?>" />-->
       <textarea name="author" cols="100" rows="1" name="cdesc"><?php echo $logged; ?></textarea>
    <?php if ($error_author) { ?>
              <span class="error"><?php echo $error_author; ?></span>
              <?php } ?>
     <p> <?php echo $entry_prefix; ?></p>
    <?php echo $entry_desc; ?><br/>
    <textarea name="cdesc" cols="100" rows="3"></textarea>
        <?php if ($error_desc) { ?>
              <span class="error"><?php echo $error_desc; ?></span>
              <?php } ?>
            <br/>  
    <?php echo $entry_industry; ?><br/>
    <textarea name="industry" cols="100" rows="1"></textarea>
    <?php if ($error_industry) { ?>
              <span class="error"><?php echo $error_industry; ?></span>
              <?php } ?>    
        <br/>     
    <?php echo $entry_design; ?><br/>
    <textarea name="design" cols="100" rows="4"></textarea>
    <?php if ($error_design) { ?>
              <span class="error"><?php echo $error_design; ?></span>
              <?php } ?>
     <p> <?php echo $entry_prefix1; ?></p>  
     <?php echo $entry_other; ?><br/>
    <textarea name="other" cols="100" rows="1"></textarea>
    <?php if ($error_other) { ?>
              <span class="error"><?php echo $error_other; ?></span>
              <?php } ?>
     <p><?php echo $entry_prefix2; ?></p>
    <input type="file" value="<?php echo $file; ?>" name="file">
    <?php if ($error_file) { ?>
              <span class="error"><?php echo $error_file; ?></span>
              <?php } ?>
    <p><?php echo $entry_prefix3; ?></p>
    <br/>
        <b><?php echo $entry_review; ?></b><br/>
            <textarea name="text"  rows="1"  cols="100"></textarea>
            <?php if ($error_text) { ?>
              <span class="error"><?php echo $error_text; ?></span>
              <?php } ?>
              <p><?php echo $entry_prefix4; ?></p>
    <table class="form">
       <tr>
      <div class="buttons"><a href="index.php" class="button" style="margin-left: 5px;"><span><?php echo $button_save; ?></span></a>
      <a onclick="$('#form').submit();" class="button"><span><?php echo $button_checkout; ?></span></a>
      </div>
      </tr>
      </table>
      </form>

我需要创建包含公司名称、组织名称、图片上传等的自定义表单。此外,它像产品一样移动到购物车页面。我刚刚修改到我的设计 UI。我得到了这个扩展并修改了它(参考 URL Opencart扩展名)。进一步我为我的设计 UI 定制了它。我也在使用 web 打印 opencart 中的在线设计工具。你能帮我解决这个错误吗?

4

2 回答 2

0

清除您的 vqmod 缓存文件夹,如果这没有帮助 - 检查您的system/engine/controller.php文件,此 vqmod 缓存文件中的错误

于 2013-03-30T10:59:22.310 回答
0

清除您的 vqmod 缓存可能会对您有所帮助。如果不尝试一一删除vqmod xml,可以找到问题文件。

http://kvcodes.com/2013/10/create-custom-admin-page-open-cart/

于 2013-12-01T15:02:37.407 回答