Page 1 of 1
PHP Notice: Undefined variable explain
Posted: Fri Mar 31, 2017 10:16 pm
by htwp
Hi to all,
as i know when a notice like this ->? PHP Notice: Undefined variable happens in a .tpl file it means that is not defined(the variable) in controller file.... but what does it mean when this notice happens inside a controller file? the full notice is:
PHP Notice: Undefined variable: the_category_customer_groups in httpdocs/vqmod/vqcache/vq2-system_modification_admin_controller_catalog_category.php on line 684 the line is :
'category_customer_groups' => $the_category_customer_groups,
how to resolve it? my main purpose first is to understand what is the problem here and secondly to fix it.
If you have any idea i would be grateful to hear it.
thank you in advance.
Re: PHP Notice: Undefined variable explain
Posted: Sat Apr 01, 2017 1:22 am
by angela
$the_category_customer_groups is blank or null. Whatever variable is passing data to it, isn't returning anything.
So find the original reference to $the_category_customer_groups - are any of the surrounding variables like $the_category_customer_groups['something'] ? If so, it's missing its array.
Or is there something like:
Code: Select all
$the_category_customer_groups = $query['something']
anywhere?
If so, 'something' is passing null or blank, or $query doesn't exist.
Re: PHP Notice: Undefined variable explain
Posted: Sat Apr 01, 2017 3:31 am
by htwp
inside xml file there are only two $the_category_customer_groups
<operation>
<search position="before"><![CDATA[
$data['categories'][] = array(
]]></search>
<add><![CDATA[
if ($this->config->get('config_update_category_customer_groups_in_category_list') == 1){
$this->model_catalog_category->updateAllCategoriesToDefaultCustomerGroups();
}
$this->load->model('customer/customer_group');
$data['customer_groups'] = $this->model_customer_customer_group->getCustomerGroups();
$the_category_customer_groups = $this->model_catalog_category->getCategoryCustomerGroups($result['category_id']);
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
'category_id' => $result['category_id'],
]]></search>
<add><![CDATA[
'category_customer_groups' => $the_category_customer_groups,
]]></add>
</operation>
any idea? i am searching this many days now and i am at dead end with no any info in forum...so i appreciate your help
Re: PHP Notice: Undefined variable explain
Posted: Sat Apr 01, 2017 7:23 am
by angela
Focus on this:
Code: Select all
$this->model_catalog_category->getCategoryCustomerGroups($result['category_id']);
Is this plugin supposed to append code that contains the getCategoryCustomerGroups() function?
I don't have that in my model.
If you can't find the getCategoryCustomerGroups() function in either your plugin or category model file, this is your culprit. It isn't being appended to where it needs to be in order for the vQmod to work.
Re: PHP Notice: Undefined variable explain
Posted: Sat Apr 01, 2017 2:27 pm
by htwp
You helped me very much... i will look at this
thank you !!!