Page 1 of 3
Undefined index: country_id in tax.php
Posted: Sat Oct 22, 2011 11:19 am
by Hat
Just popped up with random errors after working just fine and I didnt touch anything.
2011-10-22 3:15:27 - PHP Notice: Undefined index: country_id in /home/rhoppern/public_html/store/system/library/tax.php on line 17
2011-10-22 3:15:27 - PHP Notice: Undefined index: zone_id in /home/rhoppern/public_html/store/system/library/tax.php on line 17
2011-10-22 3:15:27 - PHP Notice: Undefined index: country_id in /home/rhoppern/public_html/store/system/library/tax.php on line 31
2011-10-22 3:15:27 - PHP Notice: Undefined index: zone_id in /home/rhoppern/public_html/store/system/library/tax.php on line 31
help!
Re: tax.php is killing me!!
Posted: Sat Oct 22, 2011 10:24 pm
by Qphoria
I saw this once before. It happens when the address doesn't have a zone or country selected as part of the registration... or so I thought. Another person saw this and then made a new account so it went away.. but I'm not sure how it happens to begin with.
Re: tax.php is killing me!!
Posted: Wed Nov 09, 2011 11:37 am
by solarpenguin
I had the same issue. For me it was customers that upgraded from 1.5.1.2 to 1.5.1.3. Once the user deleted their old address and added a new one, the messages went away.
Perhaps there is a way to default the zone and/or country unless there is a non-null zone / country on the customer record?
Re: tax.php is killing me!!
Posted: Wed Nov 09, 2011 2:29 pm
by i2Paq
It has ALL to do with no address of a not complete address used by that customer. In most cases a account created form the Admin.
This is solved in the SVN, but that is an unfinished 1.5.2.
Re: tax.php is killing me!!
Posted: Wed Nov 09, 2011 3:05 pm
by Xsecrets
no the second poster is correct it has to do with upgrade. I just ran into this too. From what I can tell the upgrade script does not handle users that are not in the default group properly and their default addresses do not get set properly.
Re: Undefined index: country_id in tax.php
Posted: Wed Nov 09, 2011 8:42 pm
by Qphoria
Well, the upgrade script was designed more for table changes. I didn't spend time on data transplacement for relational tables in this case. But I guess with the new tax_rate_to_customer_group I need to put an entry in..
But I think if after upgrade you go to System->Localisation->Tax Class and update the data there, it will fix this issue.
Re: Undefined index: country_id in tax.php
Posted: Fri Nov 11, 2011 5:44 pm
by quepassa
Hi
I am also having this problem. I have looked at Tax classes and made the changes but still have the same problem. Not only am I getting the error but when someone checks out they cannot go past step 2 in the check out process. The minute they check their address and set it to default then there is no problem.
Has anyone got a solution to this.
Re: Undefined index: country_id in tax.php
Posted: Fri Nov 11, 2011 9:24 pm
by Xsecrets
Qphoria wrote:Well, the upgrade script was designed more for table changes. I didn't spend time on data transplacement for relational tables in this case. But I guess with the new tax_rate_to_customer_group I need to put an entry in..
But I think if after upgrade you go to System->Localisation->Tax Class and update the data there, it will fix this issue.
I think the problem is more bigger than that. I actually fixed in in the database. The address_id field in the customer table was just completely wrong for the users that were in groups. Luckily on this store there were only a few users so it was pretty easy to spot and fix.
Re: Undefined index: country_id in tax.php
Posted: Mon Nov 14, 2011 5:37 am
by jimaras
Code: Select all
Notice: Undefined index: country_id in /usr/www/users/hobbyfy/e-kreopoleio.com/system/library/tax.php on line 17Notice: Undefined index: zone_id in /usr/www/users/hobbyfy/e-kreopoleio.com/system/library/tax.php on line 17Notice: Undefined index: country_id in /usr/www/users/hobbyfy/e-kreopoleio.com/system/library/tax.php on line 31Notice: Undefined index: zone_id in /usr/www/users/hobbyfy/e-kreopoleio.com/system/library/tax.php on line 31
This happened when i delete a customer.
Customer had made an order.
Is any solution?
Re: Undefined index: country_id in tax.php
Posted: Sat Nov 19, 2011 9:48 pm
by maksfeltrin
The system/library Tax class assumes that if session has shipping_address_id and payment_address_id set, then querying their address records will give you a valid result.
If you delete a customer in the admin app, and you are logged as the same customer in the catalog app then those errors will happen when browsing the catalog app.
You just need to rewrite some rules in the Tax class constructor, making sure valid records are retrieved from the database.
Re: Undefined index: country_id in tax.php
Posted: Sun Nov 20, 2011 4:42 pm
by pramathesh
I have newly installed v 1.5.1.3 and I get this error.
I get this error specifically in Google Chrome.
It comes with Undefined index: zone_id in tax.php error on the same line. Also, it does not show at the start but it shows after the user tries to checkout. and the error is being displayed redundantly in the subsequent browsing in all the pages.
Re: Undefined index: country_id in tax.php
Posted: Sun Nov 20, 2011 5:42 pm
by i2Paq
pramathesh wrote:I have newly installed v 1.5.1.3 and I get this error.
I get this error specifically in Google Chrome.
It comes with Undefined index: zone_id in tax.php error on the same line. Also, it does not show at the start but it shows after the user tries to checkout. and the error is being displayed redundantly in the subsequent browsing in all the pages.
Did you actually read all the replies in this topic?
Re: Undefined index: country_id in tax.php
Posted: Mon Nov 21, 2011 1:17 am
by pramathesh
i2Paq wrote:pramathesh wrote:I have newly installed v 1.5.1.3 and I get this error.
I get this error specifically in Google Chrome.
It comes with Undefined index: zone_id in tax.php error on the same line. Also, it does not show at the start but it shows after the user tries to checkout. and the error is being displayed redundantly in the subsequent browsing in all the pages.
Did you actually read all the replies in this topic?
Sorry to say but I really could not get any perfect solution after reading the replies.
Re: Undefined index: country_id in tax.php
Posted: Tue Nov 29, 2011 8:13 pm
by Brett888
Hi all I was getting this also, hope this helps those with this problem:
2011-11-29 11:53:41 - PHP Notice: Undefined index: country_id in /home/yoursite/public_html/home/yoursite/public_html/system/library/tax.php on line 17
2011-11-29 11:53:41 - PHP Notice: Undefined index: zone_id in /home/yoursite/public_html/home/yoursite/public_html/system/library/tax.php on line 17
2011-11-29 11:53:41 - PHP Notice: Undefined index: country_id in /home/yoursite/public_html/home/yoursite/public_html/system/library/tax.php on line 31
2011-11-29 11:53:41 - PHP Notice: Undefined index: zone_id in /home/yoursite/public_html/home/yoursite/public_html/system/library/tax.php on line 31
I even did a reinstall and got the above on a refreshed version, the cause of the problem appears to be deletion of customer file account while logged on as customer (I did a test account with myself, and I believe others do this).
To get back to normal you have to input data back into your own Zones, Geo Zones, and Taxes. Then add new account on opencart website and put in same details of yourself, if other try new. This work for me, back to normal now.
Re: Undefined index: country_id in tax.php
Posted: Sun Dec 04, 2011 3:13 pm
by pramathesh
I get this when I Install EBS payment module.
Re: Undefined index: country_id in tax.php
Posted: Thu Dec 15, 2011 9:47 am
by Gilmore
I think I found the problem! When you login in to your account and if the user was made in the admin, then you won't have any Address information. So the cart won't have any clue as to what Country you are from with no Address information.
I have already slapped myself a couple of times

for not adding the Customer Address when manually entering one! So I Manually added an address to the user that was logged on when it threw this error and the error went away!
I think the simple solution would simply be to force even the Admin to enter the Full User info. Name, Address, City, Stat, Postal zone, Country, etc... and not just the simple form of Name, email, phone, pass, newsletter, etc... Make the Admin one just like the Register one does. All on one page with the Address. And of course add in the rest of the Admin features to it.
The Manual entry on the Admin doesn't force you to enter the address and since all of us seem to forget when Manually entering a Customer, we have to actually click the Address + under the General link.
Now really, isn't the Address part of the General information?
Cheers!
Gil
Re: Undefined index: country_id in tax.php
Posted: Thu Dec 15, 2011 12:15 pm
by straightlight
Now really, isn't the Address part of the General information?
<< Removed >>
Re: Undefined index: country_id in tax.php
Posted: Thu Dec 15, 2011 1:02 pm
by Gilmore
Nope! I tried your mod and it broke the whole cart! Still seems like mine is the easier fix for now!
Re: Undefined index: country_id in tax.php
Posted: Thu Dec 15, 2011 1:06 pm
by straightlight
It doesn't really explain the whole details when stating: 'broke the whole cart' while mine didn't had any problems after running this but since this is about contribution issues, I removed the above instructions.
Re: Undefined index: country_id in tax.php
Posted: Thu Dec 15, 2011 1:14 pm
by Gilmore
This is on a fresh install of OC v1.5.1.3 There is no contributions on here other than the Cart. When I say broke the cart, that is exactly what I meant! You try to access the cart and it displays a blank page after trying your solution. There was nothing more to say since there were no errors in the error log. If there had been I would have gladly posted them to help you find the problem with it. So if you could be more specific on the contribution you are speaking of, it would be helpful. I have not mentioned anything about adding contributions, so you have me at a loss.
In system/library/tax.php I located:
Code: Select all
$this->setShippingAddress($address_query->row['country_id'], $address_query->row['zone_id']);
and replaced it as you said with:
Code: Select all
$this->setShippingAddress((isset($address_query->row['country_id']) ? $address_query->row['country_id'] : 0), (isset($address_query->row['zone_id']) ? $address_query->row['zone_id'] : 0);
In 2 locations. Lines 17 & 23