0

I am new to Opencart and I have inherrited a client site from a previous designer. I dont know PHP but I am getting the following error on a product page with size or colour options (in Opencart):

Notice: Undefined variable: result in /home/mobility/public_html/vqmod/vqcache/vq2-catalog_controller_product_product.php on line 274Notice: Undefined variable: result in /home/mobility/public_html/vqmod/vqcache/vq2-catalog_controller_product_product.php on line 274.

The code referenced in the error above looks like this:

                        $option_value_data[] = array(
                            'product_option_value_id' => $option_value['product_option_value_id'],
                            'option_value_id'         => $option_value['option_value_id'],
                            'name'                    => $option_value['name'],
                            'image'                   => $this->model_tool_image->resize($option_value['image'], 50, 50),
                            'price'                   => $price,
                            'quantity'                => $result['quantity'],
                            'price_prefix'            => $option_value['price_prefix']
                        );
                    }
                }
  • what is your actual question??? – Steve Dec 09 '13 at 13:57
  • Well apparently your `$result` variable does not exist in that scope. – Henk Jansen Dec 09 '13 at 14:01
  • 2
    His result variable is undefined, he wants to know why. Did you ever declare result? Did you try print_r($result) and look at the output? For me it looks like its not visible in the scope. This is btw. not a opencart problem, its more a problem of basic php. – Realitätsverlust Dec 09 '13 at 14:02
  • You might want to look at the [big Stack Overflow PHP error reference question](http://stackoverflow.com/q/12769982/1883647), specifically at the answer dealing with [`Notice: Undefined variable`](http://stackoverflow.com/a/12778634/1883647). – ajp15243 Dec 09 '13 at 14:25
  • Guys, just loosing time. He explained he *does not know PHP* and that he is *new to OpenCart* - that means, he is just the user, not the developer. Therefore I doubt he will be able to find and fix the problem, moreover when it is within the `vQmod` XML extension file... The only possibility is to find out which vQmod extension is causing the error to occur, then to contact it's developer for support and bugfixing. – shadyyx Dec 09 '13 at 14:35
  • Yes sorry my question would be how do I solve the error. The following code is on line 314: `$results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);` does this define '$result'? – darthmonkey74 Dec 09 '13 at 14:38
  • Did you install some special template? It seems that they change the variable names in templates between each version a lot. If you have some fancy template installed then probably the template version and your opencart version doe not match. – Veda Dec 09 '13 at 14:55
  • It uses a 'thing for cuties theme'. – darthmonkey74 Dec 11 '13 at 09:58

1 Answers1

0

The error caused by vQmod file. Disable the vQmod file by rename it to vqmod_file.xml_. Source: http://www.opencartnews.com/tutorials/common-opencart-errors-and-how-to-solve-them/

Veda
  • 2,025
  • 1
  • 18
  • 34
  • Thanks Veda. great advice. I think someone has also hacked the template files as well ass use VQmod so I will have bit of work ahead of me getting to the bottom of it. – darthmonkey74 Dec 10 '13 at 16:20