
Originally Posted by
TPHoare
Actually I've sorted this. It's obviously to do with the addition of a null VAT field to the address table. Simply going into the Customer screen of any previous non-VAT customer and then leaving the screen by pressing 'update' solves the problem. Since we have very few non-VAT customers this is not a problem.
Thank you thank you thank you :) You helped me solving another problem I wrote about here: If a customer uses Paypal Express to send us their address, they are not charged the VAT even if they should be charged - in contrast to users that create an account on the shop first and then go to Paypal.
The problem seems to be that the default value for the VAT field should be '', but not NULL.
Maybe changing this in the VAT-mod_English.sql file, e.g.
Code:
ALTER TABLE address_book ADD entry_tva_intracom VARCHAR(32) DEFAULT '' AFTER entry_company;
or changing this later manually, with
Code:
ALTER TABLE `address_book` CHANGE `entry_tva_intracom` `entry_tva_intracom` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_german2_ci NULL default ''
solves the problem. Well, it did it for me - but I hope this doesn't produce any unexpected side-effects...
If you change the VAT-mod_English.sql file and apply it then to an old address table (which does not contain the VAT field), I assume that the fields are converted correctly, so you don't need to go to the admin area and iterate over the customer entries.
I'm not a professional php programmer, and I don't really know the ZEN system, but from the code in the checkout_new_address.php in the includes/modules folder of the VAT patch, I understand that the default value that is saved to the VAT-field in the database if the user does not enter a VAT on the account creation page is indeed '', not null.
But I haven't tested this extensively, it just seems to work e.g. if I let a french customer who is not a company buy in a German shop. Maybe someone who is more familiar with this could verify that my solution is clean...
Bernhard
Bookmarks