Version Notes
First release.
Download this release
Release Info
Developer | Pawel Kazakow |
Extension | xonu_FGP |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
app/code/community/Xonu/FGP/Model/Calculation.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @copyright (c) 2012, Pawel Kazakow <support@xonu.de>
|
4 |
+
* @license http://xonu.de/license/ xonu.de EULA
|
5 |
+
*/
|
6 |
+
class Xonu_FGP_Model_Calculation extends Mage_Tax_Model_Calculation
|
7 |
+
{
|
8 |
+
public function getRateOriginRequest($store = null)
|
9 |
+
{
|
10 |
+
// set origin to destination
|
11 |
+
|
12 |
+
$request = new Varien_Object();
|
13 |
+
|
14 |
+
$session = Mage::getSingleton('checkout/session');
|
15 |
+
if($session->hasQuote()) // getQuote() would lead to infinite loop here when switching currency
|
16 |
+
{
|
17 |
+
// use quote destination if quote exists
|
18 |
+
|
19 |
+
$quote = $session->getQuote();
|
20 |
+
$request = $this->getRateRequest(
|
21 |
+
$quote->getShippingAddress(),
|
22 |
+
$quote->getBillingAddress(),
|
23 |
+
$quote->getCustomerTaxClassId(),
|
24 |
+
$store
|
25 |
+
);
|
26 |
+
|
27 |
+
return $request;
|
28 |
+
}
|
29 |
+
else // quote is not available when switching the currency
|
30 |
+
{
|
31 |
+
return $this->getDefaultDestination();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
private function getDefaultDestination($store = null)
|
36 |
+
{
|
37 |
+
$address = new Varien_Object();
|
38 |
+
$request = new Varien_Object();
|
39 |
+
|
40 |
+
$address
|
41 |
+
->setCountryId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, $store))
|
42 |
+
->setRegionId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_REGION, $store))
|
43 |
+
->setPostcode(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_POSTCODE, $store));
|
44 |
+
|
45 |
+
$customerTaxClass = null;
|
46 |
+
$customer = $this->getCustomer();
|
47 |
+
|
48 |
+
if (is_null($customerTaxClass) && $customer) {
|
49 |
+
$customerTaxClass = $customer->getTaxClassId();
|
50 |
+
} elseif (($customerTaxClass === false) || !$customer) {
|
51 |
+
$customerTaxClass = $this->getDefaultCustomerTaxClass($store);
|
52 |
+
}
|
53 |
+
|
54 |
+
$request
|
55 |
+
->setCountryId($address->getCountryId())
|
56 |
+
->setRegionId($address->getRegionId())
|
57 |
+
->setPostcode($address->getPostcode())
|
58 |
+
->setStore($store)
|
59 |
+
->setCustomerClassId($customerTaxClass);
|
60 |
+
|
61 |
+
return $request;
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Xonu/FGP/etc/config.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @copyright (c) 2012, Pawel Kazakow <support@xonu.de>
|
5 |
+
* @license http://xonu.de/license/ xonu.de EULA
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<Xonu_SBE>
|
11 |
+
<version>1.0.0</version>
|
12 |
+
</Xonu_SBE>
|
13 |
+
</modules>
|
14 |
+
<global>
|
15 |
+
<models>
|
16 |
+
<tax>
|
17 |
+
<rewrite>
|
18 |
+
<calculation>Xonu_FGP_Model_Calculation</calculation>
|
19 |
+
</rewrite>
|
20 |
+
</tax>
|
21 |
+
</models>
|
22 |
+
</global>
|
23 |
+
</config>
|
app/etc/modules/xonu_FGP.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @copyright (c) 2012, Pawel Kazakow <support@xonu.de>
|
5 |
+
* @license http://xonu.de/license/ xonu.de EULA
|
6 |
+
*/
|
7 |
+
-->
|
8 |
+
<config>
|
9 |
+
<modules>
|
10 |
+
<Xonu_FGP>
|
11 |
+
<active>true</active>
|
12 |
+
<codePool>community</codePool>
|
13 |
+
</Xonu_FGP>
|
14 |
+
</modules>
|
15 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>xonu_FGP</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://xonu.de/license/">EULA</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Fixes the gross price instead of the net price.</summary>
|
10 |
+
<description>By default Magento works with fixed net prices. Tax rate included in the gross price you specify in backend depends on the origin country setting.
|
11 |
+

|
12 |
+
If your customer's destination country has a higher tax rate a new higher subtotal gross price is calculated for the customer.
|
13 |
+

|
14 |
+
This extension makes Magento work with fixed gross prices. All customers pay the same subtotal gross price, but get a different tax value shown according to the destination tax rate.</description>
|
15 |
+
<notes>First release.</notes>
|
16 |
+
<authors><author><name>Pawel Kazakow</name><user>xonu</user><email>support@xonu.de</email></author></authors>
|
17 |
+
<date>2012-12-03</date>
|
18 |
+
<time>15:53:51</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="Xonu"><dir name="FGP"><dir name="Model"><file name="Calculation.php" hash="d2ab415bf41d2ef8e75aa8cb8a33d5f2"/></dir><dir name="etc"><file name="config.xml" hash="8d43adda7291a6894b85b44e7bb13db1"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="xonu_FGP.xml" hash="684fc8affc328c500bca7232b78636b8"/></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
+
</package>
|