Page 1 of 1

After changes using VQMOD getting php Notice undefined index

Posted: Mon Oct 14, 2013 9:13 pm
by sarunazs
Hello, can anyone tell me why do i get:

Code: Select all

Notice: Undefined index varname
in every single page of my opencart store to more then 10++ variables.

This happened then I added function using vqmod :

Code: Select all

<file name="system/library/cart.php">
<operation error="skip">
			<search position="before"><![CDATA[public function getSubTotal()]]></search>
			<add><![CDATA[  	public function getSubTotalNew() {
		$totals = array();
        $total = 0;
		$suppliersProducts = $this->getProducts(true);
        foreach($suppliersProducts as $supplierId => $products)
        {
            foreach($products as $product)
            {
                if(array_key_exists($supplierId, $totals))
                {
                    $total = $totals["sup_".$supplierId];
                }
                else
                {
                    $total = 0;
                }
                $total += $product['total'];

                $totals["sup_".$supplierId] = $total;
            }
        }

		return $totals;
  	}]]></add>
		</operation>
</file>
after that i'am getting Notice undefined index to almost every single variable which is not checked with isset()

i am using OpenCart 1.5.3.1 and latest vQmod 2.4.1

Please help. Thanks in advance.

Re: After changes using VQMOD getting php Notice undefined i

Posted: Sun Oct 20, 2013 4:07 am
by butte
It will be helpful to see the entire actual error (or error set, if more than one line per incident). Usually or often a casual summary of what an error set meant omits tiny snippets that show instead what threw the error.

You added a function. Was there any require (or require once) or include (or include once) that you omitted, such as may be above the "Find" snippet? Did you support it in the other cart.* files (they work together) by adding as necessary to their own routines?