Compatibility with Magestore Onestepcheckout
To make EU VAT Enhanced compatible and fully working with Magestore Onestepcheckout, there are some actions to be done necessarily. Please follow these steps:
1. Change the field IDs of the VAT number inputs at checkout
Use app/design/frontend/base/default/template/onestepcheckout/onestepcheckout/billing.phtml and copy it to your design folder in the matching folder. Change the copied file and add an elseif-case within the field loop, on any position:
<?php elseif($helper->getFieldEnable($i)=='taxvat'): ?>
<label for="billing:vat_id"><?php echo $this->__('Tax/VAT number') ?></label><br/>
<input type="text" name="billing[vat_id]" id="billing:vat_id" value="" title="<?php echo $this->__('Tax/VAT number') ?>" class="input-text">
Do the same with the shipping address template app/design/frontend/base/default/template/onestepcheckout/onestepcheckout/shipping.phtml - the code should look like this:
<?php elseif($helper->getFieldEnable($i)=='taxvat'): ?>
<label for="shipping:vat_id"><?php echo $this->__('Tax/VAT number') ?></label><br/>
<input type="text" name="shipping[vat_id]" id="shipping:vat_id" value="" title="<?php echo $this->__('Tax/VAT number') ?>" class="input-text">
2. Edit the file app/code/local/Magestore/Onestepcheckout/controllers/IndexController.php and add the VAT-ID to the quote. Search for "customize for load country ma khong dien day du thong tin" and below the regular code, add this code:
if(isset($shipping_address_data['vat_id'])) {
$billingVatId = $shipping_address_data['vat_id'];
}
The next code is where the field data is set to the quote address. Add the VAT-ID so that the code looks like this:
$this->getOnepage()->getQuote()->getShippingAddress()
->setCountryId($billingCountryId)
->setRegionId($billingRegionId)
->setPostcode($billingZipcode)
->setRegion($billingRegion)
->setCity($billingCity)
->setVatId($billingVatId)
->setCollectShippingRates(true);