需要弄清楚错误的来源

时间:2015-05-26 18:02:26

标签: php content-management-system e-commerce opencart

所以这是我的网站,我正在尝试使用opencart构建。现在,我需要用户的功能来检查pincode的可用区域。因为只有授权的密码才会有COD而休息不会。就如此容易。我刚刚发现了一个插件。

我添加了文件并且后端正在运行,但是,我的前端现在卡住并发出此错误:

Fatal error: Call to undefined method ModelCatalogProduct::getProductCart() in /home1/thewebsi/public_html/opencarttemp/catalog/controller/module/related.php on line 24

现在,我对opencart真的很陌生,所以我无法理解我哪里出错了。 顺便提一下,这是related.php文件。

<?php
class ControllerModuleRelated extends Controller {
    protected function index($setting) {
        $this->language->load('module/related');

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

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

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

        $this->load->model('tool/image');

        $limit = $setting['limit'];

        if (isset($this->request->get['product_id'])) {
            $product_id = (int)$this->request->get['product_id'];
        } else {
            $product_id = 0;
        }

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

            $results = $this->model_catalog_product->getProductCart($product_id);
            $i = 0;
            foreach ($results as $result) {
                if ($result['image']) {
                $image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
                } else {
                    $image = false;
                }

                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }

                if ((float)$result['special']) {
                    $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $special = false;
                }

                if ($this->config->get('config_review_status')) {
                    $rating = (int)$result['rating'];
                } else {
                    $rating = false;
                }

                $this->data['products'][] = array(
                    'product_id' => $result['product_id'],
                    'thumb'      => $image,
                    'name'       => $result['name'],
                    'price'      => $price,
                    'special'    => $special,
                    'rating'     => $rating,
                    'reviews'    => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
                    'href'       => $this->url->link('product/product', 'product_id=' . $result['product_id']),
                );
                    if (++$i == $limit) break;

            }   

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

        $this->render();
    }
}
?>

如果有人只能指导我如何调试它,我可以做到。在我忘记之前,这里是插件链接:http://www.opencart.com/index.php?route=extension/extension/info&extension_id=15386&filter_search=pincode

更新:错误现已更改为以下内容,未进行更改和更改:

Fatal error: Class 'Controllermodulerelated' not found in /home1/thewebsi/public_html/opencarttemp/vqmod/vqcache/vq2-system_engine_controller.php on line 41

更新2:以下是ModelCatalogProduct类中的getProductCart函数。

<?php
class ModelCatalogProduct extends Model {
//Code
public function getProductCart($product_id) {
        $product_data = array();

        $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_related pr LEFT JOIN " . DB_PREFIX . "product p ON (pr.related_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");

        foreach ($query->rows as $result) { 
            $product_data[$result['related_id']] = $this->getProduct($result['related_id']);
        }

        return $product_data;
    }
//Code
?>

0 个答案:

没有答案