To ensure compatibility and full functionality of EU VAT Enhanced with Magestore Onestepcheckout, certain steps must be executed. Follow the guide below:
1. Modify VAT Number Input Field IDs at Checkout
Firstly, navigate to app/design/frontend/base/default/template/onestepcheckout/onestepcheckout/billing.phtml
, copy it, and then paste it into the matching folder within your design folder. Modify the copied file by adding an elseif
case within the field loop. The snippet should look like this:
<?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">
Repeat this process for the shipping address template located at app/design/frontend/base/default/template/onestepcheckout/onestepcheckout/shipping.phtml
. The resulting code should mirror the example above.
2. Update the Onestepcheckout Controller
Now, head to 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 append the following code after the existing content:
if(isset($shipping_address_data['vat_id'])) {
$billingVatId = $shipping_address_data['vat_id'];
}
Lastly, update the segment where field data is set to the quote address. Add the VAT-ID as follows:
$this->getOnepage()->getQuote()->getShippingAddress() ->setCountryId($billingCountryId) ->setRegionId($billingRegionId) ->setPostcode($billingZipcode) ->setRegion($billingRegion) ->setCity($billingCity) ->setVatId($billingVatId) ->setCollectShippingRates(true);