lat9 / vat4eu

VAT Processing for European Countries for Zen Cart 1.5.8a and 2.0.x
Other
1 stars 2 forks source link

Empty VAT ID for normal customers in checkout and email confirmation #22

Closed webchills closed 8 months ago

webchills commented 2 years ago

ZC157d PHP 8

Login with a "normal" customer without VAT ID Every customer without VAT ID gets an empty VAT number indicated (marked with * if unvalidated indicator is set in admin) during checkout in the billing address:

VAT Number:

Even if the customer has not even a compay field filled out in his address book This VAT Number: makes his way in the confirmation email as well This is a useless information and confusing for nomal customers without VAT ID VAT ID should only be shown during checkout and in emails if it exists and is validated

webchills commented 2 years ago

Found the reason in includes/classes/observers/auto.vat_for_eu_countries.php: if ($this->vatNumber !== '' does not recognize NULL in the entry_vat_number field, so all customers with entry_vat_number_field NULL in table address_book get this message and as well VAT ID: shown during checkout and in emails. if ($this->vatNumber !== '' has to be replaced with if (!empty ($this->vatNumber))

line 106: if ((!empty($this->vatNumber) && $this->vatNumberStatus !== VatValidation::VAT_ADMIN_OVERRIDE && $this->vatNumberStatus !== VatValidation::VAT_VIES_OK)) {

line 155: if (!empty ($this->vatNumber)) {

line 491: if (!empty($this->vatNumber) || $current_page_base === FILENAME_ADDRESS_BOOK || $current_page_base === FILENAME_CHECKOUT_PAYMENT_ADDRESS) {

lat9 commented 8 months ago

Although the result is different, this issue has the same root-cause as #21; closing as duplicate.