Known Conflicts of EuVAT and required Changes with other Magento Extensions
Due to the structure of Magento routing URL's to Models and Controllers, EuVAT may get into conflict with other Magento Extensions from 3rd party providers when 2 or more Extensions try to rewrite Core Models or Routes to its own Models or Controllers.
EuVat may run into conflict with other Magento Extensions if these:
- modify Sales Quotes
- modify the Customer Object
- modify the Onepage Checkout Process
- modify the Tax Calculation
The core models EuVAT is extending, and which shall not be rewritten by other extensions to their own, are documented here...
Such conflicts are able to be resolved, our Support will give hints where to adapt your extensions to cooperate with EuVat. We have collected here conflicts we where made aware of by users of EuVAT with the approach how to resolve these.
How to find conflicting extensions
- You need to go through all of the extensions found in
app/code/community
andapp/code/local
. - For each extension, go to the
etc
directory of the extensions directory and find the extensionsconfig.xml
- Look under
<models>
if there are the core models EuVAT requires are rewritten as shown here (the model rewrite required by EuVAT):
<sales> <rewrite> <quote>Pisc_Euvat_Model_Sales_Quote</quote> </rewrite> </sales> <tax> <rewrite> <calculation>Pisc_Euvat_Model_Tax_Calculation</calculation> </rewrite> </tax>
If a extension is rewriting the models shown above, the conflicting extension is found (there might still be another extension create a similar conflict).
http://www.maisondulogiciel.com/english/magento/magento-extension-conflict.html
How to resolve with the conflicting extension
To resolve this on side of the conflicting extension use this approach:
Add a dependency to the module definition file located in app/etc/modules
of the conflicting extension, this will load our extension before the conflicting extension:
app/etc/modules/Conflicting_Module.xml
<config> <modules> <Conflicting_Module> <!-- ADD THIS DEPENDENCY ON EUVAT --> <depends> <Pisc_Euvat /> </depends> </Conflicting_Module> </modules> </config>
In the Sales/Quote
model of the conflicting extension modify the class hierarchy as followed:
Sales/Quote.php Model of conflicting extension
/* The EuVAT Sales Quote Model needs to be in the class hierarchy */ class Conflicting_Extension_Model_Sales_Quote extends Pisc_Euvat_Model_Sales_Quote {
Fontis Recaptcha
Issue:
This extension is rewriting Mage/Customer/controllers/AccountController.php
, creating ambiquous routes for the Magento router resulting in a 'Routing Error Message'.
Solution:
Use EuVat 0.3.0 or above.
Issue:
When wanting to change to the EuVAT provided Tax-VAT field in the Customer Registration page of the standard Magento templates the changes do not propagate to the visible page.
Solution:
Fontis Recaptcha is providing its own Customer Registration page stored in app/design/frontend/default/default/template/fontis/recaptcha/register.phtml
where the related changes for the Tax-VAT field need to be applied.
IDev OneStep Checkout
Issue:
When using the commercial extension OneStep Checkout, the Tax Status or Customer Group / Tax Group are not updated during the checkout process.
Solution:
This is caused by the way this extension is handling the checkout process, users reported that the most recent version has been improved such that it now is coexisting with EuVAT.
To use the EuVAT VAT ID field instead of the default Magento entry field for the TaxVAT number, change the following OneStep Checkout template:
app/design/frontend/.../template/onestepcheckout/billing_fields.phtml
/* * Around line 122: Invoke the EuVAT VAT ID input field */ <?php $_taxvat = $this->getLayout()->createBlock('euvat/widget_taxvat'); ?> <?php if(is_object($_taxvat) && $_taxvat->isEnabled()): ?> <?php $billingFields['taxvat'] = $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat()) ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml(); ?> <?php endif; ?>
In the most recent release of OneStepCheckout there is also a configuration option under OneStepCheckout » Exclude/include Fields
: Set Enable Pillwax EUVAT extension support
to Yes
.
Additionally the OneStep Checkout extension is modifying a Magento core model EuVAT uses for the tax group identification during the checkout process. Please modify the following file as shown here to have the related EuVAT functions working with the OneStep Checkout extension:
app/code/local/Idev/OneStepCheckout/Model/Sales/Quote.php
/* Change: class Idev_OneStepCheckout_Model_Sales_Quote extends Mage_Sales_Model_Quote Into: */ class Idev_OneStepCheckout_Model_Sales_Quote extends Pisc_Euvat_Model_Sales_Quote { ....
On Magento 1.7 or above still the default Magento Taxvat form field may appear, although all above changes are made and the configuration settings of the OneStepCheckout extension are correct to use our extension.
To correct that the following is recommended:
Configuration
» Customer Configuration
» Create New Account Options
: Set the configuration option Show VAT Number on Frontend
to No
.
This will set Magento to not show a VAT ID field at the address form itself, this setting is used by OneStepCheckout to reset the Taxvat field to the Magento default one. If you need this function explicitly then modifiy the following OneStepCheckout template file:
app/design/frontend/base/default/template/onestepcheckout/billing_fields.phtml
<?php if(is_object($_taxvat) && $_taxvat->isEnabled()): ?> <?php $billingFields['taxvat'] = $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat()) ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml(); ?> <?php endif; ?> <!-- Comment out the below code part to prevent resetting of the EUVAT VAT-ID form field to the Magento default: --> <?php /*if (method_exists(Mage::helper('customer/address'), 'isVatAttributeVisible') && Mage::helper('customer/address')->isVatAttributeVisible()) : ?> <?php $billingFields['taxvat'] = ' <label for="billing:vat_id">'.$this->__('VAT Number').'</label> <div class="input-box"> <input type="text" id="billing:vat_id" name="billing[vat_id]" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getVatId()).'" title="'.$this->__('VAT Number').'" class="input-text '.Mage::helper('customer/address')->getAttributeValidationClass('vat_id').'" /> </div>'; ?> <?php endif; */ ?>
Webshopapps Premium Rate (Premium Matrix Rate)
Issue:
When using the commercial extension Webshopapps Premium Matrix Rate, the VAT is not added or waived as per the EuVAT extension design and documentation. Despite of having configured the EuVAT extension correctly, the VAT is still applied as with the default Magento behaviour.
Solution:
This is caused by a conflicting Tax-Calculation model being used by the Webshopapps extension, please apply the following code change to that extensions file located in its extension directory:
app/code/local/Webshopapps/Premiumrate/Tax/Model/Calculation.php
<?php /* * Required for cooperation with PISC_EUVAT */ require_once('Pisc/Euvat/Model/Tax/Calculation.php'); /* * Extend the EuVaT model instead of the core model */ //class Webshopapps_Premiumrate_Tax_Model_Calculation extends Mage_Tax_Model_Calculation class Webshopapps_Premiumrate_Tax_Model_Calculation extends Pisc_Euvat_Model_Tax_Calculation {
Webshopapps Shipmanager
Issue:
When using the commercial extension Webshopapps Ship Manager, the VAT is not added or waived as per the EuVAT extension design and documentation. Despite of having configured the EuVAT extension correctly, the VAT is still applied as with the default Magento behaviour.
Solution:
This is caused by a conflicting Sales-Quote model being used by the Webshopapps extension, please apply the following code change to your store installation:
- Create the following directory to allow customization of the related Magento core model:
/app/code/local/Mage/Sales/Model/
- Copy the Magento core model file
app/code/core/Mage/Sales/Model/Quote.php
toapp/code/local/Mage/Sales/Model/Quote.php
- Customize the model copied into
app/code/local/Mage/Sales/Model
as shown here below:
app/code/local/Mage/Sales/Model/Quote.php
/* * Around line 306 modify the function "getCustomerTaxClassId()" as shown below: */ public function getCustomerTaxClassId() { /* * This invokes the EuVAT Sales-Quote model instead of the core function */ $model = Mage::getModel('euvat/sales_quote'); return $model->getCustomerTaxClassId($this); }
Webshopapps Vatchecker
Issue:
When using the commercial extension Webshopapps VAT Checker, the VAT is not added or waived as per the EuVAT extension design and documentation. Despite of having configured the EuVAT extension correctly, the VAT is still applied as with the default Magento behaviour.
Solution:
Please remove or deactivate this extension, the functionality of it is duplicating some of the EuVAT extension functions and is obsolete if using our EuVAT extension.
In case you need to keep this extension, then
this is caused by a conflicting Sales-Quote model being used by the Webshopapps extension, please apply the following code change to your store installation:
- Create the following directory to allow customization of the related Magento core model:
/app/code/local/Mage/Sales/Model/
- Copy the Magento core model file
app/code/core/Mage/Sales/Model/Quote.php
toapp/code/local/Mage/Sales/Model/Quote.php
- Customize the model copied into
app/code/local/Mage/Sales/Model
as shown here below:
app/code/local/Mage/Sales/Model/Quote.php
/* * Around line 306 modify the function "getCustomerTaxClassId()" as shown below: */ public function getCustomerTaxClassId() { /* * This invokes the EuVAT Sales-Quote model instead of the core function */ $model = Mage::getModel('euvat/sales_quote'); return $model->getCustomerTaxClassId($this); }
Pektsekye Dependent Custom Options
Issue:
When using the commercial extension Pektsekye Dependent Custom Options, the VAT is not added or waived as per the EuVAT extension design and documentation. Despite of having configured the EuVAT extension correctly, the VAT is still applied as with the default Magento behaviour.
Solution:
This is caused by a conflicting Sales-Quote model being used by the Pektsekye extension, please apply the following code change to your store installation:
- Create the following directory to allow customization of the related Magento core model:
/app/code/local/Mage/Sales/Model/
- Copy the Magento core model file
app/code/core/Mage/Sales/Model/Quote.php
toapp/code/local/Mage/Sales/Model/Quote.php
- Customize the model copied into
app/code/local/Mage/Sales/Model
as shown here below:
app/code/local/Mage/Sales/Model/Quote.php
/* * Around line 306 modify the function "getCustomerTaxClassId()" as shown below: */ public function getCustomerTaxClassId() { /* * This invokes the EuVAT Sales-Quote model instead of the core function */ $model = Mage::getModel('euvat/sales_quote'); return $model->getCustomerTaxClassId($this); }
Firecheckout One Page Checkout
Issue:
When using the commercial extension Firecheckout One Page Checkout, the VAT is not added or waived as per the EuVAT extension design and documentation. Despite of having configured the EuVAT extension correctly, the VAT is still applied as with the default Magento behaviour.
Solution:
This is caused by the extension only partly implementing the processing of the VAT ID entered in the checkout form. To correct this the following files of the Firecheckout Extension require modification:
Replace Magento default TaxVAT form field with the EuVAT VAT ID form field:
app/design/frontend/default/default/template/firecheckout/checkout/billing.phtml
<?php if (!$this->isCustomerLoggedIn()) : ?> ... /* * Around Line 136: * Modify the following line to this: */ <?php $_taxvat = $this->getLayout()->createBlock('euvat/widget_taxvat') ?> <?php if ($_taxvat->isEnabled()): ?> <li> <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?> </li> <?php endif ?>
Update the Firecheckout JavaScript library:
skin/frontend/default/default/js/firecheckout.js
var Billing = Class.create(); Billing.prototype = { initialize: function(){ /* * Around Line 310 add this at start of the 'initialize' function for the checkout page to update with entered VAT ID: */ /* --- Modification required for EUVAT --- */ $('billing:taxvat') && $('billing:taxvat').observe('change', function() { checkout.update({'review': 1}); }); /* --- end --- */
Update the Firecheckout Controller class:
app/code/local/TM/FireCheckout/controllers/IndexController.php
$shippingUpdated = false; $paymentData = $this->getRequest()->getPost('payment', array()); /* * Around Line 393 add this to save the VAT ID to the Quote object: */ if (isset($billingData['taxvat'])) { $quote->setCustomerTaxvat($billingData['taxvat']); }
Amasty Multiple Coupons
Issue:
When using the commercial extension Amasty Multiple Coupons, the VAT is not added or waived as per the EuVAT extension design and documentation. Despite of having configured the EuVAT extension correctly, the VAT is still applied as with the default Magento behaviour.
Solution:
This is caused by a conflicting Sales-Quote model being used by the Amasty extension, please apply the following code change to your store installation:
app/code/local/Amasty/Coupons/Model/Rewrite/Quote.php
/* Replace class descriptor with this: */ class Amasty_Coupons_Model_Rewrite_Quote extends Pisc_Euvat_Model_Sales_Quote {
app/etc/modules/Amasty_Coupons.xml
<?xml version="1.0"?> <config> <modules> <Amasty_Coupons> <active>true</active> <codePool>local</codePool> <!-- Add dependency descriptor for EUVAT: --> <depends> <Pisc_Euvat /> </depends> </Amasty_Coupons> </modules> </config>
app/code/local/Pisc/Euvat/etc/config.xml
</tax_resource> <!-- Around line 64 comment this model rewrite: <sales> <rewrite> <quote>Pisc_Euvat_Model_Sales_Quote</quote> </rewrite> </sales> --> <tax>
IWD One Page Checkout
Issue:
When using the free One Page checkout extension One Page Checkout (One Page Checkout on MagentoCommerce), the Order Review block is not updated when editing the VAT ID or changing the Billing Country.
Solution:
Some code is required to be added to the One Page Checkout source code to trigger update of the Order Review block when editing the VAT ID or Country.
skin/frontend/base/default/js/onepagecheckout.js
/* --- Around Line 222: --- */ var BillingAddress = Class.create(); BillingAddress.prototype = { initialize: function () { $('billing:country_id') && $('billing:country_id').observe('change', function () { if ($('billing:region_id')) {function resetRegionId() { $('billing:region_id').value = ''; $('billing:region_id')[0].selected = true; } resetRegionId.delay(0.2); } if ($('shipping:same_as_billing') && $('shipping:same_as_billing').checked) { shipping.syncWithBilling(); } checkout.update({ /* MODIFIED FOR EUVAT TO UPDATE ORDER REVIEW: */ 'payment-method': 1, 'review': 1, 'shipping-method': !$('shipping:same_as_billing') || $('shipping:same_as_billing').checked ? 1 : 0 }); }); /* --- Around Line 272: --- */ $('billing:postcode') && $('billing:postcode').observe('change', function () { ... ... }); /* ADDED FOR EUVAT TO UPDATE ORDER REVIEW: */ $('billing:taxvat') && $('billing:taxvat').observe('change', function () { checkout.update({ 'review': 1 }); }); /* --- Around Line 312: --- */ var ShippingAddress = Class.create(); ShippingAddress.prototype = { initialize: function (form) { this.form = form; $('shipping:country_id') && $('shipping:country_id').observe('change', function () { if ($('shipping:region_id')) { $('shipping:region_id').value = ''; $('shipping:region_id')[0].selected = true; } checkout.update({ /* MODIFIED FOR EUVAT TO UPDATE ORDER REVIEW: */ 'shipping-method': 1, 'review': 1 }); });
Issue:
When having a validated EU VAT-ID in the billing address, the VAT is still showing on the order total.
Solution:
Some code is required to be added to the One Page Checkout source code to save the VAT-ID into the Quote.
app/code/local/IWD/OnepageCheckout/controllers/IndexController.php
public function updateCheckoutAction() { /* --- Around Line 237: --- */ if ($this->_checkChangedAddress($bill_data, 'Billing', $bill_addr_id) || $this->getRequest()->getPost('payment-method', false)) { if (isset($bill_data['email'])) { $bill_data['email'] = trim($bill_data['email']); } /* EUVAT: Save VAT-ID to quote model */ if (isset($bill_data['taxvat'])) { $this->getOnepagecheckout()->getQuote()->setCustomerTaxvat($bill_data['taxvat']); } $bill_result = $this->getOnepagecheckout()->saveBilling($bill_data, $bill_addr_id, false);
FME One Step Checkout (QuickCheckout)
Issue:
When using the checkout extension FME One Step Checkout (FME One Step Checkout on MagentoCommerce), the Order Review block is not updated when adding the EU VAT-ID.
Also any entered VAT-ID is not saved with the order, or the tax rules are not applied to the order review or saved order.
Solution:
Some code is required to be added to the extensions source code to trigger update of the Order Review block when editing the VAT ID or Country. The VAT-ID field is not supported by the extension by default, additional code is required to process the VAT-ID field and its data.
The following configuration options need to be set in System
» Configuration
» QuickCheckout
» General
:
- Update Shipping/Payment Methods on Country Change to
Yes
- Update Shipping/Payment Methods on Zip/Postal code Change to
Yes
- Update Shipping/Payment Methods on State/Province Change to
Yes
On the client side JS library submitting the Taxvat (VAT-ID) field date to the extension has to be added:
js/quickcheckout/quickcheckout.js
/* Around line 333: */ saveCountry:function(){ var a=$("billing:country_id").value, b=$("billing:postcode").value, c=$("billing:region_id").value; if(this.useBilling){ onestepcheckout.setLoadWaitingShippingMethod(true); new Ajax.Request(this.saveCountryUrl,{ /* EUVAT: Add Taxvat field to request */ parameters:{country_id:a,postcode:b,region_id:c,use_for:"billing",taxvat:($("billing:taxvat")!==null)?$("billing:taxvat").value:''}, /* ----------- */ method:"post", onComplete:onestepcheckout.resetLoadWaitingShippingMethod.bind(onestepcheckout), onSuccess:onestepcheckout.processRespone.bind(onestepcheckout), onFailure:onestepcheckout.ajaxFailure.bind(onestepcheckout) })
On the server side Controller saving the Taxvat (VAT-ID) field date to the Quote Model has to be added:
app/code/local/FME/QuickCheckout/controllers/OnestepController.php
/* Around line 190: */ public function saveBillingAction() { ... if ($data) { if ($data['use_for'] == 'billing') { Mage::getSingleton('checkout/session')->setData('use_for_shipping', false); try { /* EUVAT: Save Taxvat to Quote */ $this->getQuote()->setCustomerTaxvat($data['taxvat']); /* ----------- */ $this->getQuote()->getBillingAddress()->setCountryId($data['country_id'])->setPostcode($data['postcode'])->setRegionId($data['region_id'])->save(); $this->getQuote()->getShippingAddress()->setCountryId($data['country_id'])->setPostcode($data['postcode'])->setRegionId($data['region_id'])->save();
The layout of VAT-ID field may appear to be broken on the payment page, a CSS style definition for the <li>
element has to be added to the template file:
app/design/frontend/default/default/quickcheckout/onestep/billing.phtml
/* Around line 173: */ <?php $_taxvat = $this->getLayout()->createBlock('euvat/widget_taxvat') ?> <?php if ($_taxvat->isEnabled()): ?> <li class="d_2"> <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?> </li> <?php endif ?>
You also need to use EUVAT release 0.3.55 or above, as additional support for this extension on updating the Order Review after validation of the VAT-ID has been added in that release.
SISOW Payment Gateway
Issue:
When using the payment gateway extension Sisow Payment Gateway, the EuVAT Tax related functions may not work correctly despite correct configuration of the EuVAT extension. This may also be indicated by a message shown in the EuVAT configuration saying “that another extension is already extending the Sales/Quote model”
.
Solution:
The Sisow Payment Gateway implementation is concurrently extending the Magento Core Model Sales/Quote
which is also extended by EuVAT to introduce its functions.
Modify the following file of the Sisow Extension to correctly subclass from the EuVAT extension:
app/code/local/Sisow/Model/Quote/Quote.php
/* If the class headers looks like this: class Sisow_Model_Quote_Quote extends Mage_Sales_Model_Quote Modify into: */ class Sisow_Model_Paymentfee_Quote_Quote extends Sisow_Model_Paymentfee_Quote_Quote_All4coding { ....
Alternatively later releases of this extensions have different class code, if the class header looks like this apply these modifications:
app/code/local/Sisow/Model/Quote/Quote.php
/* If class header looks like this: */ class Sisow_Model_Paymentfee_Quote_Quote extends Sisow_Model_Paymentfee_Quote_Quote_All4coding { /** * Insert this code part to use PISC EUVAT: */ public function getCustomerTaxClassId() { $quote = Mage::getModel('euvat/sales_quote'); if ($quote) { $quote->getCustomerTaxClassId($this); } } /* -- End of Insert -- */ /* * Get all quote totals * * We need to remove a sisow_tax line that is created from * one of our models. Otherwise there will be two tax lines in the * checkout * * @return array */ public function getTotals() { ... } }
All4Coding Subscriptions & Recurring Payments
Issue:
When using the extension All4Coding Subscriptions & Recurring Payments, the EuVAT Tax related functions may not work correctly despite correct configuration of the EuVAT extension. This may also be indicated by a message shown in the EuVAT configuration saying “that another extension is already extending the Sales/Quote model”
.
Solution:
Use release 0.3.96 of the Euvat Extension (for Magento 1) where some work-around is implemented. However some other functions may not work as expected due to the fact that the All4Coding extension is using code obfuscation and encryption and is rewriting the Sales/Quote Magento Core Model used by EuVAT for correcting the Customer Tax Class.