Version Notes
- Fixed bug "Object of class stdClass could not be converted to double" when customer adds product to cart
Download this release
Release Info
Developer | Vertex SMB |
Extension | VertexSMB_TaxCE |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.5
- app/code/local/VertexSMB/TaxCE/Block/Adminhtml/Order/View.php +13 -11
- app/code/local/VertexSMB/TaxCE/Block/Adminhtml/System/Config/Form/Field/ShippingCodes.php +5 -1
- app/code/local/VertexSMB/TaxCE/Block/Adminhtml/System/Config/Form/Field/{TaxceStatus.php → VertexSMBStatus.php} +8 -3
- app/code/local/VertexSMB/TaxCE/Helper/Config.php +25 -23
- app/code/local/VertexSMB/TaxCE/Helper/Data.php +42 -135
- app/code/local/VertexSMB/TaxCE/Model/Observer.php +46 -17
- app/code/local/VertexSMB/TaxCE/Model/RequestItem.php +11 -3
- app/code/local/VertexSMB/TaxCE/Model/Resource/Setup.php +12 -1
- app/code/local/VertexSMB/TaxCE/Model/Resource/TaxRequest.php +8 -4
- app/code/local/VertexSMB/TaxCE/Model/Resource/TaxRequest/Collection.php +10 -5
- app/code/local/VertexSMB/TaxCE/Model/Source/Taxinvoice.php +6 -1
- app/code/local/VertexSMB/TaxCE/Model/Source/Usregions.php +13 -5
- app/code/local/VertexSMB/TaxCE/Model/Tax/Sales/Total/Quote/Tax.php +69 -39
- app/code/local/VertexSMB/TaxCE/Model/TaxAreaRequest.php +53 -0
- app/code/local/VertexSMB/TaxCE/Model/TaxAreaResponse.php +30 -0
- app/code/local/VertexSMB/TaxCE/Model/TaxInvoice.php +16 -16
- app/code/local/VertexSMB/TaxCE/Model/TaxQuote.php +27 -59
- app/code/local/VertexSMB/TaxCE/Model/TaxQuoteResponse.php +55 -0
- app/code/local/VertexSMB/TaxCE/Model/TaxRequest.php +17 -12
- app/code/local/VertexSMB/TaxCE/Model/{Taxce.php → VertexSMB.php} +55 -14
- app/code/local/VertexSMB/TaxCE/controllers/OnepageController.php +88 -88
- app/code/local/VertexSMB/TaxCE/controllers/{TaxceController.php → VertexSMBController.php} +43 -51
- app/code/local/VertexSMB/TaxCE/data/taxce_setup/data-install-0.1.1.php +7 -0
- app/code/local/VertexSMB/TaxCE/data/taxce_setup/data-upgrade-0.1.4-0.1.5.php +7 -0
- app/code/local/VertexSMB/TaxCE/etc/adminhtml.xml +7 -0
- app/code/local/VertexSMB/TaxCE/etc/config.xml +83 -76
- app/code/local/VertexSMB/TaxCE/etc/system.xml +26 -19
- app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-install-0.1.1.php +7 -2
- app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-0.1.3-0.1.4.php +6 -1
- app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-0.1.6-0.1.7.php +6 -1
- app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-0.1.7-0.1.8.php +9 -6
- app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-1.1.0-1.1.1.php +49 -0
- app/design/adminhtml/default/default/layout/taxce.xml +0 -12
- app/design/adminhtml/default/default/layout/vertexsmb.xml +18 -0
- app/design/adminhtml/default/default/template/{taxce → vertexsmb}/addresschange-popup-content.phtml +63 -55
- app/design/adminhtml/default/default/template/{taxce → vertexsmb}/popup-content.phtml +8 -1
- app/design/adminhtml/default/default/template/{taxce → vertexsmb}/popup.phtml +16 -9
- app/design/frontend/base/default/layout/taxce.xml +0 -12
- app/design/frontend/base/default/layout/vertexsmb.xml +19 -0
- app/design/frontend/base/default/template/{taxce → vertexsmb}/addresschange-popup-content.phtml +77 -70
- app/design/frontend/base/default/template/{taxce → vertexsmb}/popup-content.phtml +11 -1
- app/design/frontend/base/default/template/{taxce → vertexsmb}/popup.phtml +8 -1
- app/etc/modules/VertexSMB_TaxCE.xml +7 -0
- package.xml +5 -5
app/code/local/VertexSMB/TaxCE/Block/Adminhtml/Order/View.php
CHANGED
@@ -1,28 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Block_Adminhtml_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
public function __construct()
|
8 |
{
|
9 |
parent::__construct();
|
10 |
|
11 |
-
if (Mage::Helper('taxce')->
|
12 |
$TotalInvoicedTax=Mage::getModel('taxce/taxRequest')->getTotalInvoicedTax( $this->getOrder()->getId());
|
13 |
if ($TotalInvoicedTax || !Mage::helper('taxce')->ShowManualInvoiceButton())
|
14 |
return $this;
|
15 |
-
$this->_addButton('
|
16 |
-
'label' => Mage::helper('taxce')->__("
|
17 |
'onclick' => 'setLocation(\'' . $this->getVertexInvoiceUrl() . '\')',
|
18 |
'class' => 'go'
|
19 |
-
));
|
20 |
-
|
21 |
}
|
22 |
}
|
23 |
|
24 |
public function getVertexInvoiceUrl(){
|
25 |
-
return $this->getUrl('*/
|
26 |
}
|
27 |
|
28 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
class VertexSMB_TaxCE_Block_Adminhtml_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
9 |
+
|
|
|
|
|
10 |
public function __construct()
|
11 |
{
|
12 |
parent::__construct();
|
13 |
|
14 |
+
if (Mage::Helper('taxce')->IsVertexSMBActive()) {
|
15 |
$TotalInvoicedTax=Mage::getModel('taxce/taxRequest')->getTotalInvoicedTax( $this->getOrder()->getId());
|
16 |
if ($TotalInvoicedTax || !Mage::helper('taxce')->ShowManualInvoiceButton())
|
17 |
return $this;
|
18 |
+
$this->_addButton('vertex_invoice', array(
|
19 |
+
'label' => Mage::helper('taxce')->__("Vertex SMB Invoice"),
|
20 |
'onclick' => 'setLocation(\'' . $this->getVertexInvoiceUrl() . '\')',
|
21 |
'class' => 'go'
|
22 |
+
));
|
|
|
23 |
}
|
24 |
}
|
25 |
|
26 |
public function getVertexInvoiceUrl(){
|
27 |
+
return $this->getUrl('*/vertexSMB/invoicetax');
|
28 |
}
|
29 |
|
30 |
}
|
app/code/local/VertexSMB/TaxCE/Block/Adminhtml/System/Config/Form/Field/ShippingCodes.php
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Block_Adminhtml_System_Config_Form_Field_ShippingCodes extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
{
|
5 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
class VertexSMB_TaxCE_Block_Adminhtml_System_Config_Form_Field_ShippingCodes extends Mage_Adminhtml_Block_System_Config_Form_Field
|
8 |
{
|
9 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
app/code/local/VertexSMB/TaxCE/Block/Adminhtml/System/Config/Form/Field/{TaxceStatus.php → VertexSMBStatus.php}
RENAMED
@@ -1,11 +1,16 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
4 |
{
|
5 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
{
|
7 |
$helper=Mage::helper('taxce');
|
8 |
-
if (!$helper->
|
9 |
$status="Disabled";
|
10 |
$state="critical";
|
11 |
}else{
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
+
class VertexSMB_TaxCE_Block_Adminhtml_System_Config_Form_Field_VertexSMBStatus extends Mage_Adminhtml_Block_System_Config_Form_Field
|
9 |
{
|
10 |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
{
|
12 |
$helper=Mage::helper('taxce');
|
13 |
+
if (!$helper->IsVertexSMBActive()) {
|
14 |
$status="Disabled";
|
15 |
$state="critical";
|
16 |
}else{
|
app/code/local/VertexSMB/TaxCE/Helper/Config.php
CHANGED
@@ -1,31 +1,33 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
class VertexSMB_TaxCE_Helper_Config extends Mage_Core_Helper_Abstract {
|
5 |
|
6 |
-
const CONFIG_XML_PATH_ENABLE_VERTEX='tax/
|
7 |
const CONFIG_XML_PATH_DEFAULT_TAX_CALCULATION_ADDRESS_TYPE='tax/calculation/based_on';
|
8 |
const CONFIG_XML_PATH_DEFAULT_CUSTOMER_CODE = 'tax/classes/default_customer_code';
|
9 |
-
const VERTEX_API_HOST='tax/
|
10 |
-
|
11 |
-
const
|
12 |
-
const
|
13 |
-
const
|
14 |
-
const
|
15 |
-
const
|
16 |
-
const
|
17 |
-
const
|
18 |
-
const
|
19 |
-
const
|
20 |
-
const
|
21 |
-
const
|
22 |
-
const CONFIG_XML_PATH_VERTEX_INVOICE_DATE = 'tax/taxce_settings/invoice_tax_date';
|
23 |
const CONFIG_XML_PATH_VERTEX_TRANSACTION_TYPE = 'SALE'; /* SALE,RENTAl,LEASE*/
|
24 |
-
const CONFIG_XML_PATH_VERTEX_INVOICE_ORDER = 'tax/
|
25 |
-
const CONFIG_XML_PATH_VERTEX_INVOICE_ORDER_STATUS = 'tax/
|
26 |
const CONFIG_XML_PATH_SHIPPING_TAX_CLASS = 'tax/classes/shipping_tax_class';
|
27 |
-
const VERTEX_ADDRESS_API_HOST='tax/
|
28 |
-
|
29 |
const VERTEX_CREDITMEMO_ADJUSTMENT_CLASS='tax/classes/creditmemo_adjustment_class';
|
30 |
const VERTEX_CREDITMEMO_ADJUSTMENT_NEGATIVE_CODE='tax/classes/creditmemo_adjustment_negative_code';
|
31 |
const VERTEX_CREDITMEMO_ADJUSTMENT_POSITIVE_CODE='tax/classes/creditmemo_adjustment_positive_code';
|
@@ -35,9 +37,9 @@ class VertexSMB_TaxCE_Helper_Config extends Mage_Core_Helper_Abstract {
|
|
35 |
const VERTEX_GIFTWRAP_ITEM_CODE_PREFIX='tax/classes/giftwrap_item_code';
|
36 |
const VERTEX_PRINTED_GIFTCARD_CLASS='tax/classes/printed_giftcard_class';
|
37 |
const VERTEX_PRINTED_GIFTCARD_CODE='tax/classes/printed_giftcard_code';
|
38 |
-
const CONFIG_XML_PATH_VERTEX_ALLOW_CART_QUOTE = 'tax/
|
39 |
-
const CONFIG_XML_PATH_VERTEX_SHOW_MANUAL_BUTTON = 'tax/
|
40 |
-
const CONFIG_XML_PATH_VERTEX_SHOW_POPUP= 'tax/
|
41 |
|
42 |
public function getQuoteAllowedControllers(){
|
43 |
$_quote_allowed_controllers=array('onepage','multishipping','sales_order_create');
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
|
8 |
class VertexSMB_TaxCE_Helper_Config extends Mage_Core_Helper_Abstract {
|
9 |
|
10 |
+
const CONFIG_XML_PATH_ENABLE_VERTEX='tax/vertexsmb_settings/enable_vertexsmb';
|
11 |
const CONFIG_XML_PATH_DEFAULT_TAX_CALCULATION_ADDRESS_TYPE='tax/calculation/based_on';
|
12 |
const CONFIG_XML_PATH_DEFAULT_CUSTOMER_CODE = 'tax/classes/default_customer_code';
|
13 |
+
const VERTEX_API_HOST='tax/vertexsmb_settings/api_url';
|
14 |
+
const CONFIG_XML_PATH_VERTEX_API_USER = 'tax/vertexsmb_settings/login';
|
15 |
+
const CONFIG_XML_PATH_VERTEX_API_KEY = 'tax/vertexsmb_settings/password';
|
16 |
+
const CONFIG_XML_PATH_VERTEX_API_TRUSTED_ID = 'tax/vertexsmb_settings/trustedId';
|
17 |
+
const CONFIG_XML_PATH_VERTEX_COMPANY_CODE = 'tax/vertexsmb_seller_info/company';
|
18 |
+
const CONFIG_XML_PATH_VERTEX_LOCATION_CODE = 'tax/vertexsmb_seller_info/location_code';
|
19 |
+
const CONFIG_XML_PATH_VERTEX_STREET1 = 'tax/vertexsmb_seller_info/streetAddress1';
|
20 |
+
const CONFIG_XML_PATH_VERTEX_STREET2 = 'tax/vertexsmb_seller_info/streetAddress2';
|
21 |
+
const CONFIG_XML_PATH_VERTEX_CITY = 'tax/vertexsmb_seller_info/city';
|
22 |
+
const CONFIG_XML_PATH_VERTEX_COUNTRY = 'tax/vertexsmb_seller_info/country_id';
|
23 |
+
const CONFIG_XML_PATH_VERTEX_REGION = 'tax/vertexsmb_seller_info/region_id';
|
24 |
+
const CONFIG_XML_PATH_VERTEX_POSTAL_CODE = 'tax/vertexsmb_seller_info/postalCode';
|
25 |
+
const CONFIG_XML_PATH_VERTEX_INVOICE_DATE = 'tax/vertexsmb_settings/invoice_tax_date';
|
|
|
26 |
const CONFIG_XML_PATH_VERTEX_TRANSACTION_TYPE = 'SALE'; /* SALE,RENTAl,LEASE*/
|
27 |
+
const CONFIG_XML_PATH_VERTEX_INVOICE_ORDER = 'tax/vertexsmb_settings/invoice_order';
|
28 |
+
const CONFIG_XML_PATH_VERTEX_INVOICE_ORDER_STATUS = 'tax/vertexsmb_settings/invoice_order_status';
|
29 |
const CONFIG_XML_PATH_SHIPPING_TAX_CLASS = 'tax/classes/shipping_tax_class';
|
30 |
+
const VERTEX_ADDRESS_API_HOST='tax/vertexsmb_settings/address_api_url';
|
|
|
31 |
const VERTEX_CREDITMEMO_ADJUSTMENT_CLASS='tax/classes/creditmemo_adjustment_class';
|
32 |
const VERTEX_CREDITMEMO_ADJUSTMENT_NEGATIVE_CODE='tax/classes/creditmemo_adjustment_negative_code';
|
33 |
const VERTEX_CREDITMEMO_ADJUSTMENT_POSITIVE_CODE='tax/classes/creditmemo_adjustment_positive_code';
|
37 |
const VERTEX_GIFTWRAP_ITEM_CODE_PREFIX='tax/classes/giftwrap_item_code';
|
38 |
const VERTEX_PRINTED_GIFTCARD_CLASS='tax/classes/printed_giftcard_class';
|
39 |
const VERTEX_PRINTED_GIFTCARD_CODE='tax/classes/printed_giftcard_code';
|
40 |
+
const CONFIG_XML_PATH_VERTEX_ALLOW_CART_QUOTE = 'tax/vertexsmb_settings/allow_cart_request';
|
41 |
+
const CONFIG_XML_PATH_VERTEX_SHOW_MANUAL_BUTTON = 'tax/vertexsmb_settings/show_manual_button';
|
42 |
+
const CONFIG_XML_PATH_VERTEX_SHOW_POPUP= 'tax/vertexsmb_settings/show_tarequest_popup';
|
43 |
|
44 |
public function getQuoteAllowedControllers(){
|
45 |
$_quote_allowed_controllers=array('onepage','multishipping','sales_order_create');
|
app/code/local/VertexSMB/TaxCE/Helper/Data.php
CHANGED
@@ -1,8 +1,13 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
4 |
|
5 |
-
public function
|
6 |
if (Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::CONFIG_XML_PATH_ENABLE_VERTEX, Mage::app()->getStore()->getId()))
|
7 |
return true;
|
8 |
return false;
|
@@ -38,10 +43,10 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
38 |
return VertexSMB_TaxCE_Helper_Config::CONFIG_XML_PATH_VERTEX_TRANSACTION_TYPE;
|
39 |
}
|
40 |
public function getVertexHost(){
|
41 |
-
return
|
42 |
}
|
43 |
public function getVertexAddressHost(){
|
44 |
-
return
|
45 |
}
|
46 |
public function getDefaultCustomerCode(){
|
47 |
return Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::CONFIG_XML_PATH_DEFAULT_CUSTOMER_CODE, Mage::app()->getStore()->getId());
|
@@ -80,7 +85,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
80 |
return Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::VERTEX_PRINTED_GIFTCARD_CODE, Mage::app()->getStore()->getId());
|
81 |
}
|
82 |
public function IsAllowedQuote() {
|
83 |
-
$quote_allowed_controllers=
|
84 |
if ($this->AllowCartQuote())
|
85 |
$quote_allowed_controllers[]='cart';
|
86 |
|
@@ -173,6 +178,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
173 |
$regionModel = Mage::getModel('directory/region')->load($region_id);
|
174 |
$company_state=$regionModel->getCode();
|
175 |
|
|
|
176 |
$address=new Varien_Object();
|
177 |
$address->setStreet1($this->getCompanyStreet1());
|
178 |
$address->setStreet2($this->getCompanyStreet2());
|
@@ -180,39 +186,15 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
180 |
$address->setRegionCode($company_state);
|
181 |
$address->setPostcode($this->getCompanyPostalCode());
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
return "Validation Error: Please check settings";
|
187 |
}
|
188 |
return "Valid";
|
189 |
}
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
$request=array(
|
194 |
-
'Login'=>array('TrustedId'=>$this->getTrustedId()),
|
195 |
-
'TaxAreaRequest'=>array(
|
196 |
-
'TaxAreaLookup'=> array(
|
197 |
-
'PostalAddress'=>array(
|
198 |
-
'StreetAddress1'=>$address->getStreet1(),
|
199 |
-
'StreetAddress2'=>$address->getStreet2(),
|
200 |
-
'City'=>$address->getCity(),
|
201 |
-
'MainDivision'=>$address->getRegionCode(),
|
202 |
-
'PostalCode'=>$address->getPostcode(),
|
203 |
-
)
|
204 |
-
)
|
205 |
-
)
|
206 |
-
);
|
207 |
-
|
208 |
-
$request_result=Mage::getModel('taxce/taxce')->SendApiRequest($request,null, 'tax_area_lookup');
|
209 |
-
if ($request_result instanceof Exception) {
|
210 |
-
Mage::log("Tax Area Lookup Error: ".$request_result->getMessage(), null, 'taxce.log');
|
211 |
-
return $request_result;
|
212 |
-
}
|
213 |
-
return $request_result;
|
214 |
-
}
|
215 |
-
|
216 |
/* Company Information */
|
217 |
public function AddSellerInformation($data){
|
218 |
|
@@ -266,7 +248,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
266 |
|
267 |
if ($creditmemo_model->getAdjustmentPositive()) {
|
268 |
$item_data=array();
|
269 |
-
$item_data['product_class']=$this->getCreditmemoAdjustmentPositiveClass();
|
270 |
$item_data['product_code']=$this->getCreditmemoAdjustmentPositiveCode();
|
271 |
$item_data['qty']=1;
|
272 |
$item_data['price']=-1*$creditmemo_model->getAdjustmentPositive();
|
@@ -275,7 +257,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
275 |
}
|
276 |
if ($creditmemo_model->getAdjustmentNegative()) {
|
277 |
$item_data=array();
|
278 |
-
$item_data['product_class']=$this->getCreditmemoAdjustmentFeeClass();
|
279 |
$item_data['product_code']=$this->getCreditmemoAdjustmentFeeCode();
|
280 |
$item_data['qty']=1;
|
281 |
$item_data['price']=$creditmemo_model->getAdjustmentNegative();
|
@@ -291,7 +273,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
291 |
return $item_data;
|
292 |
}
|
293 |
|
294 |
-
$item_data['product_class']=$this->getGiftWrappingOrderClass();
|
295 |
$item_data['product_code']=$this->getGiftWrappingOrderCode();
|
296 |
$item_data['qty']=1;
|
297 |
$item_data['price']=$order_address->getGwPrice();
|
@@ -312,7 +294,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
312 |
if (!$this->IsFirstOfPartial($order_address,$original_entity)) {
|
313 |
return $item_data;
|
314 |
}
|
315 |
-
$item_data['product_class']=$this->getPrintedGiftcardClass();
|
316 |
$item_data['product_code']=$this->getPrintedGiftcardCode();
|
317 |
$item_data['qty']=1;
|
318 |
$item_data['price']=$order_address->getGwCardPrice();
|
@@ -354,101 +336,36 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
354 |
return $item_data;
|
355 |
}
|
356 |
|
357 |
-
/*
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
|
|
|
|
|
|
365 |
if (!$this->IsAllowedQuote() )
|
366 |
-
return false;
|
367 |
-
|
368 |
/* disable for index page. */
|
369 |
if ($this->getSourcePath()=='onepage_checkout_index')
|
370 |
return false;
|
371 |
|
372 |
-
|
373 |
-
/*Compare seession vs current data*/
|
374 |
-
if($this->CompareSessionQuotedData($information)) {
|
375 |
-
$session->setVertexD($information);
|
376 |
-
Mage::getModel('taxce/taxQuote')->getTaxQuote($information_array);
|
377 |
-
}
|
378 |
-
}else {
|
379 |
-
$session->setVertexTQ(1);
|
380 |
-
$session->setVertexD($information);
|
381 |
-
Mage::getModel('taxce/taxQuote')->getTaxQuote($information_array);
|
382 |
-
}
|
383 |
-
/*Calculate*/
|
384 |
-
|
385 |
-
return true;
|
386 |
-
}
|
387 |
-
|
388 |
-
public function CompareSessionQuotedData($current_information_obj) {
|
389 |
-
|
390 |
-
$need_quote = false; // Dont need any update
|
391 |
-
|
392 |
-
$stored_information_obj = $this->getSession()->getVertexD();
|
393 |
-
$stored_information = $stored_information_obj->getData();
|
394 |
-
$current_information = $current_information_obj->getData();
|
395 |
-
$difference = $this->multi_diff($current_information, $stored_information);
|
396 |
-
|
397 |
-
$count_changes_fields=count($difference);
|
398 |
-
|
399 |
-
if ($count_changes_fields){
|
400 |
-
$need_quote = true;
|
401 |
-
|
402 |
-
}
|
403 |
-
if ($count_changes_fields && ( isset($difference['customer_street1'])
|
404 |
-
|| isset($difference['customer_street2'])
|
405 |
-
|| isset($difference['customer_city'])
|
406 |
-
|| isset($difference['customer_region'])
|
407 |
-
|| isset($difference['customer_postcode'])
|
408 |
-
) )
|
409 |
-
$current_information_obj->setTaxAreaId();
|
410 |
-
|
411 |
-
/*$need_quote=true; Always udate quote */
|
412 |
-
return $need_quote;
|
413 |
}
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
foreach ($arr1 as $k => $v) {
|
418 |
-
if (!array_key_exists($k, $arr2)) {
|
419 |
-
$result[$k] = $v;
|
420 |
-
} else {
|
421 |
-
if (is_array($v) && is_array($arr2[$k])) {
|
422 |
-
$diff = $this->multi_diff($v, $arr2[$k]);
|
423 |
-
if (count($diff))
|
424 |
-
$result[$k] = $diff;
|
425 |
-
}elseif ($arr2[$k] != $v) {
|
426 |
-
$result[$k] = $v;
|
427 |
-
}
|
428 |
-
}
|
429 |
-
}
|
430 |
-
foreach ($arr2 as $k => $v) {
|
431 |
-
if (!array_key_exists($k, $arr1)) {
|
432 |
-
$result[$k] = $v;
|
433 |
-
} else {
|
434 |
-
if (is_array($v) && is_array($arr1[$k])) {
|
435 |
-
$diff = $this->multi_diff($v, $arr1[$k]);
|
436 |
-
if (count($diff))
|
437 |
-
$result[$k] = $diff;
|
438 |
-
}elseif ($arr1[$k] != $v) {
|
439 |
-
$result[$k] = $v;
|
440 |
-
}
|
441 |
-
}
|
442 |
-
}
|
443 |
-
return $result;
|
444 |
-
}
|
445 |
-
|
446 |
/* Common function for item preparation */
|
447 |
public function PrepareItem($item, $type='ordered', $original_entity_item=null,$event=null){
|
448 |
$item_data=array();
|
449 |
-
|
450 |
$item_data['product_class']=$this->TaxClassNameByClassId($item->getProduct()->getTaxClassId());
|
451 |
$item_data['product_code']=$item->getSku();
|
|
|
452 |
|
453 |
/* Price */
|
454 |
if ($type=='invoiced')
|
@@ -487,7 +404,7 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
487 |
$item_data=array();
|
488 |
|
489 |
/* @todo move to config */
|
490 |
-
$item_data['product_class']=$this->getGiftWrappingItemClass();
|
491 |
$item_data['product_code']=$this->getGiftWrappingItemCodePrefix().'-'.$item->getSku();
|
492 |
|
493 |
/* Price */
|
@@ -523,23 +440,13 @@ class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
523 |
return $item_data;
|
524 |
}
|
525 |
|
526 |
-
|
527 |
-
|
528 |
if (Mage::app()->getRequest()->getControllerName()!='sales_order_create')
|
529 |
return Mage::getSingleton('checkout/session');
|
530 |
else
|
531 |
return Mage::getSingleton('adminhtml/session_quote');
|
532 |
}
|
533 |
|
534 |
-
public function getTaxByQuoteItemId($item_quote_id){
|
535 |
-
$session=$this->getSession();
|
536 |
-
$ItemsTaxQuoteId=$session->getItemsTaxQuoteId();
|
537 |
-
|
538 |
-
if (isset($ItemsTaxQuoteId[$item_quote_id])) {
|
539 |
-
return $ItemsTaxQuoteId[$item_quote_id];
|
540 |
-
}
|
541 |
-
|
542 |
-
return 0;
|
543 |
-
}
|
544 |
|
545 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
class VertexSMB_TaxCE_Helper_Data extends Mage_Core_Helper_Abstract {
|
9 |
|
10 |
+
public function IsVertexSMBActive(){
|
11 |
if (Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::CONFIG_XML_PATH_ENABLE_VERTEX, Mage::app()->getStore()->getId()))
|
12 |
return true;
|
13 |
return false;
|
43 |
return VertexSMB_TaxCE_Helper_Config::CONFIG_XML_PATH_VERTEX_TRANSACTION_TYPE;
|
44 |
}
|
45 |
public function getVertexHost(){
|
46 |
+
return Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::VERTEX_API_HOST, Mage::app()->getStore()->getId());
|
47 |
}
|
48 |
public function getVertexAddressHost(){
|
49 |
+
return Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::VERTEX_ADDRESS_API_HOST, Mage::app()->getStore()->getId());
|
50 |
}
|
51 |
public function getDefaultCustomerCode(){
|
52 |
return Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::CONFIG_XML_PATH_DEFAULT_CUSTOMER_CODE, Mage::app()->getStore()->getId());
|
85 |
return Mage::getStoreConfig(VertexSMB_TaxCE_Helper_Config::VERTEX_PRINTED_GIFTCARD_CODE, Mage::app()->getStore()->getId());
|
86 |
}
|
87 |
public function IsAllowedQuote() {
|
88 |
+
$quote_allowed_controllers=Mage::helper('taxce/config')->getQuoteAllowedControllers();
|
89 |
if ($this->AllowCartQuote())
|
90 |
$quote_allowed_controllers[]='cart';
|
91 |
|
178 |
$regionModel = Mage::getModel('directory/region')->load($region_id);
|
179 |
$company_state=$regionModel->getCode();
|
180 |
|
181 |
+
/*Admin API verification*/
|
182 |
$address=new Varien_Object();
|
183 |
$address->setStreet1($this->getCompanyStreet1());
|
184 |
$address->setStreet2($this->getCompanyStreet2());
|
186 |
$address->setRegionCode($company_state);
|
187 |
$address->setPostcode($this->getCompanyPostalCode());
|
188 |
|
189 |
+
|
190 |
+
$request_result=Mage::getModel('taxce/TaxAreaRequest')->prepareRequest($address)->taxAreaLookup();
|
191 |
+
if ($request_result instanceof Exception) {
|
192 |
+
return "Address Validation Error: Please check settings";
|
193 |
}
|
194 |
return "Valid";
|
195 |
}
|
196 |
|
197 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
/* Company Information */
|
199 |
public function AddSellerInformation($data){
|
200 |
|
248 |
|
249 |
if ($creditmemo_model->getAdjustmentPositive()) {
|
250 |
$item_data=array();
|
251 |
+
$item_data['product_class']=$this->TaxClassNameByClassId($this->getCreditmemoAdjustmentPositiveClass());
|
252 |
$item_data['product_code']=$this->getCreditmemoAdjustmentPositiveCode();
|
253 |
$item_data['qty']=1;
|
254 |
$item_data['price']=-1*$creditmemo_model->getAdjustmentPositive();
|
257 |
}
|
258 |
if ($creditmemo_model->getAdjustmentNegative()) {
|
259 |
$item_data=array();
|
260 |
+
$item_data['product_class']=$this->TaxClassNameByClassId($this->getCreditmemoAdjustmentFeeClass());
|
261 |
$item_data['product_code']=$this->getCreditmemoAdjustmentFeeCode();
|
262 |
$item_data['qty']=1;
|
263 |
$item_data['price']=$creditmemo_model->getAdjustmentNegative();
|
273 |
return $item_data;
|
274 |
}
|
275 |
|
276 |
+
$item_data['product_class']=$this->TaxClassNameByClassId($this->getGiftWrappingOrderClass());
|
277 |
$item_data['product_code']=$this->getGiftWrappingOrderCode();
|
278 |
$item_data['qty']=1;
|
279 |
$item_data['price']=$order_address->getGwPrice();
|
294 |
if (!$this->IsFirstOfPartial($order_address,$original_entity)) {
|
295 |
return $item_data;
|
296 |
}
|
297 |
+
$item_data['product_class']=$this->TaxClassNameByClassId($this->getPrintedGiftcardClass());
|
298 |
$item_data['product_code']=$this->getPrintedGiftcardCode();
|
299 |
$item_data['qty']=1;
|
300 |
$item_data['price']=$order_address->getGwCardPrice();
|
336 |
return $item_data;
|
337 |
}
|
338 |
|
339 |
+
/*beta*/
|
340 |
+
/* Tax Quote calculation*/
|
341 |
+
public function TaxQuoteItems($address){
|
342 |
+
$information_array = Mage::getModel('taxce/taxQuote')->collectQuotedata($address);
|
343 |
+
$information= new Varien_Object($information_array);
|
344 |
+
$information->setTaxAreaId();
|
345 |
+
$taxed_items_info=Mage::getModel('taxce/taxQuote')->getTaxQuote($information_array);
|
346 |
+
|
347 |
+
return $taxed_items_info;
|
348 |
+
}
|
349 |
+
|
350 |
+
public function CanQuoteTax(){
|
351 |
if (!$this->IsAllowedQuote() )
|
352 |
+
return false;
|
|
|
353 |
/* disable for index page. */
|
354 |
if ($this->getSourcePath()=='onepage_checkout_index')
|
355 |
return false;
|
356 |
|
357 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
358 |
}
|
359 |
+
/*beta*/
|
360 |
+
|
361 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
/* Common function for item preparation */
|
363 |
public function PrepareItem($item, $type='ordered', $original_entity_item=null,$event=null){
|
364 |
$item_data=array();
|
365 |
+
|
366 |
$item_data['product_class']=$this->TaxClassNameByClassId($item->getProduct()->getTaxClassId());
|
367 |
$item_data['product_code']=$item->getSku();
|
368 |
+
$item_data['item_id']=$item->getId();
|
369 |
|
370 |
/* Price */
|
371 |
if ($type=='invoiced')
|
404 |
$item_data=array();
|
405 |
|
406 |
/* @todo move to config */
|
407 |
+
$item_data['product_class']=$this->TaxClassNameByClassId($this->getGiftWrappingItemClass());
|
408 |
$item_data['product_code']=$this->getGiftWrappingItemCodePrefix().'-'.$item->getSku();
|
409 |
|
410 |
/* Price */
|
440 |
return $item_data;
|
441 |
}
|
442 |
|
443 |
+
/* Used in other files for corrent session & access to quote*/
|
444 |
+
public function getSession(){
|
445 |
if (Mage::app()->getRequest()->getControllerName()!='sales_order_create')
|
446 |
return Mage::getSingleton('checkout/session');
|
447 |
else
|
448 |
return Mage::getSingleton('adminhtml/session_quote');
|
449 |
}
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
|
452 |
}
|
app/code/local/VertexSMB/TaxCE/Model/Observer.php
CHANGED
@@ -1,64 +1,85 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
/**
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @author
|
8 |
-
|
|
|
9 |
class VertexSMB_TaxCE_Model_Observer {
|
10 |
|
|
|
|
|
|
|
|
|
11 |
public function InvoiceCreated(Varien_Event_Observer $observer) {
|
12 |
-
if (!$this->_getHelper()->
|
13 |
return $this;
|
14 |
|
15 |
/* @var $order Magento_Sales_Model_Order_Invoice */
|
16 |
$invoice = $observer->getEvent()->getInvoice();
|
17 |
-
$invoice_request_data=Mage::getModel('
|
18 |
|
19 |
if ($invoice_request_data && Mage::getModel('taxce/taxInvoice')->SendInvoiceRequest($invoice_request_data,$invoice->getOrder()))
|
20 |
-
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex invoice has been sent.'));
|
21 |
|
22 |
return $this;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
25 |
public function OrderSaved(Varien_Event_Observer $observer) {
|
26 |
$order = $observer->getEvent()->getOrder();
|
27 |
-
if (!$this->_getHelper()->
|
28 |
return $this;
|
29 |
|
30 |
$invoice_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($order);
|
31 |
if ($invoice_request_data && Mage::getModel('taxce/taxInvoice')->SendInvoiceRequest($invoice_request_data,$order))
|
32 |
-
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex invoice has been sent.'));
|
33 |
return $this;
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
public function OrderCancelled(Varien_Event_Observer $observer) {
|
37 |
/* Commented upon new logic
|
38 |
* $order = $observer->getEvent()->getOrder();
|
39 |
-
$invoiced_tax= Mage::getModel('
|
40 |
-
if (!$this->_getHelper()->
|
41 |
return $this;
|
42 |
-
$cancel_request_data=Mage::getModel('
|
43 |
-
if ($cancel_request_data && Mage::getModel('
|
44 |
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex invoice has been canceled.'));
|
45 |
*/
|
46 |
return $this;
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
49 |
public function OrderCreditmemoRefund(Varien_Event_Observer $observer){
|
50 |
$credit_memo= $observer->getCreditmemo();
|
51 |
$order=$credit_memo->getOrder();
|
52 |
$invoiced_tax= Mage::getModel('taxce/taxRequest')->getTotalInvoicedTax($order->getId());
|
53 |
-
if (!$this->_getHelper()->
|
54 |
return $this;
|
55 |
$creditmemo_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($credit_memo,'refund');
|
56 |
if ($creditmemo_request_data && Mage::getModel('taxce/taxInvoice')->SendRefundRequest($creditmemo_request_data,$order))
|
57 |
-
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex invoice has been refunded.'));
|
58 |
|
59 |
return $this;
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
62 |
public function changeSystemConfig(Varien_Event_Observer $observer) {
|
63 |
$config = $observer->getConfig();
|
64 |
$config->getNode('sections/tax/groups/calculation/fields/algorithm')->show_in_website=0;
|
@@ -117,6 +138,10 @@ class VertexSMB_TaxCE_Model_Observer {
|
|
117 |
return $this;
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
120 |
public function CleanLogs($schedule){
|
121 |
$request_model = Mage::getModel('taxce/taxRequest');
|
122 |
$request_model->RemoveQuotesLookupRequests();
|
@@ -124,9 +149,13 @@ class VertexSMB_TaxCE_Model_Observer {
|
|
124 |
return $this;
|
125 |
}
|
126 |
|
|
|
|
|
|
|
127 |
public function _getHelper() {
|
128 |
return Mage::helper('taxce');
|
129 |
}
|
|
|
130 |
/**
|
131 |
* Retrieve adminhtml session model object
|
132 |
*
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
+
|
8 |
class VertexSMB_TaxCE_Model_Observer {
|
9 |
|
10 |
+
/**
|
11 |
+
* @param Varien_Event_Observer $observer
|
12 |
+
* @return VertexSMB_TaxCE_Model_Observer
|
13 |
+
*/
|
14 |
public function InvoiceCreated(Varien_Event_Observer $observer) {
|
15 |
+
if (!$this->_getHelper()->IsVertexSMBActive() || !$this->_getHelper()->RequestbyInvoiceCreation())
|
16 |
return $this;
|
17 |
|
18 |
/* @var $order Magento_Sales_Model_Order_Invoice */
|
19 |
$invoice = $observer->getEvent()->getInvoice();
|
20 |
+
$invoice_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($invoice,'invoice');
|
21 |
|
22 |
if ($invoice_request_data && Mage::getModel('taxce/taxInvoice')->SendInvoiceRequest($invoice_request_data,$invoice->getOrder()))
|
23 |
+
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex SMB invoice has been sent.'));
|
24 |
|
25 |
return $this;
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* @param Varien_Event_Observer $observer
|
30 |
+
* @return VertexSMB_TaxCE_Model_Observer
|
31 |
+
*/
|
32 |
public function OrderSaved(Varien_Event_Observer $observer) {
|
33 |
$order = $observer->getEvent()->getOrder();
|
34 |
+
if (!$this->_getHelper()->IsVertexSMBActive() || !$this->_getHelper()->RequestbyOrderStatus($order->getStatus()))
|
35 |
return $this;
|
36 |
|
37 |
$invoice_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($order);
|
38 |
if ($invoice_request_data && Mage::getModel('taxce/taxInvoice')->SendInvoiceRequest($invoice_request_data,$order))
|
39 |
+
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex SMB invoice has been sent.'));
|
40 |
return $this;
|
41 |
}
|
42 |
|
43 |
+
/**
|
44 |
+
* @deprecated
|
45 |
+
* @param Varien_Event_Observer $observer
|
46 |
+
* @return VertexSMB_TaxCE_Model_Observer
|
47 |
+
*/
|
48 |
+
|
49 |
public function OrderCancelled(Varien_Event_Observer $observer) {
|
50 |
/* Commented upon new logic
|
51 |
* $order = $observer->getEvent()->getOrder();
|
52 |
+
$invoiced_tax= Mage::getModel('vertex/taxrequest')->getTotalInvoicedTax($order->getId());
|
53 |
+
if (!$this->_getHelper()->IsVertexSMBActive() || !$invoiced_tax)
|
54 |
return $this;
|
55 |
+
$cancel_request_data=Mage::getModel('vertex/taxInvoice')->PrepareInvoiceData($order,'cancel');
|
56 |
+
if ($cancel_request_data && Mage::getModel('vertex/taxInvoice')->SendCancelRequest($cancel_request_data,$order))
|
57 |
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex invoice has been canceled.'));
|
58 |
*/
|
59 |
return $this;
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* @param Varien_Event_Observer $observer
|
64 |
+
* @return VertexSMB_TaxCE_Model_Observer
|
65 |
+
*/
|
66 |
public function OrderCreditmemoRefund(Varien_Event_Observer $observer){
|
67 |
$credit_memo= $observer->getCreditmemo();
|
68 |
$order=$credit_memo->getOrder();
|
69 |
$invoiced_tax= Mage::getModel('taxce/taxRequest')->getTotalInvoicedTax($order->getId());
|
70 |
+
if (!$this->_getHelper()->IsVertexSMBActive() || !$invoiced_tax)
|
71 |
return $this;
|
72 |
$creditmemo_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($credit_memo,'refund');
|
73 |
if ($creditmemo_request_data && Mage::getModel('taxce/taxInvoice')->SendRefundRequest($creditmemo_request_data,$order))
|
74 |
+
$this->_getSession()->addSuccess( $this->_getHelper()->__('The Vertex SMB invoice has been refunded.'));
|
75 |
|
76 |
return $this;
|
77 |
}
|
78 |
|
79 |
+
/**
|
80 |
+
* @param Varien_Event_Observer $observer
|
81 |
+
* @return VertexSMB_TaxCE_Model_Observer
|
82 |
+
*/
|
83 |
public function changeSystemConfig(Varien_Event_Observer $observer) {
|
84 |
$config = $observer->getConfig();
|
85 |
$config->getNode('sections/tax/groups/calculation/fields/algorithm')->show_in_website=0;
|
138 |
return $this;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @param unknown $schedule
|
143 |
+
* @return VertexSMB_TaxCE_Model_Observer
|
144 |
+
*/
|
145 |
public function CleanLogs($schedule){
|
146 |
$request_model = Mage::getModel('taxce/taxRequest');
|
147 |
$request_model->RemoveQuotesLookupRequests();
|
149 |
return $this;
|
150 |
}
|
151 |
|
152 |
+
/**
|
153 |
+
* @return VertexSMB_TaxCE_Helper_Data
|
154 |
+
*/
|
155 |
public function _getHelper() {
|
156 |
return Mage::helper('taxce');
|
157 |
}
|
158 |
+
|
159 |
/**
|
160 |
* Retrieve adminhtml session model object
|
161 |
*
|
app/code/local/VertexSMB/TaxCE/Model/RequestItem.php
CHANGED
@@ -1,5 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Model_RequestItem extends Mage_Core_Model_Abstract {
|
4 |
|
5 |
public function _construct()
|
@@ -10,6 +16,7 @@
|
|
10 |
public function getHelper() {
|
11 |
return Mage::helper('taxce');
|
12 |
}
|
|
|
13 |
/* RequestType:
|
14 |
* TaxAreaRequest
|
15 |
* InvoiceRequest
|
@@ -42,7 +49,7 @@
|
|
42 |
$i=1; /* lineItemNumber */
|
43 |
foreach($items as $key=>$item){
|
44 |
/* $key - quote_item_id */
|
45 |
-
$tmp_item=array('lineItemNumber'=>$i, 'locationCode'=>$this->getLocationCode(),
|
46 |
'Seller'=> array (
|
47 |
'Company'=> $this->getCompanyId(),
|
48 |
'PhysicalOrigin'=>array(
|
@@ -70,7 +77,8 @@
|
|
70 |
|
71 |
if ($this->getTaxAreaId())
|
72 |
$tmp_item['Customer']['Destination']['taxAreaId']=$this->getTaxAreaId();
|
73 |
-
|
|
|
74 |
$query_items[]=$tmp_item;
|
75 |
$i++;
|
76 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
+
|
8 |
+
|
9 |
class VertexSMB_TaxCE_Model_RequestItem extends Mage_Core_Model_Abstract {
|
10 |
|
11 |
public function _construct()
|
16 |
public function getHelper() {
|
17 |
return Mage::helper('taxce');
|
18 |
}
|
19 |
+
|
20 |
/* RequestType:
|
21 |
* TaxAreaRequest
|
22 |
* InvoiceRequest
|
49 |
$i=1; /* lineItemNumber */
|
50 |
foreach($items as $key=>$item){
|
51 |
/* $key - quote_item_id */
|
52 |
+
$tmp_item=array('lineItemNumber'=>$i,'lineItemId'=>$key, 'locationCode'=>$this->getLocationCode(),
|
53 |
'Seller'=> array (
|
54 |
'Company'=> $this->getCompanyId(),
|
55 |
'PhysicalOrigin'=>array(
|
77 |
|
78 |
if ($this->getTaxAreaId())
|
79 |
$tmp_item['Customer']['Destination']['taxAreaId']=$this->getTaxAreaId();
|
80 |
+
|
81 |
+
|
82 |
$query_items[]=$tmp_item;
|
83 |
$i++;
|
84 |
}
|
app/code/local/VertexSMB/TaxCE/Model/Resource/Setup.php
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
public function attributeExists($entityTypeId, $attributeId) {
|
6 |
try {
|
7 |
$entityTypeId = $this->getEntityTypeId($entityTypeId);
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
+
|
8 |
+
|
9 |
class VertexSMB_TaxCE_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
|
10 |
|
11 |
+
/**
|
12 |
+
* @param unknown $entityTypeId
|
13 |
+
* @param unknown $attributeId
|
14 |
+
* @return boolean
|
15 |
+
*/
|
16 |
public function attributeExists($entityTypeId, $attributeId) {
|
17 |
try {
|
18 |
$entityTypeId = $this->getEntityTypeId($entityTypeId);
|
app/code/local/VertexSMB/TaxCE/Model/Resource/TaxRequest.php
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class VertexSMB_TaxCE_Model_Resource_TaxRequest extends Mage_Core_Model_Resource_Db_Abstract {
|
4 |
|
5 |
-
|
6 |
* Resource initialization
|
7 |
-
|
8 |
-
*/
|
9 |
public function _construct()
|
10 |
{
|
11 |
$this->_init('taxce/taxrequest', 'request_id');
|
12 |
}
|
13 |
|
14 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
|
8 |
class VertexSMB_TaxCE_Model_Resource_TaxRequest extends Mage_Core_Model_Resource_Db_Abstract {
|
9 |
|
10 |
+
/**
|
11 |
* Resource initialization
|
12 |
+
**/
|
|
|
13 |
public function _construct()
|
14 |
{
|
15 |
$this->_init('taxce/taxrequest', 'request_id');
|
16 |
}
|
17 |
|
18 |
+
}
|
app/code/local/VertexSMB/TaxCE/Model/Resource/TaxRequest/Collection.php
CHANGED
@@ -1,18 +1,23 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
/**
|
6 |
* Resource initialization
|
7 |
*/
|
8 |
public function _construct()
|
9 |
{
|
10 |
-
$this->_init('taxce/
|
11 |
}
|
12 |
|
13 |
/**
|
14 |
-
* Add request type filter to result
|
15 |
-
*
|
16 |
*/
|
17 |
public function setRequestTypeFilter($requestType)
|
18 |
{
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @copyright Copyright (c) 2015 Net@Work (http://www.netatwork.com)
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
|
9 |
+
class VertexSMB_TaxCE_Model_Resource_Taxrequest_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
10 |
|
11 |
/**
|
12 |
* Resource initialization
|
13 |
*/
|
14 |
public function _construct()
|
15 |
{
|
16 |
+
$this->_init('taxce/taxrequest');
|
17 |
}
|
18 |
|
19 |
/**
|
20 |
+
* Add request type filter to result
|
|
|
21 |
*/
|
22 |
public function setRequestTypeFilter($requestType)
|
23 |
{
|
app/code/local/VertexSMB/TaxCE/Model/Source/Taxinvoice.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Model_Source_Taxinvoice {
|
4 |
protected $_options;
|
5 |
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
+
|
8 |
class VertexSMB_TaxCE_Model_Source_Taxinvoice {
|
9 |
protected $_options;
|
10 |
|
app/code/local/VertexSMB/TaxCE/Model/Source/Usregions.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Model_Source_Usregions {
|
4 |
|
5 |
protected $_countries;
|
@@ -32,11 +37,14 @@ class VertexSMB_TaxCE_Model_Source_Usregions {
|
|
32 |
$this->_options[] = array('label'=>$this->_countries[$countryId], 'value'=>$regionOptions);
|
33 |
}
|
34 |
}
|
35 |
-
$options = $this->_options;
|
36 |
-
if(!$isMultiselect){
|
37 |
-
array_unshift($options);
|
38 |
-
}
|
39 |
|
40 |
return $options;
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
+
|
8 |
class VertexSMB_TaxCE_Model_Source_Usregions {
|
9 |
|
10 |
protected $_countries;
|
37 |
$this->_options[] = array('label'=>$this->_countries[$countryId], 'value'=>$regionOptions);
|
38 |
}
|
39 |
}
|
40 |
+
$options = $this->_options;
|
|
|
|
|
|
|
41 |
|
42 |
return $options;
|
43 |
}
|
44 |
+
|
45 |
+
public function sortRegionCountries($a, $b)
|
46 |
+
{
|
47 |
+
return strcmp($this->_countries[$a], $this->_countries[$b]);
|
48 |
+
}
|
49 |
+
|
50 |
}
|
app/code/local/VertexSMB/TaxCE/Model/Tax/Sales/Total/Quote/Tax.php
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax {
|
5 |
|
6 |
/**
|
@@ -11,7 +15,7 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
11 |
*/
|
12 |
public function collect(Mage_Sales_Model_Quote_Address $address)
|
13 |
{
|
14 |
-
if (!Mage::helper('taxce')->
|
15 |
parent::collect($address);
|
16 |
return $this;
|
17 |
}
|
@@ -21,12 +25,12 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
21 |
|
22 |
if ($address->getQuote()->isVirtual() && $address_type=='shipping'){
|
23 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
24 |
-
Mage::log("Quote request was not sent. Address Type: ".$address_type.", Order is virtual. ", null, '
|
25 |
return $this;
|
26 |
}
|
27 |
if (!$address->getQuote()->isVirtual() && !$address->getShippingMethod()) {
|
28 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
29 |
-
Mage::log("Quote request was not sent. Order is not virtual and doesnt have shipping address. ", null, '
|
30 |
return $this;
|
31 |
}
|
32 |
/* Commented before */
|
@@ -36,29 +40,31 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
36 |
} */
|
37 |
if ( !$address->getStreet1() && !Mage::helper('taxce')->AllowCartQuote() ) {
|
38 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
39 |
-
Mage::log("Quote request was not sent. Address Street not specified. ", null, '
|
40 |
return $this;
|
41 |
}
|
42 |
|
43 |
if (!$address->getCountryId() || !$address->getRegionId() || !$address->getPostcode() || !count($address->getAllNonNominalItems())) {
|
44 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
45 |
-
Mage::log("Quote request was not sent. Address not specified. ", null, '
|
46 |
return $this;
|
47 |
}
|
48 |
|
49 |
-
|
|
|
|
|
50 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
51 |
-
Mage::log("Quote request was not sent. Address area id not specified yet. ", null, '
|
52 |
return $this;
|
53 |
}
|
54 |
|
55 |
-
/*Vertex*/
|
56 |
-
if (!Mage::helper('taxce')->
|
57 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
58 |
-
Mage::log("Quote request
|
59 |
return $this;
|
60 |
}
|
61 |
-
/*Vertex*/
|
62 |
|
63 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
64 |
$this->_roundingDeltas = array();
|
@@ -97,11 +103,16 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
97 |
);
|
98 |
}
|
99 |
|
|
|
|
|
|
|
|
|
|
|
100 |
$this->_rowBaseCalculation($address, $request);
|
101 |
$this->_addAmount($address->getExtraTaxAmount());
|
102 |
$this->_addBaseAmount($address->getBaseExtraTaxAmount());
|
103 |
/* Shipping Tax */
|
104 |
-
|
105 |
/* Shipping Tax */
|
106 |
|
107 |
$this->_processHiddenTaxes();
|
@@ -111,16 +122,21 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
111 |
}
|
112 |
|
113 |
|
|
|
|
|
|
|
114 |
protected function _rowBaseCalculation(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
|
115 |
{
|
116 |
-
if (!Mage::helper('taxce')->
|
117 |
parent::_rowBaseCalculation( $address, $taxRateRequest);
|
118 |
return $this;
|
119 |
}
|
120 |
|
121 |
$items = $this->_getAddressItems($address);
|
122 |
$itemTaxGroups = array();
|
123 |
-
|
|
|
|
|
124 |
foreach ($items as $item) {
|
125 |
if ($item->getParentItem()) {
|
126 |
continue;
|
@@ -129,7 +145,7 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
129 |
foreach ($item->getChildren() as $child) {
|
130 |
$taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId());
|
131 |
$rate = $this->_calculator->getRate($taxRateRequest);
|
132 |
-
$this->_calcRowTaxAmount($child, $
|
133 |
$this->_addAmount($child->getTaxAmount());
|
134 |
$this->_addBaseAmount($child->getBaseTaxAmount());
|
135 |
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
@@ -150,7 +166,7 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
150 |
else {
|
151 |
$taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId());
|
152 |
$rate = $this->_calculator->getRate($taxRateRequest);
|
153 |
-
$this->_calcRowTaxAmount($item, $
|
154 |
$this->_addAmount($item->getTaxAmount());
|
155 |
$this->_addBaseAmount($item->getBaseTaxAmount());
|
156 |
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
@@ -176,32 +192,33 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
176 |
}
|
177 |
|
178 |
|
179 |
-
|
|
|
|
|
|
|
|
|
180 |
{
|
181 |
-
/* Vertex */
|
182 |
-
if (!Mage::helper('taxce')->
|
183 |
parent::_calcRowTaxAmount($item, $rate);
|
184 |
return $this;
|
185 |
}
|
186 |
|
187 |
$subtotal = $taxSubtotal = $item->getTaxableAmount();
|
188 |
$baseSubtotal = $baseTaxSubtotal = $item->getBaseTaxableAmount();
|
189 |
-
|
190 |
-
$
|
|
|
|
|
191 |
if ($ItemTax instanceof Varien_Object ){
|
192 |
$rowTax=$ItemTax->getTaxAmount();
|
193 |
$baseRowTax=$ItemTax->getBaseTaxAmount();
|
194 |
-
$
|
195 |
-
|
196 |
-
|
197 |
-
Mage::log("ItemTax is not instance of Varien_Object. ", null, 'taxce.log');
|
198 |
-
$rowTax=0;
|
199 |
-
$baseRowTax=0;
|
200 |
-
$rate=0;
|
201 |
-
}
|
202 |
/* Vertex */
|
203 |
|
204 |
-
$item->setTaxPercent($
|
205 |
$item->setTaxAmount(max(0, $rowTax));
|
206 |
$item->setBaseTaxAmount(max(0, $baseRowTax));
|
207 |
$rowTotalInclTax = $item->getRowTotalInclTax();
|
@@ -223,24 +240,37 @@ class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sal
|
|
223 |
return $this;
|
224 |
}
|
225 |
|
|
|
|
|
|
|
226 |
protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
|
227 |
{
|
228 |
-
if (!Mage::helper('taxce')->
|
229 |
parent::_calculateShippingTax($address, $taxRateRequest);
|
230 |
return $this;
|
231 |
}
|
|
|
|
|
|
|
|
|
232 |
$taxRateRequest->setProductClassId($this->_config->getShippingTaxClass($this->_store));
|
233 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
if ($shipping_tax instanceof Varien_Object ){
|
235 |
$tax=$shipping_tax->getTaxAmount();
|
236 |
$baseTax=$shipping_tax->getBaseTaxAmount();
|
237 |
$rate=$shipping_tax->getTaxPercent();
|
238 |
-
}else
|
239 |
-
Mage::log("shipping_tax is not instance of Varien_Object. ", null, '
|
240 |
-
|
241 |
-
$baseTax=0;
|
242 |
-
$rate=0;
|
243 |
-
}
|
244 |
$this->_addAmount(max(0, $tax));
|
245 |
$this->_addBaseAmount(max(0, $baseTax));
|
246 |
$address->setShippingTaxAmount(max(0, $tax));
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
**/
|
7 |
|
|
|
8 |
class VertexSMB_TaxCE_Model_Tax_Sales_Total_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax {
|
9 |
|
10 |
/**
|
15 |
*/
|
16 |
public function collect(Mage_Sales_Model_Quote_Address $address)
|
17 |
{
|
18 |
+
if (!Mage::helper('taxce')->IsVertexSMBActive()) {
|
19 |
parent::collect($address);
|
20 |
return $this;
|
21 |
}
|
25 |
|
26 |
if ($address->getQuote()->isVirtual() && $address_type=='shipping'){
|
27 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
28 |
+
Mage::log("Quote request was not sent. Address Type: ".$address_type.", Order is virtual. ", null, 'vertexsmb.log');
|
29 |
return $this;
|
30 |
}
|
31 |
if (!$address->getQuote()->isVirtual() && !$address->getShippingMethod()) {
|
32 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
33 |
+
Mage::log("Quote request was not sent. Order is not virtual and doesnt have shipping address. ", null, 'vertexsmb.log');
|
34 |
return $this;
|
35 |
}
|
36 |
/* Commented before */
|
40 |
} */
|
41 |
if ( !$address->getStreet1() && !Mage::helper('taxce')->AllowCartQuote() ) {
|
42 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
43 |
+
Mage::log("Quote request was not sent. Address Street not specified. ", null, 'vertexsmb.log');
|
44 |
return $this;
|
45 |
}
|
46 |
|
47 |
if (!$address->getCountryId() || !$address->getRegionId() || !$address->getPostcode() || !count($address->getAllNonNominalItems())) {
|
48 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
49 |
+
Mage::log("Quote request was not sent. Address not specified. ", null, 'vertexsmb.log');
|
50 |
return $this;
|
51 |
}
|
52 |
|
53 |
+
|
54 |
+
|
55 |
+
if (!$address->getTaxAreaId() && !Mage::helper('taxce')->AllowCartQuote() ) {
|
56 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
57 |
+
Mage::log("Quote request was not sent. Address area id not specified yet. ", null, 'vertexsmb.log');
|
58 |
return $this;
|
59 |
}
|
60 |
|
61 |
+
/*Vertex SMB */
|
62 |
+
if (!Mage::helper('taxce')->CanQuoteTax()) {
|
63 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
64 |
+
Mage::log("Quote request not have enought information", null, 'vertexsmb.log');
|
65 |
return $this;
|
66 |
}
|
67 |
+
/*Vertex SMB*/
|
68 |
|
69 |
Mage_Sales_Model_Quote_Address_Total_Abstract::collect($address);
|
70 |
$this->_roundingDeltas = array();
|
103 |
);
|
104 |
}
|
105 |
|
106 |
+
/*beta*/
|
107 |
+
$itemsVertexTaxes=Mage::helper('taxce')->TaxQuoteItems($address);
|
108 |
+
$request->setItemsVertexTax($itemsVertexTaxes);
|
109 |
+
/*beta*/
|
110 |
+
|
111 |
$this->_rowBaseCalculation($address, $request);
|
112 |
$this->_addAmount($address->getExtraTaxAmount());
|
113 |
$this->_addBaseAmount($address->getBaseExtraTaxAmount());
|
114 |
/* Shipping Tax */
|
115 |
+
$this->_calculateShippingTax($address,$request);
|
116 |
/* Shipping Tax */
|
117 |
|
118 |
$this->_processHiddenTaxes();
|
122 |
}
|
123 |
|
124 |
|
125 |
+
/* (non-PHPdoc)
|
126 |
+
* @see Mage_Tax_Model_Sales_Total_Quote_Tax::_rowBaseCalculation()
|
127 |
+
*/
|
128 |
protected function _rowBaseCalculation(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
|
129 |
{
|
130 |
+
if (!Mage::helper('taxce')->IsVertexSMBActive()) {
|
131 |
parent::_rowBaseCalculation( $address, $taxRateRequest);
|
132 |
return $this;
|
133 |
}
|
134 |
|
135 |
$items = $this->_getAddressItems($address);
|
136 |
$itemTaxGroups = array();
|
137 |
+
/*beta*/
|
138 |
+
$itemsVertexTaxes=$taxRateRequest->getItemsVertexTax();
|
139 |
+
/*beta*/
|
140 |
foreach ($items as $item) {
|
141 |
if ($item->getParentItem()) {
|
142 |
continue;
|
145 |
foreach ($item->getChildren() as $child) {
|
146 |
$taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId());
|
147 |
$rate = $this->_calculator->getRate($taxRateRequest);
|
148 |
+
$this->_calcRowTaxAmount($child, $itemsVertexTaxes);
|
149 |
$this->_addAmount($child->getTaxAmount());
|
150 |
$this->_addBaseAmount($child->getBaseTaxAmount());
|
151 |
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
166 |
else {
|
167 |
$taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId());
|
168 |
$rate = $this->_calculator->getRate($taxRateRequest);
|
169 |
+
$this->_calcRowTaxAmount($item, $itemsVertexTaxes);
|
170 |
$this->_addAmount($item->getTaxAmount());
|
171 |
$this->_addBaseAmount($item->getBaseTaxAmount());
|
172 |
$applied = $this->_calculator->getAppliedRates($taxRateRequest);
|
192 |
}
|
193 |
|
194 |
|
195 |
+
|
196 |
+
/* (non-PHPdoc)
|
197 |
+
* @see Mage_Tax_Model_Sales_Total_Quote_Tax::_calcRowTaxAmount()
|
198 |
+
*/
|
199 |
+
protected function _calcRowTaxAmount( $item, $rate, &$taxGroups = null, $taxId = null, $recalculateRowTotalInclTax = false )
|
200 |
{
|
201 |
+
/* Vertex SMB*/
|
202 |
+
if (!Mage::helper('taxce')->IsVertexSMBActive()) {
|
203 |
parent::_calcRowTaxAmount($item, $rate);
|
204 |
return $this;
|
205 |
}
|
206 |
|
207 |
$subtotal = $taxSubtotal = $item->getTaxableAmount();
|
208 |
$baseSubtotal = $baseTaxSubtotal = $item->getBaseTaxableAmount();
|
209 |
+
$rowTax=0;
|
210 |
+
$baseRowTax=0;
|
211 |
+
$taxRate=0;
|
212 |
+
$ItemTax= $rate[$item->getId()];
|
213 |
if ($ItemTax instanceof Varien_Object ){
|
214 |
$rowTax=$ItemTax->getTaxAmount();
|
215 |
$baseRowTax=$ItemTax->getBaseTaxAmount();
|
216 |
+
$taxRate=$ItemTax->getTaxPercent();
|
217 |
+
} else
|
218 |
+
Mage::log("ItemTax is not instance of Varien_Object. ", null, 'vertexsmb.log');
|
|
|
|
|
|
|
|
|
|
|
219 |
/* Vertex */
|
220 |
|
221 |
+
$item->setTaxPercent($taxRate);
|
222 |
$item->setTaxAmount(max(0, $rowTax));
|
223 |
$item->setBaseTaxAmount(max(0, $baseRowTax));
|
224 |
$rowTotalInclTax = $item->getRowTotalInclTax();
|
240 |
return $this;
|
241 |
}
|
242 |
|
243 |
+
/* (non-PHPdoc)
|
244 |
+
* @see Mage_Tax_Model_Sales_Total_Quote_Tax::_calculateShippingTax()
|
245 |
+
*/
|
246 |
protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
|
247 |
{
|
248 |
+
if (!Mage::helper('taxce')->IsVertexSMBActive()) {
|
249 |
parent::_calculateShippingTax($address, $taxRateRequest);
|
250 |
return $this;
|
251 |
}
|
252 |
+
/*beta*/
|
253 |
+
$itemsVertexTaxes=$taxRateRequest->getItemsVertexTax();
|
254 |
+
/*beta*/
|
255 |
+
|
256 |
$taxRateRequest->setProductClassId($this->_config->getShippingTaxClass($this->_store));
|
257 |
+
$tax=0;
|
258 |
+
$baseTax=0;
|
259 |
+
$rate=0;
|
260 |
+
$shipping_tax=0;
|
261 |
+
|
262 |
+
if (is_array($itemsVertexTaxes) && array_key_exists('shipping',$itemsVertexTaxes))
|
263 |
+
$shipping_tax= $itemsVertexTaxes['shipping'] ;
|
264 |
+
|
265 |
+
Mage::log($itemsVertexTaxes, null, 'vertexsmb.log');
|
266 |
+
|
267 |
if ($shipping_tax instanceof Varien_Object ){
|
268 |
$tax=$shipping_tax->getTaxAmount();
|
269 |
$baseTax=$shipping_tax->getBaseTaxAmount();
|
270 |
$rate=$shipping_tax->getTaxPercent();
|
271 |
+
}else
|
272 |
+
Mage::log("shipping_tax is not instance of Varien_Object. ", null, 'vertexsmb.log');
|
273 |
+
|
|
|
|
|
|
|
274 |
$this->_addAmount(max(0, $tax));
|
275 |
$this->_addBaseAmount(max(0, $baseTax));
|
276 |
$address->setShippingTaxAmount(max(0, $tax));
|
app/code/local/VertexSMB/TaxCE/Model/TaxAreaRequest.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
+
class VertexSMB_TaxCE_Model_TaxAreaRequest extends Mage_Core_Model_Abstract {
|
9 |
+
|
10 |
+
public function prepareRequest($address) {
|
11 |
+
$request=array(
|
12 |
+
'Login'=>array('TrustedId'=>$this->getHelper()->getTrustedId()),
|
13 |
+
'TaxAreaRequest'=>array(
|
14 |
+
'TaxAreaLookup'=> array(
|
15 |
+
'PostalAddress'=>array(
|
16 |
+
'StreetAddress1'=>$address->getStreet1(),
|
17 |
+
'StreetAddress2'=>$address->getStreet2(),
|
18 |
+
'City'=>$address->getCity(),
|
19 |
+
'MainDivision'=>$address->getRegionCode(),
|
20 |
+
'PostalCode'=>$address->getPostcode(),
|
21 |
+
)
|
22 |
+
)
|
23 |
+
)
|
24 |
+
);
|
25 |
+
|
26 |
+
$this->setRequest($request);
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function taxAreaLookup(){
|
31 |
+
|
32 |
+
if (!$this->getRequest()) {
|
33 |
+
Mage::log("Tax area lookup error: request information not exist", null, 'vertexsmb.log');
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
$request_result=Mage::getModel('taxce/vertexSMB')->SendApiRequest($this->getRequest(),null, 'tax_area_lookup');
|
38 |
+
if ($request_result instanceof Exception) {
|
39 |
+
Mage::log("Tax Area Lookup Error: ".$request_result->getMessage(), null, 'vertexsmb.log');
|
40 |
+
return $request_result;
|
41 |
+
}
|
42 |
+
|
43 |
+
$response=Mage::getModel('taxce/TaxAreaResponse')->parseResponse($request_result);
|
44 |
+
$this->setResponse($response);
|
45 |
+
|
46 |
+
return $request_result;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getHelper() {
|
50 |
+
return Mage::helper('taxce');
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
app/code/local/VertexSMB/TaxCE/Model/TaxAreaResponse.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
+
class VertexSMB_TaxCE_Model_TaxAreaResponse extends Mage_Core_Model_Abstract {
|
9 |
+
|
10 |
+
|
11 |
+
public function parseResponse($response_object){
|
12 |
+
if (is_array($response_object->TaxAreaResponse->TaxAreaResult))
|
13 |
+
$taxAreaResults=$response_object->TaxAreaResponse->TaxAreaResult;
|
14 |
+
else
|
15 |
+
$taxAreaResults[]=$response_object->TaxAreaResponse->TaxAreaResult;
|
16 |
+
|
17 |
+
$this->setTaxAreaResults($taxAreaResults);
|
18 |
+
$this->setResultsCount(count($taxAreaResults));
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function GetFirstTaxAreaInfo(){
|
23 |
+
$TaxAreaFirstResults=$this->getTaxAreaResults();
|
24 |
+
$TaxAreaFirstResult=$TaxAreaFirstResults[0];
|
25 |
+
$TaxAreInfoFirst=new Varien_Object;
|
26 |
+
$TaxAreInfoFirst->setTaxAreaId($TaxAreaFirstResult->taxAreaId);
|
27 |
+
$TaxAreInfoFirst->setCity($TaxAreaFirstResult->PostalAddress->City);
|
28 |
+
return $TaxAreInfoFirst;
|
29 |
+
}
|
30 |
+
}
|
app/code/local/VertexSMB/TaxCE/Model/TaxInvoice.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
/**
|
5 |
-
*
|
6 |
-
*
|
7 |
-
* @author
|
8 |
*/
|
|
|
|
|
9 |
class VertexSMB_TaxCE_Model_TaxInvoice extends Mage_Core_Model_Abstract {
|
10 |
|
11 |
public function _construct()
|
@@ -103,9 +103,9 @@
|
|
103 |
|
104 |
if (Mage::getConfig ()->getModuleConfig ( 'Enterprise_GiftWrapping' )
|
105 |
&& Mage::getConfig ()->getModuleConfig ( 'Enterprise_GiftWrapping' )->is('active', 'true') ) {
|
106 |
-
if (
|
107 |
$order_items[]=$this->getHelper()->AddOrderGiftWrap($order,$entity_item,$event);
|
108 |
-
if (
|
109 |
$order_items[]=$this->getHelper()->AddOrderPrintCard($order,$entity_item,$event);
|
110 |
}
|
111 |
/* Get Items Information*/
|
@@ -123,14 +123,14 @@
|
|
123 |
if ($order==null)
|
124 |
$order=Mage::registry('current_order');
|
125 |
|
126 |
-
$request_result=Mage::getModel('taxce/
|
127 |
if ($request_result instanceof Exception) {
|
128 |
-
Mage::log("Invoice Request Error: ".$request_result->getMessage(), null, '
|
129 |
Mage::getSingleton('adminhtml/session')->addError($request_result->getMessage());
|
130 |
return false;
|
131 |
}
|
132 |
|
133 |
-
$order->addStatusHistoryComment('Vertex Invoice sent successfully. Amount: $'.$request_result->InvoiceResponse->TotalTax->_, false)->save();
|
134 |
return true;
|
135 |
}
|
136 |
|
@@ -139,27 +139,27 @@
|
|
139 |
if ($order==null)
|
140 |
$order=Mage::registry('current_order');
|
141 |
|
142 |
-
$request_result=Mage::getModel('taxce/
|
143 |
if ($request_result instanceof Exception) {
|
144 |
-
Mage::log("Cancel Request Error: ".$request_result->getMessage(), null, '
|
145 |
Mage::getSingleton('adminhtml/session')->addError($request_result->getMessage());
|
146 |
return false;
|
147 |
}
|
148 |
|
149 |
-
$order->addStatusHistoryComment('Vertex Invoice canceled successfully. Amount: $'.$request_result->InvoiceResponse->TotalTax->_, false)->save();
|
150 |
return true;
|
151 |
}
|
152 |
/* Cancel Request Preparation*/
|
153 |
public function SendRefundRequest($data,$order=null){
|
154 |
if ($order==null)
|
155 |
$order=Mage::registry('current_order');
|
156 |
-
$request_result=Mage::getModel('taxce/
|
157 |
if ($request_result instanceof Exception) {
|
158 |
-
Mage::log("Refund Request Error: ".$request_result->getMessage(), null, '
|
159 |
Mage::getSingleton('adminhtml/session')->addError($request_result->getMessage());
|
160 |
return false;
|
161 |
}
|
162 |
-
$order->addStatusHistoryComment('Vertex Invoice refunded successfully. Amount: $'.$request_result->InvoiceResponse->TotalTax->_, false)->save();
|
163 |
return true;
|
164 |
}
|
165 |
|
1 |
<?php
|
|
|
|
|
2 |
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
*/
|
7 |
+
|
8 |
+
|
9 |
class VertexSMB_TaxCE_Model_TaxInvoice extends Mage_Core_Model_Abstract {
|
10 |
|
11 |
public function _construct()
|
103 |
|
104 |
if (Mage::getConfig ()->getModuleConfig ( 'Enterprise_GiftWrapping' )
|
105 |
&& Mage::getConfig ()->getModuleConfig ( 'Enterprise_GiftWrapping' )->is('active', 'true') ) {
|
106 |
+
if (count($this->getHelper()->AddOrderGiftWrap($order,$entity_item,$event)))
|
107 |
$order_items[]=$this->getHelper()->AddOrderGiftWrap($order,$entity_item,$event);
|
108 |
+
if (count($this->getHelper()->AddOrderPrintCard($order,$entity_item,$event)))
|
109 |
$order_items[]=$this->getHelper()->AddOrderPrintCard($order,$entity_item,$event);
|
110 |
}
|
111 |
/* Get Items Information*/
|
123 |
if ($order==null)
|
124 |
$order=Mage::registry('current_order');
|
125 |
|
126 |
+
$request_result=Mage::getModel('taxce/vertexSMB')->SendApiRequest($data,$order,'invoice');
|
127 |
if ($request_result instanceof Exception) {
|
128 |
+
Mage::log("Invoice Request Error: ".$request_result->getMessage(), null, 'vertexsmb.log');
|
129 |
Mage::getSingleton('adminhtml/session')->addError($request_result->getMessage());
|
130 |
return false;
|
131 |
}
|
132 |
|
133 |
+
$order->addStatusHistoryComment('Vertex SMB Invoice sent successfully. Amount: $'.$request_result->InvoiceResponse->TotalTax->_, false)->save();
|
134 |
return true;
|
135 |
}
|
136 |
|
139 |
if ($order==null)
|
140 |
$order=Mage::registry('current_order');
|
141 |
|
142 |
+
$request_result=Mage::getModel('taxce/vertexSMB')->SendApiRequest($data,$order,'invoice_cancel');
|
143 |
if ($request_result instanceof Exception) {
|
144 |
+
Mage::log("Cancel Request Error: ".$request_result->getMessage(), null, 'vertexsmb.log');
|
145 |
Mage::getSingleton('adminhtml/session')->addError($request_result->getMessage());
|
146 |
return false;
|
147 |
}
|
148 |
|
149 |
+
$order->addStatusHistoryComment('Vertex SMB Invoice canceled successfully. Amount: $'.$request_result->InvoiceResponse->TotalTax->_, false)->save();
|
150 |
return true;
|
151 |
}
|
152 |
/* Cancel Request Preparation*/
|
153 |
public function SendRefundRequest($data,$order=null){
|
154 |
if ($order==null)
|
155 |
$order=Mage::registry('current_order');
|
156 |
+
$request_result=Mage::getModel('taxce/vertexSMB')->SendApiRequest($data,$order,'invoice_refund');
|
157 |
if ($request_result instanceof Exception) {
|
158 |
+
Mage::log("Refund Request Error: ".$request_result->getMessage(), null, 'vertexsmb.log');
|
159 |
Mage::getSingleton('adminhtml/session')->addError($request_result->getMessage());
|
160 |
return false;
|
161 |
}
|
162 |
+
$order->addStatusHistoryComment('Vertex SMB Invoice refunded successfully. Amount: $'.$request_result->InvoiceResponse->TotalTax->_, false)->save();
|
163 |
return true;
|
164 |
}
|
165 |
|
app/code/local/VertexSMB/TaxCE/Model/TaxQuote.php
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
class VertexSMB_TaxCE_Model_TaxQuote extends Mage_Core_Model_Abstract {
|
4 |
-
|
5 |
-
private $_ItemsTaxLines=array();
|
6 |
-
private $_ItemsTaxQuoteId=array();
|
7 |
-
|
8 |
public function _construct()
|
9 |
{
|
10 |
$this->_init('taxce/taxquote');
|
@@ -14,15 +16,14 @@
|
|
14 |
return Mage::helper('taxce');
|
15 |
}
|
16 |
|
17 |
-
public function getTaxQuote($information) {
|
18 |
-
$session=$this->getHelper()->getSession();
|
19 |
-
$this->_ItemsTaxQuoteId=array();
|
20 |
-
$this->_ItemsTaxLines=array();
|
21 |
|
|
|
22 |
/* Prevent multiple query when id updated */
|
23 |
if (!$information['tax_area_id'] && !$this->getHelper()->AllowCartQuote())
|
24 |
return false;
|
25 |
-
/*
|
|
|
26 |
|
27 |
if ($this->getHelper()->getSourcePath()=='cart_checkout_index' || $this->getHelper()->getSourcePath()=='cart_checkout_couponPost') {
|
28 |
$information['tax_area_id']='';
|
@@ -33,65 +34,32 @@
|
|
33 |
/* Quotation Request Array*/
|
34 |
$information['request_type']='QuotationRequest';
|
35 |
$request=Mage::getModel('taxce/requestItem')->setData($information)->exportAsArray();
|
36 |
-
/* Quotation Request Array*/
|
37 |
-
|
38 |
-
/*Some special magic for quote*/
|
39 |
-
$i=1; /* lineItemNumber */
|
40 |
-
foreach($information['order_items'] as $key=>$item){
|
41 |
-
$item_tax_info=array();
|
42 |
-
$item_tax_info['lineItemNumber']=$i;
|
43 |
-
$item_tax_info['quote_item_id']=$key;
|
44 |
-
$this->_ItemsTaxLines[$i]= new Varien_Object($item_tax_info);
|
45 |
-
$i++;
|
46 |
-
}
|
47 |
-
/*Some special magic for quote*/
|
48 |
-
|
49 |
|
50 |
-
$tax_quote_result=Mage::getModel('taxce/
|
51 |
if ($tax_quote_result instanceof Exception) {
|
52 |
/*@info error handles for different page types */
|
53 |
if (Mage::app()->getRequest()->getControllerName()=='onepage' || Mage::app()->getRequest()->getControllerName()=='sales_order_create') {
|
54 |
-
Mage::log("Quote Request Error: ".$tax_quote_result->getMessage()."Controller: ".$this->getHelper()->getSourcePath(), null, '
|
55 |
-
$result=array('error' => 1, 'message' => "Tax
|
56 |
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
57 |
exit();
|
58 |
}
|
59 |
-
if ($this->getHelper()->getSourcePath()=='cart_checkout_index' || $this->getHelper()->getSourcePath()=='cart_checkout_couponPost')
|
60 |
-
$this->getHelper()->getSession()->setVertexTQ(0);
|
61 |
$this->getHelper()->getSession()->addError(Mage::helper('core')->escapeHtml("Tax Calculation Request Error. Please check your address"));
|
62 |
-
|
63 |
-
$session->setItemsTaxQuoteId();
|
64 |
return false;
|
65 |
}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
/* SUMM Percents For Jurisdictions */
|
77 |
-
$TaxPercent=0;
|
78 |
-
foreach ($item->Taxes as $key=>$tax_value)
|
79 |
-
if ($key=="EffectiveRate")
|
80 |
-
$TaxPercent+=$tax_value;
|
81 |
-
|
82 |
-
$TaxPercent=$TaxPercent*100;
|
83 |
-
|
84 |
-
/* SUMM Percents For Jurisdictions */
|
85 |
-
$items_tax_lines_data=$this->_ItemsTaxLines[$lineItemNumber]->getData();
|
86 |
-
$items_tax_lines_data['tax_amount']=$ItemTotaltax;
|
87 |
-
$items_tax_lines_data['base_tax_amount']=$ItemTotaltax;
|
88 |
-
$items_tax_lines_data['tax_percent']=$TaxPercent;
|
89 |
-
$this->_ItemsTaxLines[$lineItemNumber]->setData($items_tax_lines_data);
|
90 |
-
|
91 |
-
$quote_item_id=$this->_ItemsTaxLines[$lineItemNumber]->getQuoteItemId();
|
92 |
-
$this->_ItemsTaxQuoteId[$quote_item_id]=$this->_ItemsTaxLines[$lineItemNumber];
|
93 |
-
}
|
94 |
-
$session->setItemsTaxQuoteId($this->_ItemsTaxQuoteId);
|
95 |
}
|
96 |
|
97 |
/* Collect Quote Information */
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
class VertexSMB_TaxCE_Model_TaxQuote extends Mage_Core_Model_Abstract {
|
9 |
+
|
|
|
|
|
|
|
10 |
public function _construct()
|
11 |
{
|
12 |
$this->_init('taxce/taxquote');
|
16 |
return Mage::helper('taxce');
|
17 |
}
|
18 |
|
19 |
+
public function getTaxQuote($information) {
|
|
|
|
|
|
|
20 |
|
21 |
+
/*@todo check it*/
|
22 |
/* Prevent multiple query when id updated */
|
23 |
if (!$information['tax_area_id'] && !$this->getHelper()->AllowCartQuote())
|
24 |
return false;
|
25 |
+
/* @todo compare with tax model seems dublicate*/
|
26 |
+
/* Automatically determine tax area id */
|
27 |
|
28 |
if ($this->getHelper()->getSourcePath()=='cart_checkout_index' || $this->getHelper()->getSourcePath()=='cart_checkout_couponPost') {
|
29 |
$information['tax_area_id']='';
|
34 |
/* Quotation Request Array*/
|
35 |
$information['request_type']='QuotationRequest';
|
36 |
$request=Mage::getModel('taxce/requestItem')->setData($information)->exportAsArray();
|
37 |
+
/* Quotation Request Array*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
$tax_quote_result=Mage::getModel('taxce/vertexSMB')->SendApiRequest($request,null,'quote');
|
40 |
if ($tax_quote_result instanceof Exception) {
|
41 |
/*@info error handles for different page types */
|
42 |
if (Mage::app()->getRequest()->getControllerName()=='onepage' || Mage::app()->getRequest()->getControllerName()=='sales_order_create') {
|
43 |
+
Mage::log("Quote Request Error: ".$tax_quote_result->getMessage()."Controller: ".$this->getHelper()->getSourcePath(), null, 'vertexsmb.log');
|
44 |
+
$result=array('error' => 1, 'message' => "Tax calculation request error. Please check your address");
|
45 |
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
46 |
exit();
|
47 |
}
|
48 |
+
if ($this->getHelper()->getSourcePath()=='cart_checkout_index' || $this->getHelper()->getSourcePath()=='cart_checkout_couponPost')
|
|
|
49 |
$this->getHelper()->getSession()->addError(Mage::helper('core')->escapeHtml("Tax Calculation Request Error. Please check your address"));
|
50 |
+
|
|
|
51 |
return false;
|
52 |
}
|
53 |
+
/*beta*/
|
54 |
+
$ResponseModel=Mage::getModel('taxce/TaxQuoteResponse')->parseResponse($tax_quote_result);
|
55 |
+
$this->setResponse($ResponseModel);
|
56 |
+
|
57 |
+
$items_tax=$ResponseModel->getTaxLineItems();
|
58 |
+
$quote_taxed_items=$ResponseModel->getQuoteTaxedItems();
|
59 |
+
|
60 |
+
return $quote_taxed_items;
|
61 |
+
/* beta */
|
62 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
/* Collect Quote Information */
|
app/code/local/VertexSMB/TaxCE/Model/TaxQuoteResponse.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
+
class VertexSMB_TaxCE_Model_TaxQuoteResponse extends Mage_Core_Model_Abstract {
|
9 |
+
|
10 |
+
|
11 |
+
public function parseResponse($response_object){
|
12 |
+
if (is_array($response_object->QuotationResponse->LineItem))
|
13 |
+
$TaxLineItems=$response_object->QuotationResponse->LineItem;
|
14 |
+
else
|
15 |
+
$TaxLineItems[]=$response_object->QuotationResponse->LineItem;
|
16 |
+
|
17 |
+
$this->setTaxLineItems($TaxLineItems);
|
18 |
+
$this->setLineItemsCount(count($TaxLineItems));
|
19 |
+
$this->prepareQuoteTaxedItems($TaxLineItems);
|
20 |
+
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function prepareQuoteTaxedItems($items_tax){
|
25 |
+
$quote_taxed_items=array();
|
26 |
+
|
27 |
+
foreach ($items_tax as $item) {
|
28 |
+
$lineItemNumber=$item->lineItemNumber;
|
29 |
+
$ItemTotaltax=$item->TotalTax->_;
|
30 |
+
/* SUMM Percents For Jurisdictions */
|
31 |
+
$TaxPercent=0;
|
32 |
+
foreach ($item->Taxes as $key=>$tax_value)
|
33 |
+
if (is_object($tax_value) && property_exists($tax_value, "EffectiveRate"))
|
34 |
+
$TaxPercent+=(float)$tax_value->EffectiveRate;
|
35 |
+
elseif ($key=="EffectiveRate")
|
36 |
+
$TaxPercent+=(float)$tax_value;
|
37 |
+
|
38 |
+
|
39 |
+
$TaxPercent=$TaxPercent*100;
|
40 |
+
|
41 |
+
$quoite_item_id=$item->lineItemId;
|
42 |
+
$TaxItemInfo=new Varien_Object;
|
43 |
+
$TaxItemInfo->setProductClass($item->Product->productClass);
|
44 |
+
$TaxItemInfo->setProductSku($item->Product->_);
|
45 |
+
$TaxItemInfo->setProductQty($item->Quantity->_);
|
46 |
+
$TaxItemInfo->setUnitPrice($item->UnitPrice->_);
|
47 |
+
$TaxItemInfo->setTaxPercent($TaxPercent);
|
48 |
+
$TaxItemInfo->setBaseTaxAmount($ItemTotaltax);
|
49 |
+
$TaxItemInfo->setTaxAmount($ItemTotaltax);
|
50 |
+
$quote_taxed_items[$quoite_item_id]=$TaxItemInfo;
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->setQuoteTaxedItems($quote_taxed_items);
|
54 |
+
}
|
55 |
+
}
|
app/code/local/VertexSMB/TaxCE/Model/TaxRequest.php
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
class VertexSMB_TaxCE_Model_TaxRequest extends Mage_Core_Model_Abstract {
|
4 |
|
@@ -11,36 +16,36 @@ class VertexSMB_TaxCE_Model_TaxRequest extends Mage_Core_Model_Abstract {
|
|
11 |
$TotalTax=0;
|
12 |
$invoices=$this->getCollection()->addFieldToSelect('total_tax')->addFieldToFilter('order_id',$orderId)->addFieldToFilter('request_type','invoice');
|
13 |
foreach ($invoices as $invoice) {
|
14 |
-
|
15 |
$TotalTax+=$invoice->getTotalTax();
|
16 |
-
}
|
17 |
-
return $TotalTax;
|
18 |
}
|
19 |
|
20 |
public function RemoveQuotesLookupRequests(){
|
21 |
$quotes=$this->getCollection()->addFieldToSelect('request_id')->addFieldToFilter('request_type',array('in'=>array('quote','tax_area_lookup')));
|
22 |
|
23 |
-
foreach ($quotes as $quote)
|
24 |
$quote->delete();
|
25 |
-
|
26 |
return $this;
|
27 |
}
|
28 |
|
29 |
public function RemoveInvoicesforCompletedOrders(){
|
30 |
$invoices=$this->getCollection()->addFieldToSelect('order_id')->addFieldToFilter('request_type','invoice');
|
31 |
-
|
32 |
$invoices->getSelect()->join( array('order'=> 'sales_flat_order'), 'order.entity_id = main_table.order_id', array('order.state'));
|
33 |
$invoices->addFieldToFilter('order.state',array('in'=>array('complete','canceled','closed')));
|
34 |
-
|
35 |
$completed_order_ids=array();
|
36 |
-
foreach ($invoices as $invoice)
|
37 |
$completed_order_ids[]=$invoice->getOrderId();
|
38 |
-
|
39 |
$completed_invoices=$this->getCollection()->addFieldToSelect('request_id')->addFieldToFilter('order_id',array('in'=>$completed_order_ids));
|
40 |
-
foreach ($completed_invoices as $completeted_invoice)
|
41 |
$completeted_invoice->delete();
|
42 |
-
|
43 |
-
|
44 |
return $this;
|
45 |
}
|
46 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
|
8 |
class VertexSMB_TaxCE_Model_TaxRequest extends Mage_Core_Model_Abstract {
|
9 |
|
16 |
$TotalTax=0;
|
17 |
$invoices=$this->getCollection()->addFieldToSelect('total_tax')->addFieldToFilter('order_id',$orderId)->addFieldToFilter('request_type','invoice');
|
18 |
foreach ($invoices as $invoice) {
|
19 |
+
|
20 |
$TotalTax+=$invoice->getTotalTax();
|
21 |
+
}
|
22 |
+
return $TotalTax;
|
23 |
}
|
24 |
|
25 |
public function RemoveQuotesLookupRequests(){
|
26 |
$quotes=$this->getCollection()->addFieldToSelect('request_id')->addFieldToFilter('request_type',array('in'=>array('quote','tax_area_lookup')));
|
27 |
|
28 |
+
foreach ($quotes as $quote)
|
29 |
$quote->delete();
|
30 |
+
|
31 |
return $this;
|
32 |
}
|
33 |
|
34 |
public function RemoveInvoicesforCompletedOrders(){
|
35 |
$invoices=$this->getCollection()->addFieldToSelect('order_id')->addFieldToFilter('request_type','invoice');
|
36 |
+
|
37 |
$invoices->getSelect()->join( array('order'=> 'sales_flat_order'), 'order.entity_id = main_table.order_id', array('order.state'));
|
38 |
$invoices->addFieldToFilter('order.state',array('in'=>array('complete','canceled','closed')));
|
39 |
+
|
40 |
$completed_order_ids=array();
|
41 |
+
foreach ($invoices as $invoice)
|
42 |
$completed_order_ids[]=$invoice->getOrderId();
|
43 |
+
|
44 |
$completed_invoices=$this->getCollection()->addFieldToSelect('request_id')->addFieldToFilter('order_id',array('in'=>$completed_order_ids));
|
45 |
+
foreach ($completed_invoices as $completeted_invoice)
|
46 |
$completeted_invoice->delete();
|
47 |
+
|
48 |
+
|
49 |
return $this;
|
50 |
}
|
51 |
}
|
app/code/local/VertexSMB/TaxCE/Model/{Taxce.php → VertexSMB.php}
RENAMED
@@ -1,17 +1,23 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* @author
|
7 |
*/
|
8 |
-
|
|
|
9 |
|
10 |
public function getHelper() {
|
11 |
return Mage::helper('taxce');
|
12 |
}
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
public function SendApiRequest($request,$order=null, $type) {
|
16 |
|
17 |
$object_id=null;
|
@@ -28,14 +34,15 @@ class VertexSMB_TaxCE_Model_Taxce extends Mage_Core_Model_Abstract {
|
|
28 |
$api_url=$this->getHelper()->getVertexHost();
|
29 |
if ($type=='tax_area_lookup')
|
30 |
$api_url=$this->getHelper()->getVertexAddressHost();
|
31 |
-
|
32 |
-
|
|
|
33 |
if ($type=='tax_area_lookup')
|
34 |
$tax_request_result = $client->LookupTaxAreas60($request);
|
35 |
else
|
36 |
$tax_request_result = $client->calculateTax60($request);
|
37 |
} catch (Exception $e) {
|
38 |
-
if ($client)
|
39 |
$this->LogRequest($type,$object_id, $client->__getLastRequest(), $client->__getLastResponse());
|
40 |
else
|
41 |
$this->LogRequest($type,$object_id, $e->getMessage (), $e->getMessage ());
|
@@ -68,9 +75,7 @@ class VertexSMB_TaxCE_Model_Taxce extends Mage_Core_Model_Abstract {
|
|
68 |
}else
|
69 |
$tax_area_id=$tax_area_results->taxAreaId;
|
70 |
}
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
$this->LogRequest($type, $object_id, $client->__getLastRequest(), $client->__getLastResponse(),$Total_Tax,$tax_area_id);
|
75 |
|
76 |
return $tax_request_result;
|
@@ -78,6 +83,7 @@ class VertexSMB_TaxCE_Model_Taxce extends Mage_Core_Model_Abstract {
|
|
78 |
}
|
79 |
|
80 |
/* Log Save Logic*/
|
|
|
81 |
public function LogRequest($type,$object_id,$request_xml,$response_xml, $total_tax=0, $tax_area_id=0) {
|
82 |
$taxrequest = Mage::getModel('taxce/taxRequest');
|
83 |
$taxrequest->setRequestType($type)->setRequestDate(date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
@@ -85,16 +91,51 @@ class VertexSMB_TaxCE_Model_Taxce extends Mage_Core_Model_Abstract {
|
|
85 |
$taxrequest->setOrderId($object_id);
|
86 |
elseif ($type=='quote' || $type='tax_area_lookup')
|
87 |
$taxrequest->setQuoteId($object_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
|
|
|
|
90 |
$source_path=$this->getHelper()->getSourcePath();
|
91 |
$taxrequest->setSourcePath($source_path);
|
92 |
$taxrequest->setTotalTax($total_tax);
|
93 |
$taxrequest->setRequestXml($request_xml);
|
94 |
$taxrequest->setResponseXml($response_xml);
|
95 |
$taxrequest->setTaxAreaId($tax_area_id);
|
|
|
|
|
|
|
96 |
$taxrequest->save();
|
97 |
-
Mage::log($taxrequest->getData(), null, '
|
98 |
}
|
99 |
|
100 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
*/
|
7 |
+
|
8 |
+
class VertexSMB_TaxCE_Model_VertexSMB extends Mage_Core_Model_Abstract {
|
9 |
|
10 |
public function getHelper() {
|
11 |
return Mage::helper('taxce');
|
12 |
}
|
13 |
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @param unknown $request
|
17 |
+
* @param string $order
|
18 |
+
* @param unknown $type
|
19 |
+
* @return Exception|unknown
|
20 |
+
*/
|
21 |
public function SendApiRequest($request,$order=null, $type) {
|
22 |
|
23 |
$object_id=null;
|
34 |
$api_url=$this->getHelper()->getVertexHost();
|
35 |
if ($type=='tax_area_lookup')
|
36 |
$api_url=$this->getHelper()->getVertexAddressHost();
|
37 |
+
|
38 |
+
$client = new SoapClient($api_url, array('connection_timeout' => 300,'trace' => true, 'soap_version' => SOAP_1_1));
|
39 |
+
|
40 |
if ($type=='tax_area_lookup')
|
41 |
$tax_request_result = $client->LookupTaxAreas60($request);
|
42 |
else
|
43 |
$tax_request_result = $client->calculateTax60($request);
|
44 |
} catch (Exception $e) {
|
45 |
+
if ($client instanceof SoapClient)
|
46 |
$this->LogRequest($type,$object_id, $client->__getLastRequest(), $client->__getLastResponse());
|
47 |
else
|
48 |
$this->LogRequest($type,$object_id, $e->getMessage (), $e->getMessage ());
|
75 |
}else
|
76 |
$tax_area_id=$tax_area_results->taxAreaId;
|
77 |
}
|
78 |
+
|
|
|
|
|
79 |
$this->LogRequest($type, $object_id, $client->__getLastRequest(), $client->__getLastResponse(),$Total_Tax,$tax_area_id);
|
80 |
|
81 |
return $tax_request_result;
|
83 |
}
|
84 |
|
85 |
/* Log Save Logic*/
|
86 |
+
/* @todo expand logs and add cron job for cleaning*/
|
87 |
public function LogRequest($type,$object_id,$request_xml,$response_xml, $total_tax=0, $tax_area_id=0) {
|
88 |
$taxrequest = Mage::getModel('taxce/taxRequest');
|
89 |
$taxrequest->setRequestType($type)->setRequestDate(date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time())));
|
91 |
$taxrequest->setOrderId($object_id);
|
92 |
elseif ($type=='quote' || $type='tax_area_lookup')
|
93 |
$taxrequest->setQuoteId($object_id);
|
94 |
+
|
95 |
+
$dom = new DOMDocument;
|
96 |
+
$dom->preserveWhiteSpace = FALSE;
|
97 |
+
$dom->loadXML($request_xml);
|
98 |
+
$dom->formatOutput = TRUE;
|
99 |
+
if ($dom->saveXml())
|
100 |
+
$request_xml=$dom->saveXml();
|
101 |
+
|
102 |
+
$dom->loadXML($response_xml);
|
103 |
+
|
104 |
+
$dom->formatOutput = TRUE;
|
105 |
+
if ($dom->saveXml())
|
106 |
+
$response_xml=$dom->saveXml();
|
107 |
+
|
108 |
+
$TotalNode = $dom->getElementsByTagName('Total');
|
109 |
+
$SubTotalNode = $dom->getElementsByTagName('SubTotal');
|
110 |
+
$LookupResultNode = $dom->getElementsByTagName('Status');
|
111 |
+
$AddressLookupFaultNode = $dom->getElementsByTagName('exceptionType');
|
112 |
+
$Total=0;
|
113 |
+
$SubTotal=0;
|
114 |
+
$LookupResult="";
|
115 |
+
|
116 |
+
if ($TotalNode->length>0)
|
117 |
+
$Total=$TotalNode->item(0)->nodeValue;
|
118 |
+
|
119 |
+
if ($SubTotalNode->length>0)
|
120 |
+
$SubTotal=$SubTotalNode->item(0)->nodeValue;
|
121 |
+
|
122 |
+
if ($LookupResultNode->length>0)
|
123 |
+
$LookupResult=$LookupResultNode->item(0)->getAttribute('lookupResult');
|
124 |
|
125 |
+
if (!$LookupResult && $AddressLookupFaultNode->length>0)
|
126 |
+
$LookupResult=$AddressLookupFaultNode->item(0)->nodeValue;
|
127 |
+
|
128 |
$source_path=$this->getHelper()->getSourcePath();
|
129 |
$taxrequest->setSourcePath($source_path);
|
130 |
$taxrequest->setTotalTax($total_tax);
|
131 |
$taxrequest->setRequestXml($request_xml);
|
132 |
$taxrequest->setResponseXml($response_xml);
|
133 |
$taxrequest->setTaxAreaId($tax_area_id);
|
134 |
+
$taxrequest->setTotal($Total);
|
135 |
+
$taxrequest->setSubTotal($SubTotal);
|
136 |
+
$taxrequest->setLookupResult($LookupResult);
|
137 |
$taxrequest->save();
|
138 |
+
Mage::log($taxrequest->getData(), null, 'vertexsmb.log');
|
139 |
}
|
140 |
|
141 |
}
|
app/code/local/VertexSMB/TaxCE/controllers/OnepageController.php
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
require Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'OnepageController.php';
|
|
|
3 |
class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController {
|
4 |
|
5 |
/**
|
@@ -7,7 +14,7 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
7 |
*/
|
8 |
public function saveShippingAction()
|
9 |
{
|
10 |
-
if (!Mage::helper('taxce')->
|
11 |
parent::saveShippingAction();
|
12 |
return $this;
|
13 |
}
|
@@ -17,26 +24,27 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
17 |
if ($this->getRequest()->isPost()) {
|
18 |
$data = $this->getRequest()->getPost('shipping', array());
|
19 |
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
20 |
-
|
21 |
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
22 |
|
23 |
-
/*
|
24 |
-
$address=$this->getOnepage()->getQuote()->getShippingAddress();
|
25 |
-
|
26 |
-
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
$this->
|
33 |
-
|
34 |
-
|
|
|
35 |
}
|
36 |
|
37 |
public function saveBillingAction()
|
38 |
{
|
39 |
-
if (!Mage::helper('taxce')->
|
40 |
parent::saveBillingAction();
|
41 |
return $this;
|
42 |
}
|
@@ -50,14 +58,9 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
50 |
if (isset($data['email'])) {
|
51 |
$data['email'] = trim($data['email']);
|
52 |
}
|
53 |
-
$data['tax_area_id']="";
|
54 |
-
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
55 |
-
|
56 |
-
|
57 |
-
$address=$this->getOnepage()->getQuote()->getBillingAddress();
|
58 |
-
$address->setTaxAreaId()->save();
|
59 |
|
60 |
-
$
|
|
|
61 |
if (!isset($result['error'])) {
|
62 |
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
63 |
$result['goto_section'] = 'payment';
|
@@ -65,9 +68,12 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
65 |
'name' => 'payment-method',
|
66 |
'html' => $this->_getPaymentMethodsHtml()
|
67 |
);
|
68 |
-
$
|
|
|
|
|
|
|
69 |
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
70 |
-
|
71 |
|
72 |
$result['goto_section'] = 'shipping_method';
|
73 |
$result['update_section'] = array(
|
@@ -77,18 +83,19 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
77 |
|
78 |
$result['allow_sections'] = array('shipping');
|
79 |
$result['duplicateBillingInfo'] = 'true';
|
|
|
|
|
|
|
|
|
80 |
} else {
|
81 |
$result['goto_section'] = 'shipping';
|
82 |
}
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
}
|
87 |
-
|
88 |
}
|
89 |
}
|
90 |
-
|
91 |
-
|
92 |
public function saveTaxAreaAction()
|
93 |
{
|
94 |
if ($this->_expireAjax()) {
|
@@ -97,9 +104,7 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
97 |
if ($this->getRequest()->isPost()) {
|
98 |
$tax_area_id = $this->getRequest()->getPost('tax_area_id', 0);
|
99 |
$new_city = $this->getRequest()->getPost('tax_new_city', 0);
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
104 |
$address=$this->getOnepage()->getQuote()->getBillingAddress();
|
105 |
$result['goto_section'] = 'payment';
|
@@ -157,74 +162,69 @@ class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController
|
|
157 |
}
|
158 |
|
159 |
public function saveTaxAreaId($address){
|
160 |
-
$
|
161 |
-
|
162 |
-
|
|
|
|
|
163 |
if (Mage::app()->getRequest()->getControllerName()=='onepage' || Mage::app()->getRequest()->getControllerName()=='sales_order_create') {
|
164 |
-
Mage::log("Quote Request Error: ".$request_result->getMessage()."Controller: ".Mage::helper('taxce')->getSourcePath(), null, '
|
165 |
$result=array('error' => 1, 'message' => "Tax Calculation Request Error. Please check your address");
|
166 |
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
167 |
exit();
|
168 |
-
}
|
169 |
-
|
170 |
-
|
|
|
171 |
Mage::helper('taxce')->getSession()->addError(Mage::helper('core')->escapeHtml("Tax Calculation Request Error. Please check your address"));
|
172 |
}
|
173 |
return false;
|
174 |
}
|
175 |
-
|
176 |
-
|
|
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
->setData('response',$request_result)->toHtml();
|
182 |
$result['goto_section'] = 'selectaddress';
|
183 |
$result['update_section'] = array(
|
184 |
'name' => 'selectaddress',
|
185 |
'html' => $block
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
}
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
if ($address->getAddressType()=='billing' && $this->getOnepage()->getQuote()->getShippingAddress()->getSameAsBilling())
|
196 |
-
$this->getOnepage()->getQuote()->getShippingAddress()->setTaxAreaId($tax_area_id)->save();
|
197 |
-
} else {
|
198 |
-
$tax_area_id=$request_result->TaxAreaResponse->TaxAreaResult->taxAreaId;
|
199 |
-
|
200 |
-
$address->setTaxAreaId($tax_area_id)->save();
|
201 |
-
$this->getOnepage()->getQuote()->collectTotals()->save();
|
202 |
-
/* When tax_area_id stored replace */
|
203 |
-
if ($address->getAddressType()=='billing' && $this->getOnepage()->getQuote()->getShippingAddress()->getSameAsBilling())
|
204 |
-
$this->getOnepage()->getQuote()->getShippingAddress()->setTaxAreaId($tax_area_id)->save();
|
205 |
-
|
206 |
-
/* Chack if city differs */
|
207 |
-
$address_changed=false;
|
208 |
-
if (strtolower($address->getCity())!=strtolower($request_result->TaxAreaResponse->TaxAreaResult->PostalAddress->City)) {
|
209 |
-
$old_city=$address->getCity();
|
210 |
-
$new_city=$request_result->TaxAreaResponse->TaxAreaResult->PostalAddress->City;
|
211 |
-
$address_changed=true;
|
212 |
}
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
$block=Mage::app()->getLayout()->createBlock('page/html')->setTemplate('taxce/addresschange-popup-content.phtml')
|
217 |
-
->setOldCity($old_city)->setNewCity($new_city)->setTaxAreaId($tax_area_id)->toHtml();
|
218 |
-
$result['goto_section'] = 'selectaddress';
|
219 |
-
$result['update_section'] = array(
|
220 |
-
'name' => 'selectaddress',
|
221 |
-
'html' => $block
|
222 |
-
);
|
223 |
-
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
224 |
-
return false;
|
225 |
-
}
|
226 |
-
}
|
227 |
-
return true;
|
228 |
-
/*taxce*/
|
229 |
}
|
230 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
require Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'OnepageController.php';
|
9 |
+
|
10 |
class VertexSMB_TaxCE_OnepageController extends Mage_Checkout_OnepageController {
|
11 |
|
12 |
/**
|
14 |
*/
|
15 |
public function saveShippingAction()
|
16 |
{
|
17 |
+
if (!Mage::helper('taxce')->IsVertexSMBActive()) {
|
18 |
parent::saveShippingAction();
|
19 |
return $this;
|
20 |
}
|
24 |
if ($this->getRequest()->isPost()) {
|
25 |
$data = $this->getRequest()->getPost('shipping', array());
|
26 |
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
27 |
+
|
28 |
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
29 |
|
30 |
+
/*VertexSMB*/
|
31 |
+
$address=$this->getOnepage()->getQuote()->getShippingAddress();
|
32 |
+
/* Save Tax Area & Correct City | Show popup window */
|
33 |
+
if (!$this->saveTaxAreaId($address))
|
34 |
+
return $this;
|
35 |
+
|
36 |
+
$result['goto_section'] = 'shipping_method';
|
37 |
+
$result['update_section'] = array(
|
38 |
+
'name' => 'shipping-method',
|
39 |
+
'html' => $this->_getShippingMethodsHtml()
|
40 |
+
);
|
41 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
42 |
+
}
|
43 |
}
|
44 |
|
45 |
public function saveBillingAction()
|
46 |
{
|
47 |
+
if (!Mage::helper('taxce')->IsVertexSMBActive()) {
|
48 |
parent::saveBillingAction();
|
49 |
return $this;
|
50 |
}
|
58 |
if (isset($data['email'])) {
|
59 |
$data['email'] = trim($data['email']);
|
60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
63 |
+
|
64 |
if (!isset($result['error'])) {
|
65 |
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
66 |
$result['goto_section'] = 'payment';
|
68 |
'name' => 'payment-method',
|
69 |
'html' => $this->_getPaymentMethodsHtml()
|
70 |
);
|
71 |
+
$address=$this->getOnepage()->getQuote()->getBillingAddress();
|
72 |
+
/* Save Tax Area & Correct City | Show popup window */
|
73 |
+
if (!$this->saveTaxAreaId($address))
|
74 |
+
return $this;
|
75 |
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
76 |
+
|
77 |
|
78 |
$result['goto_section'] = 'shipping_method';
|
79 |
$result['update_section'] = array(
|
83 |
|
84 |
$result['allow_sections'] = array('shipping');
|
85 |
$result['duplicateBillingInfo'] = 'true';
|
86 |
+
$address=$this->getOnepage()->getQuote()->getShippingAddress();
|
87 |
+
/* Save Tax Area & Correct City | Show popup window */
|
88 |
+
if (!$this->saveTaxAreaId($address))
|
89 |
+
return $this;
|
90 |
} else {
|
91 |
$result['goto_section'] = 'shipping';
|
92 |
}
|
93 |
+
}
|
94 |
+
|
95 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
|
|
|
|
96 |
}
|
97 |
}
|
98 |
+
|
|
|
99 |
public function saveTaxAreaAction()
|
100 |
{
|
101 |
if ($this->_expireAjax()) {
|
104 |
if ($this->getRequest()->isPost()) {
|
105 |
$tax_area_id = $this->getRequest()->getPost('tax_area_id', 0);
|
106 |
$new_city = $this->getRequest()->getPost('tax_new_city', 0);
|
107 |
+
|
|
|
|
|
108 |
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
109 |
$address=$this->getOnepage()->getQuote()->getBillingAddress();
|
110 |
$result['goto_section'] = 'payment';
|
162 |
}
|
163 |
|
164 |
public function saveTaxAreaId($address){
|
165 |
+
$TaxAreaModel=Mage::getModel('taxce/TaxAreaRequest');
|
166 |
+
$request_result=$TaxAreaModel->prepareRequest($address)->taxAreaLookup();
|
167 |
+
$address_changed=false;
|
168 |
+
if ($request_result instanceof Exception) {
|
169 |
+
|
170 |
if (Mage::app()->getRequest()->getControllerName()=='onepage' || Mage::app()->getRequest()->getControllerName()=='sales_order_create') {
|
171 |
+
Mage::log("Quote Request Error: ".$request_result->getMessage()."Controller: ".Mage::helper('taxce')->getSourcePath(), null, 'vertexsmb.log');
|
172 |
$result=array('error' => 1, 'message' => "Tax Calculation Request Error. Please check your address");
|
173 |
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
174 |
exit();
|
175 |
+
}
|
176 |
+
|
177 |
+
/*@todo check cart page if we use tax_area_id there*/
|
178 |
+
if (Mage::helper('taxce')->getSourcePath()=='cart_checkout_index' || Mage::helper('taxce')->getSourcePath()=='cart_checkout_couponPost') {
|
179 |
Mage::helper('taxce')->getSession()->addError(Mage::helper('core')->escapeHtml("Tax Calculation Request Error. Please check your address"));
|
180 |
}
|
181 |
return false;
|
182 |
}
|
183 |
+
$TaxAreaResposeModel=$TaxAreaModel->getResponse();
|
184 |
+
|
185 |
+
/*beta*/
|
186 |
|
187 |
+
if ($TaxAreaResposeModel->getResultsCount()>1 && Mage::helper('taxce')->ShowPopup()) {
|
188 |
+
$block=Mage::app()->getLayout()->createBlock('core/template')->setTemplate('vertexsmb/popup-content.phtml')
|
189 |
+
->setData('response',$request_result)->toHtml();
|
|
|
190 |
$result['goto_section'] = 'selectaddress';
|
191 |
$result['update_section'] = array(
|
192 |
'name' => 'selectaddress',
|
193 |
'html' => $block
|
194 |
+
);
|
195 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
196 |
+
return false;
|
197 |
+
}else {
|
198 |
+
$FirstTaxArea=$TaxAreaResposeModel->GetFirstTaxAreaInfo();
|
199 |
+
|
200 |
+
/* @todo modify template for object or address */
|
201 |
+
if ($FirstTaxArea->getCity()) {
|
202 |
+
if (strcmp(strtolower($address->getCity()),strtolower($FirstTaxArea->getCity())) !==0){
|
203 |
+
Mage::log("Original City: ".$address->getCity()." - New City: ".$FirstTaxArea->getCity(), null, 'vertexsmb.log');
|
204 |
+
$address_changed=true;
|
205 |
+
$block_address_update=Mage::app()->getLayout()->createBlock('core/template')->setTemplate('vertexsmb/addresschange-popup-content.phtml')
|
206 |
+
->setOldCity($address->getCity())->setNewCity($FirstTaxArea->getCity())->setTaxAreaId($FirstTaxArea->getTaxAreaId())->toHtml();
|
207 |
+
}
|
208 |
+
$address->setCity($FirstTaxArea->getCity());
|
209 |
+
}
|
210 |
+
$address->setTaxAreaId($FirstTaxArea->getTaxAreaId())->save();
|
211 |
+
$this->getOnepage()->getQuote()->collectTotals()->save();
|
212 |
+
}
|
213 |
+
|
214 |
+
/* @todo find out why should be virtual only*/
|
215 |
+
if ($address_changed /*&& !$this->getOnepage()->getQuote()->isVirtual()*/ ) {
|
216 |
+
$result['goto_section'] = 'selectaddress';
|
217 |
+
$result['update_section'] = array(
|
218 |
+
'name' => 'selectaddress',
|
219 |
+
'html' => $block_address_update
|
220 |
+
);
|
221 |
|
222 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
223 |
+
return false;
|
224 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
+
/*beta*/
|
227 |
+
|
228 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
}
|
230 |
}
|
app/code/local/VertexSMB/TaxCE/controllers/{TaxceController.php → VertexSMBController.php}
RENAMED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
/**
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* @author
|
7 |
*/
|
8 |
-
|
|
|
9 |
|
10 |
protected function _construct() {
|
11 |
$this->setUsedModuleName('VertexSMB_TaxCE');
|
@@ -40,14 +40,15 @@ class VertexSMB_TaxCE_TaxceController extends Mage_Adminhtml_Controller_Action {
|
|
40 |
if ($order = $this->_initOrder()) {
|
41 |
$invoice_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($order);
|
42 |
if ($invoice_request_data && Mage::getModel('taxce/taxInvoice')->SendInvoiceRequest($invoice_request_data))
|
43 |
-
$this->_getSession()->addSuccess( $this->__('The Vertex invoice has been sent.'));
|
44 |
}
|
45 |
$this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
|
46 |
}
|
47 |
|
48 |
public function TaxAreaAction(){
|
49 |
$orderCreateModel=Mage::getSingleton('adminhtml/sales_order_create');
|
50 |
-
|
|
|
51 |
if ($orderCreateModel->getQuote()->isVirtual() || $orderCreateModel->getQuote()->getShippingAddress()->getSameAsBilling() )
|
52 |
$address=$orderCreateModel->getQuote()->getBillingAddress();
|
53 |
else
|
@@ -59,58 +60,47 @@ class VertexSMB_TaxCE_TaxceController extends Mage_Adminhtml_Controller_Action {
|
|
59 |
exit();
|
60 |
}
|
61 |
|
62 |
-
$order_post=$this->getRequest()->getPost('order');
|
63 |
-
/*if ( $address->getTaxAreaId() && !isset($order_post['billing_address']) && !isset($order_post['shipping_address']) ) {
|
64 |
-
$result['message']='address not changed';
|
65 |
-
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
66 |
-
exit();
|
67 |
-
} */
|
68 |
|
69 |
-
$
|
|
|
70 |
if ($request_result instanceof Exception) {
|
71 |
-
Mage::log("Tax Area Lookup Error: ".$request_result->getMessage(), null, '
|
72 |
$result['message'] = $request_result->getMessage();
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
-
$
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
79 |
$result['message'] ="show_popup";
|
80 |
-
$result['html'] =$block;
|
81 |
-
}
|
82 |
-
$
|
83 |
-
$
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
}
|
97 |
-
/*Check if city differs */
|
98 |
-
|
99 |
-
if ($address_changed && !$address->getQuote()->isVirtual()) {
|
100 |
-
$block=Mage::app()->getLayout()->createBlock('page/html')->setTemplate('taxce/addresschange-popup-content.phtml')
|
101 |
-
->setOldCity($old_city)->setNewCity($new_city)->setTaxAreaId($tax_area_id)->toHtml();
|
102 |
-
$result['message'] ="show_popup";
|
103 |
-
$result['html'] =$block;
|
104 |
-
}
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
$result['shipping_address']=$orderCreateModel->getQuote()->getShippingAddress()->getData();
|
110 |
-
$result['same_as_billing']=$orderCreateModel->getQuote()->getData();
|
111 |
-
*/
|
112 |
-
$orderCreateModel->saveQuote();
|
113 |
}
|
|
|
114 |
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
115 |
exit();
|
116 |
}
|
@@ -138,6 +128,7 @@ class VertexSMB_TaxCE_TaxceController extends Mage_Adminhtml_Controller_Action {
|
|
138 |
exit();
|
139 |
}
|
140 |
|
|
|
141 |
/**
|
142 |
* Retrieve adminhtml session model object
|
143 |
*
|
@@ -148,4 +139,5 @@ class VertexSMB_TaxCE_TaxceController extends Mage_Adminhtml_Controller_Action {
|
|
148 |
return Mage::getSingleton('adminhtml/session');
|
149 |
}
|
150 |
|
|
|
151 |
}
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
*/
|
7 |
+
|
8 |
+
class VertexSMB_TaxCE_VertexSMBController extends Mage_Adminhtml_Controller_Action {
|
9 |
|
10 |
protected function _construct() {
|
11 |
$this->setUsedModuleName('VertexSMB_TaxCE');
|
40 |
if ($order = $this->_initOrder()) {
|
41 |
$invoice_request_data=Mage::getModel('taxce/taxInvoice')->PrepareInvoiceData($order);
|
42 |
if ($invoice_request_data && Mage::getModel('taxce/taxInvoice')->SendInvoiceRequest($invoice_request_data))
|
43 |
+
$this->_getSession()->addSuccess( $this->__('The Vertex SMB invoice has been sent.'));
|
44 |
}
|
45 |
$this->_redirect('*/sales_order/view', array('order_id' => $order->getId()));
|
46 |
}
|
47 |
|
48 |
public function TaxAreaAction(){
|
49 |
$orderCreateModel=Mage::getSingleton('adminhtml/sales_order_create');
|
50 |
+
$address_changed=false;
|
51 |
+
|
52 |
if ($orderCreateModel->getQuote()->isVirtual() || $orderCreateModel->getQuote()->getShippingAddress()->getSameAsBilling() )
|
53 |
$address=$orderCreateModel->getQuote()->getBillingAddress();
|
54 |
else
|
60 |
exit();
|
61 |
}
|
62 |
|
63 |
+
$order_post=$this->getRequest()->getPost('order');
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
$TaxAreaModel=Mage::getModel('taxce/TaxAreaRequest');
|
66 |
+
$request_result=$TaxAreaModel->prepareRequest($address)->taxAreaLookup();
|
67 |
if ($request_result instanceof Exception) {
|
68 |
+
Mage::log("Admin Tax Area Lookup Error: ".$request_result->getMessage(), null, 'vertexsmb.log');
|
69 |
$result['message'] = $request_result->getMessage();
|
70 |
+
$result['error'] =1;
|
71 |
+
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
72 |
+
exit();
|
73 |
}
|
74 |
|
75 |
+
$TaxAreaResposeModel=$TaxAreaModel->getResponse();
|
76 |
+
|
77 |
+
|
78 |
+
if ($TaxAreaResposeModel->getResultsCount()>1 && Mage::helper('taxce')->ShowPopup()) {
|
79 |
+
$block=Mage::app()->getLayout()->createBlock('page/html')->setTemplate('vertexsmb/popup-content.phtml')
|
80 |
+
->setData('response',$request_result)->toHtml();
|
81 |
$result['message'] ="show_popup";
|
82 |
+
$result['html'] =$block;
|
83 |
+
} else {
|
84 |
+
$FirstTaxArea=$TaxAreaResposeModel->GetFirstTaxAreaInfo();
|
85 |
+
if ($FirstTaxArea->getCity()) {
|
86 |
+
$result['message']='tax_area_id_found';
|
87 |
+
/* @todo modify template for object or address */
|
88 |
+
if (strtolower($address->getCity())!=strtolower($FirstTaxArea->getCity())){
|
89 |
+
$address_changed=true;
|
90 |
+
$block_address_update=Mage::app()->getLayout()->createBlock('page/html')->setTemplate('vertexsmb/addresschange-popup-content.phtml')
|
91 |
+
->setOldCity($address->getCity())->setNewCity($FirstTaxArea->getCity())->setTaxAreaId($FirstTaxArea->getTaxAreaId())->toHtml();
|
92 |
+
}
|
93 |
+
$address->setCity($FirstTaxArea->getCity());
|
94 |
+
}
|
95 |
+
$address->setTaxAreaId($FirstTaxArea->getTaxAreaId())->save();
|
96 |
+
$orderCreateModel->saveQuote();
|
97 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
if ($address_changed && !$address->getQuote()->isVirtual()) {
|
100 |
+
$result['message'] ="show_popup";
|
101 |
+
$result['html'] =$block_address_update;
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
+
|
104 |
echo Mage::app()->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
105 |
exit();
|
106 |
}
|
128 |
exit();
|
129 |
}
|
130 |
|
131 |
+
|
132 |
/**
|
133 |
* Retrieve adminhtml session model object
|
134 |
*
|
139 |
return Mage::getSingleton('adminhtml/session');
|
140 |
}
|
141 |
|
142 |
+
|
143 |
}
|
app/code/local/VertexSMB/TaxCE/data/taxce_setup/data-install-0.1.1.php
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
$installer = $this;
|
3 |
|
4 |
$data = array(
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @copyright Copyright (c) 2015 Net@Work (http://www.netatwork.com)
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
|
9 |
$installer = $this;
|
10 |
|
11 |
$data = array(
|
app/code/local/VertexSMB/TaxCE/data/taxce_setup/data-upgrade-0.1.4-0.1.5.php
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
$installer = $this;
|
3 |
|
4 |
$data = array(
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @copyright Copyright (c) 2015 Net@Work (http://www.netatwork.com)
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
|
9 |
$installer = $this;
|
10 |
|
11 |
$data = array(
|
app/code/local/VertexSMB/TaxCE/etc/adminhtml.xml
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<acl>
|
4 |
<resources>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @package VertexSMB_TaxCE
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
-->
|
9 |
<config>
|
10 |
<acl>
|
11 |
<resources>
|
app/code/local/VertexSMB/TaxCE/etc/config.xml
CHANGED
@@ -1,11 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<VertexSMB_TaxCE>
|
5 |
-
<version>1.
|
6 |
</VertexSMB_TaxCE>
|
7 |
</modules>
|
8 |
-
|
9 |
<blocks>
|
10 |
<taxce>
|
11 |
<class>VertexSMB_TaxCE_Block</class>
|
@@ -29,16 +36,16 @@
|
|
29 |
<taxce_resource>
|
30 |
<class>VertexSMB_TaxCE_Model_Resource</class>
|
31 |
<entities>
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
</entities>
|
36 |
</taxce_resource>
|
37 |
</models>
|
38 |
<helpers>
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
</helpers>
|
43 |
<resources>
|
44 |
<taxce_setup>
|
@@ -62,48 +69,48 @@
|
|
62 |
</taxce_read>
|
63 |
</resources>
|
64 |
<events>
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
<order_cancel_after>
|
84 |
<observers>
|
85 |
-
<
|
86 |
<type>singleton</type>
|
87 |
<class>VertexSMB_TaxCE_Model_Observer</class>
|
88 |
<method>OrderCancelled</method>
|
89 |
-
</
|
90 |
</observers>
|
91 |
</order_cancel_after>
|
92 |
<sales_order_creditmemo_refund>
|
93 |
<observers>
|
94 |
-
<
|
95 |
<type>singleton</type>
|
96 |
<class>VertexSMB_TaxCE_Model_Observer</class>
|
97 |
<method>OrderCreditmemoRefund</method>
|
98 |
-
</
|
99 |
</observers>
|
100 |
</sales_order_creditmemo_refund>
|
101 |
<adminhtml_init_system_config>
|
102 |
<observers>
|
103 |
-
<
|
104 |
<class>VertexSMB_TaxCE_Model_Observer</class>
|
105 |
<method>changeSystemConfig</method>
|
106 |
-
</
|
107 |
</observers>
|
108 |
</adminhtml_init_system_config>
|
109 |
</events>
|
@@ -114,14 +121,14 @@
|
|
114 |
</tax_area_id>
|
115 |
</sales_convert_quote_address>
|
116 |
</fieldsets>
|
117 |
-
|
118 |
-
|
119 |
<routers>
|
120 |
<taxce>
|
121 |
<use>admin</use>
|
122 |
<args>
|
123 |
<module>VertexSMB_TaxCE</module>
|
124 |
-
<frontName>
|
125 |
</args>
|
126 |
</taxce>
|
127 |
<adminhtml>
|
@@ -132,52 +139,52 @@
|
|
132 |
</args>
|
133 |
</adminhtml>
|
134 |
</routers>
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
<default>
|
171 |
<tax>
|
172 |
-
<
|
173 |
-
<
|
174 |
<trustedId><![CDATA[]]></trustedId>
|
175 |
<invoice_order><![CDATA[invoice_created]]></invoice_order>
|
176 |
<api_url><![CDATA[]]></api_url>
|
177 |
-
<address_api_url><![CDATA[]]></address_api_url>
|
178 |
<show_manual_button><![CDATA[0]]></show_manual_button>
|
179 |
<show_tarequest_popup><![CDATA[1]]></show_tarequest_popup>
|
180 |
-
</
|
181 |
<classes>
|
182 |
<default_customer_code><![CDATA[General]]></default_customer_code>
|
183 |
<creditmemo_adjustment_negative_code><![CDATA[adjustment-negative]]></creditmemo_adjustment_negative_code>
|
@@ -190,14 +197,14 @@
|
|
190 |
</default>
|
191 |
<crontab>
|
192 |
<jobs>
|
193 |
-
<
|
194 |
<schedule>
|
195 |
<cron_expr>00 2 * * *</cron_expr>
|
196 |
</schedule>
|
197 |
<run>
|
198 |
<model>taxce/observer::CleanLogs</model>
|
199 |
</run>
|
200 |
-
</
|
201 |
</jobs>
|
202 |
</crontab>
|
203 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @package VertexSMB_TaxCE
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
-->
|
9 |
<config>
|
10 |
<modules>
|
11 |
<VertexSMB_TaxCE>
|
12 |
+
<version>1.1.5</version>
|
13 |
</VertexSMB_TaxCE>
|
14 |
</modules>
|
15 |
+
<global>
|
16 |
<blocks>
|
17 |
<taxce>
|
18 |
<class>VertexSMB_TaxCE_Block</class>
|
36 |
<taxce_resource>
|
37 |
<class>VertexSMB_TaxCE_Model_Resource</class>
|
38 |
<entities>
|
39 |
+
<taxrequest>
|
40 |
+
<table>vertexsmb_taxrequest</table>
|
41 |
+
</taxrequest>
|
42 |
</entities>
|
43 |
</taxce_resource>
|
44 |
</models>
|
45 |
<helpers>
|
46 |
+
<taxce>
|
47 |
+
<class>VertexSMB_TaxCE_Helper</class>
|
48 |
+
</taxce>
|
49 |
</helpers>
|
50 |
<resources>
|
51 |
<taxce_setup>
|
69 |
</taxce_read>
|
70 |
</resources>
|
71 |
<events>
|
72 |
+
<sales_order_invoice_save_after>
|
73 |
+
<observers>
|
74 |
+
<vertexsmb_invoice_created_observer>
|
75 |
+
<type>singleton</type>
|
76 |
+
<class>VertexSMB_TaxCE_Model_Observer</class>
|
77 |
+
<method>InvoiceCreated</method>
|
78 |
+
</vertexsmb_invoice_created_observer>
|
79 |
+
</observers>
|
80 |
+
</sales_order_invoice_save_after>
|
81 |
+
<sales_order_save_after>
|
82 |
+
<observers>
|
83 |
+
<vertexsmb_order_saved_observer>
|
84 |
+
<type>singleton</type>
|
85 |
+
<class>VertexSMB_TaxCE_Model_Observer</class>
|
86 |
+
<method>OrderSaved</method>
|
87 |
+
</vertexsmb_order_saved_observer>
|
88 |
+
</observers>
|
89 |
+
</sales_order_save_after>
|
90 |
<order_cancel_after>
|
91 |
<observers>
|
92 |
+
<vertexsmb_order_cancel_observer>
|
93 |
<type>singleton</type>
|
94 |
<class>VertexSMB_TaxCE_Model_Observer</class>
|
95 |
<method>OrderCancelled</method>
|
96 |
+
</vertexsmb_order_cancel_observer>
|
97 |
</observers>
|
98 |
</order_cancel_after>
|
99 |
<sales_order_creditmemo_refund>
|
100 |
<observers>
|
101 |
+
<vertexsmb_order_creditmemo_observer>
|
102 |
<type>singleton</type>
|
103 |
<class>VertexSMB_TaxCE_Model_Observer</class>
|
104 |
<method>OrderCreditmemoRefund</method>
|
105 |
+
</vertexsmb_order_creditmemo_observer>
|
106 |
</observers>
|
107 |
</sales_order_creditmemo_refund>
|
108 |
<adminhtml_init_system_config>
|
109 |
<observers>
|
110 |
+
<vertexsmb_init_system_config>
|
111 |
<class>VertexSMB_TaxCE_Model_Observer</class>
|
112 |
<method>changeSystemConfig</method>
|
113 |
+
</vertexsmb_init_system_config>
|
114 |
</observers>
|
115 |
</adminhtml_init_system_config>
|
116 |
</events>
|
121 |
</tax_area_id>
|
122 |
</sales_convert_quote_address>
|
123 |
</fieldsets>
|
124 |
+
</global>
|
125 |
+
<admin>
|
126 |
<routers>
|
127 |
<taxce>
|
128 |
<use>admin</use>
|
129 |
<args>
|
130 |
<module>VertexSMB_TaxCE</module>
|
131 |
+
<frontName>vertexsmb</frontName>
|
132 |
</args>
|
133 |
</taxce>
|
134 |
<adminhtml>
|
139 |
</args>
|
140 |
</adminhtml>
|
141 |
</routers>
|
142 |
+
</admin>
|
143 |
+
<adminhtml>
|
144 |
+
<layout>
|
145 |
+
<updates>
|
146 |
+
<taxce>
|
147 |
+
<file>vertexsmb.xml</file>
|
148 |
+
</taxce>
|
149 |
+
</updates>
|
150 |
+
</layout>
|
151 |
+
</adminhtml>
|
152 |
+
<frontend>
|
153 |
+
<layout>
|
154 |
+
<updates>
|
155 |
+
<taxce>
|
156 |
+
<file>vertexsmb.xml</file>
|
157 |
+
</taxce>
|
158 |
+
</updates>
|
159 |
+
</layout>
|
160 |
+
<routers>
|
161 |
+
<checkout>
|
162 |
+
<args>
|
163 |
+
<modules>
|
164 |
+
<VertexSMB_TaxCE before="Mage_Checkout">VertexSMB_TaxCE</VertexSMB_TaxCE>
|
165 |
+
</modules>
|
166 |
+
</args>
|
167 |
+
</checkout>
|
168 |
+
<taxce>
|
169 |
+
<use>standard</use>
|
170 |
+
<args>
|
171 |
+
<module>VertexSMB_TaxCE</module>
|
172 |
+
<frontName>vertexsmb</frontName>
|
173 |
+
</args>
|
174 |
+
</taxce>
|
175 |
+
</routers>
|
176 |
+
</frontend>
|
177 |
<default>
|
178 |
<tax>
|
179 |
+
<vertexsmb_settings>
|
180 |
+
<enable_vertexsmb><![CDATA[0]]></enable_vertexsmb>
|
181 |
<trustedId><![CDATA[]]></trustedId>
|
182 |
<invoice_order><![CDATA[invoice_created]]></invoice_order>
|
183 |
<api_url><![CDATA[]]></api_url>
|
184 |
+
<address_api_url><![CDATA[]]></address_api_url>
|
185 |
<show_manual_button><![CDATA[0]]></show_manual_button>
|
186 |
<show_tarequest_popup><![CDATA[1]]></show_tarequest_popup>
|
187 |
+
</vertexsmb_settings>
|
188 |
<classes>
|
189 |
<default_customer_code><![CDATA[General]]></default_customer_code>
|
190 |
<creditmemo_adjustment_negative_code><![CDATA[adjustment-negative]]></creditmemo_adjustment_negative_code>
|
197 |
</default>
|
198 |
<crontab>
|
199 |
<jobs>
|
200 |
+
<vertexsmb_log_cleanup>
|
201 |
<schedule>
|
202 |
<cron_expr>00 2 * * *</cron_expr>
|
203 |
</schedule>
|
204 |
<run>
|
205 |
<model>taxce/observer::CleanLogs</model>
|
206 |
</run>
|
207 |
+
</vertexsmb_log_cleanup>
|
208 |
</jobs>
|
209 |
</crontab>
|
210 |
</config>
|
app/code/local/VertexSMB/TaxCE/etc/system.xml
CHANGED
@@ -1,9 +1,16 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<sections>
|
4 |
<tax translate="label" module="tax">
|
5 |
<groups>
|
6 |
-
<
|
7 |
<label>Vertex SMB Settings</label>
|
8 |
<sort_order>2</sort_order>
|
9 |
<show_in_default>1</show_in_default>
|
@@ -11,7 +18,7 @@
|
|
11 |
<show_in_store>1</show_in_store>
|
12 |
<comment><![CDATA[<p class="switcher">You can find settings at <a href="https://csportal.vertexsmb.com/" target="_blank">Vertex SMB TaxCentral</a></p>]]></comment>
|
13 |
<fields>
|
14 |
-
<
|
15 |
<label>Enable Vertex SMB Tax Calculation</label>
|
16 |
<frontend_type>select</frontend_type>
|
17 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -20,50 +27,50 @@
|
|
20 |
<show_in_default>1</show_in_default>
|
21 |
<show_in_website>1</show_in_website>
|
22 |
<show_in_store>1</show_in_store>
|
23 |
-
</
|
24 |
-
<
|
25 |
<label>Vertex SMB API Status</label>
|
26 |
<frontend_type>text</frontend_type>
|
27 |
-
<frontend_model>taxce/
|
28 |
<comment><![CDATA[API credentials status]]></comment>
|
29 |
<sort_order>10</sort_order>
|
30 |
<show_in_default>1</show_in_default>
|
31 |
<show_in_website>1</show_in_website>
|
32 |
<show_in_store>1</show_in_store>
|
33 |
-
</
|
34 |
<api_url translate="label">
|
35 |
<label>Vertex SMB Calculation API Url</label>
|
36 |
<frontend_type>text</frontend_type>
|
37 |
<sort_order>15</sort_order>
|
38 |
<validate>required-entry</validate>
|
39 |
<depends>
|
40 |
-
<
|
41 |
</depends>
|
42 |
<comment><![CDATA[Vertex SMB Calculation API Url.]]></comment>
|
43 |
<show_in_default>1</show_in_default>
|
44 |
<show_in_website>1</show_in_website>
|
45 |
<show_in_store>1</show_in_store>
|
46 |
-
</api_url>
|
47 |
<address_api_url translate="label">
|
48 |
<label>Vertex SMB Address Validation API Url</label>
|
49 |
<frontend_type>text</frontend_type>
|
50 |
<sort_order>17</sort_order>
|
51 |
<validate>required-entry</validate>
|
52 |
<depends>
|
53 |
-
<
|
54 |
</depends>
|
55 |
<comment><![CDATA[Vertex SMB Address Validation API Url.]]></comment>
|
56 |
<show_in_default>1</show_in_default>
|
57 |
<show_in_website>1</show_in_website>
|
58 |
<show_in_store>1</show_in_store>
|
59 |
-
</address_api_url>
|
60 |
<trustedId translate="label">
|
61 |
<label>Vertex SMB Trusted Id</label>
|
62 |
<frontend_type>text</frontend_type>
|
63 |
<sort_order>20</sort_order>
|
64 |
<validate>required-entry</validate>
|
65 |
<depends>
|
66 |
-
<
|
67 |
</depends>
|
68 |
<comment><![CDATA[An identifier supplied by an ERP.]]></comment>
|
69 |
<show_in_default>1</show_in_default>
|
@@ -76,7 +83,7 @@
|
|
76 |
<frontend_type>select</frontend_type>
|
77 |
<sort_order>40</sort_order>
|
78 |
<depends>
|
79 |
-
<
|
80 |
</depends>
|
81 |
<comment><![CDATA[Please select when tax should be invoiced to Vertex SMB]]></comment>
|
82 |
<show_in_default>1</show_in_default>
|
@@ -89,7 +96,7 @@
|
|
89 |
<frontend_type>select</frontend_type>
|
90 |
<sort_order>50</sort_order>
|
91 |
<depends>
|
92 |
-
<
|
93 |
<invoice_order><![CDATA[order_status]]></invoice_order>
|
94 |
</depends>
|
95 |
<comment><![CDATA[Please select order status]]></comment>
|
@@ -103,7 +110,7 @@
|
|
103 |
<frontend_type>select</frontend_type>
|
104 |
<sort_order>70</sort_order>
|
105 |
<depends>
|
106 |
-
<
|
107 |
</depends>
|
108 |
<comment><![CDATA[Allowing quote request on cart page may affect number of requests.]]></comment>
|
109 |
<show_in_default>1</show_in_default>
|
@@ -116,7 +123,7 @@
|
|
116 |
<frontend_type>select</frontend_type>
|
117 |
<sort_order>80</sort_order>
|
118 |
<depends>
|
119 |
-
<
|
120 |
</depends>
|
121 |
<comment><![CDATA[Enabeling this option may affect usual invoice workflow. Please use it only for debug/development purposes.]]></comment>
|
122 |
<show_in_default>1</show_in_default>
|
@@ -129,7 +136,7 @@
|
|
129 |
<frontend_type>select</frontend_type>
|
130 |
<sort_order>100</sort_order>
|
131 |
<depends>
|
132 |
-
<
|
133 |
</depends>
|
134 |
<comment><![CDATA[Enable/Disable Tax Jurisdiction(s) popup window on checkout and admin create order page]]></comment>
|
135 |
<show_in_default>1</show_in_default>
|
@@ -137,8 +144,8 @@
|
|
137 |
<show_in_store>1</show_in_store>
|
138 |
</show_tarequest_popup>
|
139 |
</fields>
|
140 |
-
</
|
141 |
-
<
|
142 |
<label>Vertex SMB Company Information</label>
|
143 |
<sort_order>3</sort_order>
|
144 |
<show_in_default>1</show_in_default>
|
@@ -210,7 +217,7 @@
|
|
210 |
<show_in_store>1</show_in_store>
|
211 |
</postalCode>
|
212 |
</fields>
|
213 |
-
</
|
214 |
<avaiable_shipping_product_codes>
|
215 |
<label>Shipping Product Codes</label>
|
216 |
<sort_order>3</sort_order>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @package VertexSMB_TaxCE
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
-->
|
9 |
<config>
|
10 |
<sections>
|
11 |
<tax translate="label" module="tax">
|
12 |
<groups>
|
13 |
+
<vertexsmb_settings translate="label">
|
14 |
<label>Vertex SMB Settings</label>
|
15 |
<sort_order>2</sort_order>
|
16 |
<show_in_default>1</show_in_default>
|
18 |
<show_in_store>1</show_in_store>
|
19 |
<comment><![CDATA[<p class="switcher">You can find settings at <a href="https://csportal.vertexsmb.com/" target="_blank">Vertex SMB TaxCentral</a></p>]]></comment>
|
20 |
<fields>
|
21 |
+
<enable_vertexsmb translate="label">
|
22 |
<label>Enable Vertex SMB Tax Calculation</label>
|
23 |
<frontend_type>select</frontend_type>
|
24 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
27 |
<show_in_default>1</show_in_default>
|
28 |
<show_in_website>1</show_in_website>
|
29 |
<show_in_store>1</show_in_store>
|
30 |
+
</enable_vertexsmb>
|
31 |
+
<vertexsmb_status translate="label">
|
32 |
<label>Vertex SMB API Status</label>
|
33 |
<frontend_type>text</frontend_type>
|
34 |
+
<frontend_model>taxce/adminhtml_system_config_form_field_vertexSMBStatus</frontend_model>
|
35 |
<comment><![CDATA[API credentials status]]></comment>
|
36 |
<sort_order>10</sort_order>
|
37 |
<show_in_default>1</show_in_default>
|
38 |
<show_in_website>1</show_in_website>
|
39 |
<show_in_store>1</show_in_store>
|
40 |
+
</vertexsmb_status>
|
41 |
<api_url translate="label">
|
42 |
<label>Vertex SMB Calculation API Url</label>
|
43 |
<frontend_type>text</frontend_type>
|
44 |
<sort_order>15</sort_order>
|
45 |
<validate>required-entry</validate>
|
46 |
<depends>
|
47 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
48 |
</depends>
|
49 |
<comment><![CDATA[Vertex SMB Calculation API Url.]]></comment>
|
50 |
<show_in_default>1</show_in_default>
|
51 |
<show_in_website>1</show_in_website>
|
52 |
<show_in_store>1</show_in_store>
|
53 |
+
</api_url>
|
54 |
<address_api_url translate="label">
|
55 |
<label>Vertex SMB Address Validation API Url</label>
|
56 |
<frontend_type>text</frontend_type>
|
57 |
<sort_order>17</sort_order>
|
58 |
<validate>required-entry</validate>
|
59 |
<depends>
|
60 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
61 |
</depends>
|
62 |
<comment><![CDATA[Vertex SMB Address Validation API Url.]]></comment>
|
63 |
<show_in_default>1</show_in_default>
|
64 |
<show_in_website>1</show_in_website>
|
65 |
<show_in_store>1</show_in_store>
|
66 |
+
</address_api_url>
|
67 |
<trustedId translate="label">
|
68 |
<label>Vertex SMB Trusted Id</label>
|
69 |
<frontend_type>text</frontend_type>
|
70 |
<sort_order>20</sort_order>
|
71 |
<validate>required-entry</validate>
|
72 |
<depends>
|
73 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
74 |
</depends>
|
75 |
<comment><![CDATA[An identifier supplied by an ERP.]]></comment>
|
76 |
<show_in_default>1</show_in_default>
|
83 |
<frontend_type>select</frontend_type>
|
84 |
<sort_order>40</sort_order>
|
85 |
<depends>
|
86 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
87 |
</depends>
|
88 |
<comment><![CDATA[Please select when tax should be invoiced to Vertex SMB]]></comment>
|
89 |
<show_in_default>1</show_in_default>
|
96 |
<frontend_type>select</frontend_type>
|
97 |
<sort_order>50</sort_order>
|
98 |
<depends>
|
99 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
100 |
<invoice_order><![CDATA[order_status]]></invoice_order>
|
101 |
</depends>
|
102 |
<comment><![CDATA[Please select order status]]></comment>
|
110 |
<frontend_type>select</frontend_type>
|
111 |
<sort_order>70</sort_order>
|
112 |
<depends>
|
113 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
114 |
</depends>
|
115 |
<comment><![CDATA[Allowing quote request on cart page may affect number of requests.]]></comment>
|
116 |
<show_in_default>1</show_in_default>
|
123 |
<frontend_type>select</frontend_type>
|
124 |
<sort_order>80</sort_order>
|
125 |
<depends>
|
126 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
127 |
</depends>
|
128 |
<comment><![CDATA[Enabeling this option may affect usual invoice workflow. Please use it only for debug/development purposes.]]></comment>
|
129 |
<show_in_default>1</show_in_default>
|
136 |
<frontend_type>select</frontend_type>
|
137 |
<sort_order>100</sort_order>
|
138 |
<depends>
|
139 |
+
<enable_vertexsmb>1</enable_vertexsmb>
|
140 |
</depends>
|
141 |
<comment><![CDATA[Enable/Disable Tax Jurisdiction(s) popup window on checkout and admin create order page]]></comment>
|
142 |
<show_in_default>1</show_in_default>
|
144 |
<show_in_store>1</show_in_store>
|
145 |
</show_tarequest_popup>
|
146 |
</fields>
|
147 |
+
</vertexsmb_settings>
|
148 |
+
<vertexsmb_seller_info translate="label">
|
149 |
<label>Vertex SMB Company Information</label>
|
150 |
<sort_order>3</sort_order>
|
151 |
<show_in_default>1</show_in_default>
|
217 |
<show_in_store>1</show_in_store>
|
218 |
</postalCode>
|
219 |
</fields>
|
220 |
+
</vertexsmb_seller_info>
|
221 |
<avaiable_shipping_product_codes>
|
222 |
<label>Shipping Product Codes</label>
|
223 |
<sort_order>3</sort_order>
|
app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-install-0.1.1.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
$installer = $this;
|
4 |
if ($installer->getConnection()->isTableExists($installer->getTable('taxce/taxrequest')) != true) {
|
5 |
/**
|
@@ -38,7 +43,7 @@ if ($installer->getConnection()->isTableExists($installer->getTable('taxce/taxre
|
|
38 |
'nullable' => false,
|
39 |
'default' => NULL,
|
40 |
), 'Response XML')
|
41 |
-
->setComment('Log of requests to
|
42 |
$installer->getConnection()->createTable($table);
|
43 |
}
|
44 |
/*Customer Attribute*/
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
$installer = $this;
|
9 |
if ($installer->getConnection()->isTableExists($installer->getTable('taxce/taxrequest')) != true) {
|
10 |
/**
|
43 |
'nullable' => false,
|
44 |
'default' => NULL,
|
45 |
), 'Response XML')
|
46 |
+
->setComment('Log of requests to Vertex SMB');
|
47 |
$installer->getConnection()->createTable($table);
|
48 |
}
|
49 |
/*Customer Attribute*/
|
app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-0.1.3-0.1.4.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
$installer = $this;
|
4 |
$installer->startSetup();
|
5 |
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
$installer = $this;
|
9 |
$installer->startSetup();
|
10 |
|
app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-0.1.6-0.1.7.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
$installer = $this;
|
4 |
$installer->startSetup();
|
5 |
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
$installer = $this;
|
9 |
$installer->startSetup();
|
10 |
|
app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-0.1.7-0.1.8.php
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
$installer = $this;
|
4 |
$installer->startSetup();
|
5 |
|
6 |
-
|
7 |
$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),
|
8 |
'tax_area_id',
|
9 |
array(
|
@@ -11,10 +15,9 @@ $installer->getConnection()->addColumn($installer->getTable('sales/quote_address
|
|
11 |
'nullable' => false,
|
12 |
'default' => null,
|
13 |
'length' => 255,
|
14 |
-
'comment' => 'Tax
|
15 |
)
|
16 |
-
);
|
17 |
-
|
18 |
|
19 |
$installer->getConnection()->addColumn($installer->getTable('sales/order_address'),
|
20 |
'tax_area_id',
|
@@ -23,7 +26,7 @@ $installer->getConnection()->addColumn($installer->getTable('sales/order_address
|
|
23 |
'nullable' => false,
|
24 |
'default' => null,
|
25 |
'length' => 255,
|
26 |
-
'comment' => 'Tax
|
27 |
)
|
28 |
);
|
29 |
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
$installer = $this;
|
9 |
$installer->startSetup();
|
10 |
|
|
|
11 |
$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),
|
12 |
'tax_area_id',
|
13 |
array(
|
15 |
'nullable' => false,
|
16 |
'default' => null,
|
17 |
'length' => 255,
|
18 |
+
'comment' => 'Tax Jurisdiction Id'
|
19 |
)
|
20 |
+
);
|
|
|
21 |
|
22 |
$installer->getConnection()->addColumn($installer->getTable('sales/order_address'),
|
23 |
'tax_area_id',
|
26 |
'nullable' => false,
|
27 |
'default' => null,
|
28 |
'length' => 255,
|
29 |
+
'comment' => 'Tax Jurisdiction Id'
|
30 |
)
|
31 |
);
|
32 |
|
app/code/local/VertexSMB/TaxCE/sql/taxce_setup/mysql4-upgrade-1.1.0-1.1.1.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
|
8 |
+
$installer = $this;
|
9 |
+
$installer->startSetup();
|
10 |
+
|
11 |
+
|
12 |
+
if ($installer->getConnection()->isTableExists($installer->getTable('taxce/taxrequest')) == true) {
|
13 |
+
|
14 |
+
$installer->getConnection()->addColumn($installer->getTable('taxce/taxrequest'),
|
15 |
+
'sub_total',
|
16 |
+
array(
|
17 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
18 |
+
'nullable' => false,
|
19 |
+
'default' => null,
|
20 |
+
'length' => 255,
|
21 |
+
'comment' => 'Response Subtotal Amount'
|
22 |
+
)
|
23 |
+
);
|
24 |
+
|
25 |
+
$installer->getConnection()->addColumn($installer->getTable('taxce/taxrequest'),
|
26 |
+
'total',
|
27 |
+
array(
|
28 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
29 |
+
'nullable' => false,
|
30 |
+
'default' => null,
|
31 |
+
'length' => 255,
|
32 |
+
'comment' => 'Response Total Amount'
|
33 |
+
)
|
34 |
+
);
|
35 |
+
|
36 |
+
$installer->getConnection()->addColumn($installer->getTable('taxce/taxrequest'),
|
37 |
+
'lookup_result',
|
38 |
+
array(
|
39 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
40 |
+
'nullable' => false,
|
41 |
+
'default' => null,
|
42 |
+
'length' => 255,
|
43 |
+
'comment' => 'Tax Area Response Lookup Result'
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
$this->endSetup();
|
app/design/adminhtml/default/default/layout/taxce.xml
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<adminhtml_sales_order_create_index>
|
4 |
-
<update handle="taxce_popup" />
|
5 |
-
</adminhtml_sales_order_create_index>
|
6 |
-
|
7 |
-
<taxce_popup>
|
8 |
-
<reference name="before_body_end">
|
9 |
-
<block type="page/html" template="taxce/popup.phtml"/>
|
10 |
-
</reference>
|
11 |
-
</taxce_popup>
|
12 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/layout/vertexsmb.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @package VertexSMB_TaxCE
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<layout version="0.1.0">
|
10 |
+
<adminhtml_sales_order_create_index>
|
11 |
+
<reference name="before_body_end">
|
12 |
+
<block type="core/template" template="vertexsmb/popup.phtml">
|
13 |
+
<action method="unsetData"><key>cache_lifetime</key></action>
|
14 |
+
<action method="unsetData"><key>cache_tags</key></action>
|
15 |
+
</block>
|
16 |
+
</reference>
|
17 |
+
</adminhtml_sales_order_create_index>
|
18 |
+
</layout>
|
app/design/adminhtml/default/default/template/{taxce → vertexsmb}/addresschange-popup-content.phtml
RENAMED
@@ -1,56 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
|
9 |
+
<?php $old_city = $this->getOldCity(); ?>
|
10 |
+
<?php $new_city = $this->getNewCity(); ?>
|
11 |
+
<?php $tax_area_id=$this->getTaxAreaId(); ?>
|
12 |
+
<div class="selectaddress-container step a-item" >
|
13 |
+
<div lass="col1-set">
|
14 |
+
<h3><?php echo $this->__('Your shipping address has been updated'); ?></h3>
|
15 |
+
<ul class="form-list">
|
16 |
+
|
17 |
+
<li class="control">
|
18 |
+
<label><?php echo $this->__('Original City: %s',ucwords(strtolower($old_city)) ); ?></label>
|
19 |
+
</li>
|
20 |
+
<li class="control">
|
21 |
+
<label><?php echo $this->__('Validated City: %s',ucwords(strtolower($new_city)) ); ?></label>
|
22 |
+
</li>
|
23 |
+
</ul>
|
24 |
+
<div class="buttons-set">
|
25 |
+
<p class="required"> </p>
|
26 |
+
<button onclick="javascript:void(0);" class="button" type="button" id="select-tax-area-button"><span><span><?php echo $this->__('Continue'); ?></span></span></button>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<script type="text/javascript">
|
32 |
+
$("popup-shadow").style.height=$("html-body").getHeight()+'px';
|
33 |
+
$('select-tax-area-id').style.display = "block";
|
34 |
+
$('popup-shadow').style.display = "block";
|
35 |
+
$('select-tax-area-button').observe('click', select_address);
|
36 |
+
|
37 |
+
function select_address(){
|
38 |
+
var tax_area_id="<?php echo $tax_area_id ?>";
|
39 |
+
if (tax_area_id=="undefined" || tax_area_id.length==0) {
|
40 |
+
alert('Please change address');
|
41 |
+
return false;
|
42 |
+
}
|
43 |
+
var new_city="<?php echo $new_city; ?>";
|
44 |
+
|
45 |
+
$('select-tax-area-id').style.display = "none";
|
46 |
+
$('popup-shadow').style.display = "none";
|
47 |
+
|
48 |
+
var request = new Ajax.Request(
|
49 |
+
'<?php echo Mage::getUrl('*/vertexSMB/saveTaxArea');?>' ,
|
50 |
+
{
|
51 |
+
method:'post',
|
52 |
+
onComplete: SelectAddressComplete,
|
53 |
+
parameters: {tax_area_id:tax_area_id, new_city:new_city},
|
54 |
+
}
|
55 |
+
);
|
56 |
+
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
function SelectAddressComplete(){
|
61 |
+
order.loadArea(['totals','shipping_address'], true, {} );
|
62 |
+
}
|
63 |
+
|
64 |
</script>
|
app/design/adminhtml/default/default/template/{taxce → vertexsmb}/popup-content.phtml
RENAMED
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php $tax_area_responses = $this->getResponse(); ?>
|
2 |
<?php $tax_area_responses_array=$tax_area_responses->TaxAreaResponse->TaxAreaResult; ?>
|
3 |
<div class="selectaddress-container step a-item" >
|
@@ -49,7 +56,7 @@
|
|
49 |
|
50 |
|
51 |
var request = new Ajax.Request(
|
52 |
-
'<?php echo Mage::getUrl('
|
53 |
{
|
54 |
method:'post',
|
55 |
onComplete: SelectAddressComplete,
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
?>
|
8 |
<?php $tax_area_responses = $this->getResponse(); ?>
|
9 |
<?php $tax_area_responses_array=$tax_area_responses->TaxAreaResponse->TaxAreaResult; ?>
|
10 |
<div class="selectaddress-container step a-item" >
|
56 |
|
57 |
|
58 |
var request = new Ajax.Request(
|
59 |
+
'<?php echo Mage::getUrl('*/vertexSMB/saveTaxArea');?>' ,
|
60 |
{
|
61 |
method:'post',
|
62 |
onComplete: SelectAddressComplete,
|
app/design/adminhtml/default/default/template/{taxce → vertexsmb}/popup.phtml
RENAMED
@@ -1,5 +1,11 @@
|
|
1 |
-
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<style>
|
4 |
.address-window {z-index:9999; background: #fff; position:absolute; width:500px; height:auto; border: 1px solid #ccc; top: 55%; left:30%; display:none; }
|
5 |
.selectaddress-container { margin:auto; padding: 25px;}
|
@@ -13,7 +19,8 @@
|
|
13 |
</div>
|
14 |
<div id="popup-shadow" class="bg-shadow"> </div>
|
15 |
<script type="text/javascript">
|
16 |
-
|
|
|
17 |
order.loadArea= function(area, indicator, params){
|
18 |
var url = this.loadBaseUrl;
|
19 |
if (area) {
|
@@ -38,7 +45,7 @@
|
|
38 |
}.bind(this),
|
39 |
|
40 |
onComplete: function() {
|
41 |
-
console.log(params['order[billing_address][city]']);
|
42 |
if ( ( typeof area === 'string' && area!='header' && area!='totals' ) ||
|
43 |
( typeof area === 'object' && area[0]!='totals' && area[0]!='header' ) ||
|
44 |
(typeof params['order[billing_address][city]']!='undefined' || typeof params['order[shipping_address][city]']!='undefined') )
|
@@ -69,7 +76,7 @@
|
|
69 |
|
70 |
function getTaxAreaId(params){
|
71 |
var request = new Ajax.Request(
|
72 |
-
'<?php echo Mage::getUrl('*/
|
73 |
{
|
74 |
method:'post',
|
75 |
/* onComplete: SelectAddressComplete, */
|
@@ -92,10 +99,10 @@
|
|
92 |
}
|
93 |
|
94 |
if (response.error){
|
95 |
-
if ((typeof response.message) == 'string') {
|
96 |
-
|
97 |
-
} else {
|
98 |
-
alert(response.message.join("\n"));
|
99 |
}
|
100 |
|
101 |
return false;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<?php if (Mage::helper('taxce')->IsVertexSMBActive()): ?>
|
9 |
<style>
|
10 |
.address-window {z-index:9999; background: #fff; position:absolute; width:500px; height:auto; border: 1px solid #ccc; top: 55%; left:30%; display:none; }
|
11 |
.selectaddress-container { margin:auto; padding: 25px;}
|
19 |
</div>
|
20 |
<div id="popup-shadow" class="bg-shadow"> </div>
|
21 |
<script type="text/javascript">
|
22 |
+
|
23 |
+
|
24 |
order.loadArea= function(area, indicator, params){
|
25 |
var url = this.loadBaseUrl;
|
26 |
if (area) {
|
45 |
}.bind(this),
|
46 |
|
47 |
onComplete: function() {
|
48 |
+
/*console.log(params['order[billing_address][city]']); */
|
49 |
if ( ( typeof area === 'string' && area!='header' && area!='totals' ) ||
|
50 |
( typeof area === 'object' && area[0]!='totals' && area[0]!='header' ) ||
|
51 |
(typeof params['order[billing_address][city]']!='undefined' || typeof params['order[shipping_address][city]']!='undefined') )
|
76 |
|
77 |
function getTaxAreaId(params){
|
78 |
var request = new Ajax.Request(
|
79 |
+
'<?php echo Mage::getUrl('*/vertexSMB/TaxArea');?>' ,
|
80 |
{
|
81 |
method:'post',
|
82 |
/* onComplete: SelectAddressComplete, */
|
99 |
}
|
100 |
|
101 |
if (response.error){
|
102 |
+
if ((typeof response.message) == 'string') {
|
103 |
+
alert(response.message);
|
104 |
+
} else {
|
105 |
+
alert(response.message.join("\n"));
|
106 |
}
|
107 |
|
108 |
return false;
|
app/design/frontend/base/default/layout/taxce.xml
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<checkout_onepage_index>
|
4 |
-
<update handle="taxce_popup" />
|
5 |
-
</checkout_onepage_index>
|
6 |
-
|
7 |
-
<taxce_popup>
|
8 |
-
<reference name="before_body_end">
|
9 |
-
<block type="page/html" template="taxce/popup.phtml"/>
|
10 |
-
</reference>
|
11 |
-
</taxce_popup>
|
12 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/vertexsmb.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @package VertexSMB_TaxCE
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<layout version="0.1.0">
|
10 |
+
<checkout_onepage_index>
|
11 |
+
<update handle="vertexsmb_popup" />
|
12 |
+
</checkout_onepage_index>
|
13 |
+
|
14 |
+
<vertexsmb_popup>
|
15 |
+
<reference name="before_body_end">
|
16 |
+
<block type="core/template" template="vertexsmb/popup.phtml"/>
|
17 |
+
</reference>
|
18 |
+
</vertexsmb_popup>
|
19 |
+
</layout>
|
app/design/frontend/base/default/template/{taxce → vertexsmb}/addresschange-popup-content.phtml
RENAMED
@@ -1,71 +1,78 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
</
|
22 |
-
|
23 |
-
<
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</script>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<?php $old_city = $this->getOldCity(); ?>
|
9 |
+
<?php $new_city = $this->getNewCity(); ?>
|
10 |
+
<?php $tax_area_id=$this->getTaxAreaId(); ?>
|
11 |
+
<div class="selectaddress-container step a-item" >
|
12 |
+
<div lass="col1-set">
|
13 |
+
<h3><?php echo $this->__('Your shipping address has been updated'); ?></h3>
|
14 |
+
<ul class="form-list">
|
15 |
+
|
16 |
+
<li class="control">
|
17 |
+
<label><?php echo $this->__('Original City: %s',ucwords(strtolower($old_city)) ); ?></label>
|
18 |
+
</li>
|
19 |
+
<li class="control">
|
20 |
+
<label><?php echo $this->__('Validated City: %s',ucwords(strtolower($new_city)) ); ?></label>
|
21 |
+
</li>
|
22 |
+
</ul>
|
23 |
+
<div class="buttons-set">
|
24 |
+
<p class="required"> </p>
|
25 |
+
<button onclick="javascript:void(0);" class="button" type="button" id="onepage-select-tax-area-button"><span><span><?php echo $this->__('Continue'); ?></span></span></button>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
<script type="text/javascript">
|
31 |
+
|
32 |
+
$('opc-selectaddress').style.display = "block";
|
33 |
+
$('popup-shadow').style.display = "block";
|
34 |
+
$('onepage-select-tax-area-button').observe('click', select_address);
|
35 |
+
|
36 |
+
function select_address(){
|
37 |
+
var tax_area_id="<?php echo $tax_area_id ?>";
|
38 |
+
if (tax_area_id=="undefined" || tax_area_id.length==0) {
|
39 |
+
alert('Please change address');
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
var new_city="<?php echo $new_city; ?>";
|
43 |
+
|
44 |
+
$('opc-selectaddress').style.display = "none";
|
45 |
+
$('popup-shadow').style.display = "none";
|
46 |
+
if ( typeof shipping !== 'undefined' ) {
|
47 |
+
var success_event=shipping;
|
48 |
+
var form_object=$('co-shipping-form');
|
49 |
+
}else {
|
50 |
+
var success_event=billing;
|
51 |
+
var form_object=$('co-billing-form');
|
52 |
+
}
|
53 |
+
form_object.innerHTML +='<input id="tax_area_id_el" type="hidden" name="tax_area_id" value="'+tax_area_id+'" />\n\
|
54 |
+
<input id="tax_new_city_el" type="hidden" name="tax_new_city" value="'+new_city+'" />';
|
55 |
+
|
56 |
+
|
57 |
+
var request = new Ajax.Request(
|
58 |
+
'<?php echo Mage::getUrl('checkout/onepage/saveTaxArea');?>' ,
|
59 |
+
{
|
60 |
+
method:'post',
|
61 |
+
onComplete: SelectAddressComplete,
|
62 |
+
onSuccess: success_event.onSave,
|
63 |
+
parameters: form_object.serialize(true)
|
64 |
+
}
|
65 |
+
);
|
66 |
+
console.log(tax_area_id);
|
67 |
+
}
|
68 |
+
|
69 |
+
function SelectAddressComplete(){
|
70 |
+
$('tax_area_id_el').remove();
|
71 |
+
$('tax_new_city_el').remove();
|
72 |
+
checkout.reloadProgressBlock('billing');
|
73 |
+
checkout.reloadProgressBlock('shipping');
|
74 |
+
checkout.reloadProgressBlock('shipping_method');
|
75 |
+
checkout.reloadProgressBlock('payment_method');
|
76 |
+
}
|
77 |
+
|
78 |
</script>
|
app/design/frontend/base/default/template/{taxce → vertexsmb}/popup-content.phtml
RENAMED
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php $tax_area_responses = $this->getResponse(); ?>
|
2 |
<?php $tax_area_responses_array=$tax_area_responses->TaxAreaResponse->TaxAreaResult; ?>
|
3 |
<div class="selectaddress-container step a-item" >
|
@@ -42,8 +49,11 @@
|
|
42 |
alert('Please select address');
|
43 |
return false;
|
44 |
}
|
|
|
|
|
45 |
var new_city=$('tax_city_'+tax_area_id).value;
|
46 |
|
|
|
47 |
$('opc-selectaddress').style.display = "none";
|
48 |
$('popup-shadow').style.display = "none";
|
49 |
if ( typeof shipping !== 'undefined' ) {
|
@@ -71,7 +81,7 @@
|
|
71 |
|
72 |
function SelectAddressComplete(){
|
73 |
$('tax_area_id_el').remove();
|
74 |
-
$('tax_new_city_el').remove();
|
75 |
checkout.reloadProgressBlock('billing');
|
76 |
checkout.reloadProgressBlock('shipping');
|
77 |
checkout.reloadProgressBlock('shipping_method');
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
?>
|
8 |
<?php $tax_area_responses = $this->getResponse(); ?>
|
9 |
<?php $tax_area_responses_array=$tax_area_responses->TaxAreaResponse->TaxAreaResult; ?>
|
10 |
<div class="selectaddress-container step a-item" >
|
49 |
alert('Please select address');
|
50 |
return false;
|
51 |
}
|
52 |
+
|
53 |
+
|
54 |
var new_city=$('tax_city_'+tax_area_id).value;
|
55 |
|
56 |
+
|
57 |
$('opc-selectaddress').style.display = "none";
|
58 |
$('popup-shadow').style.display = "none";
|
59 |
if ( typeof shipping !== 'undefined' ) {
|
81 |
|
82 |
function SelectAddressComplete(){
|
83 |
$('tax_area_id_el').remove();
|
84 |
+
$('tax_new_city_el').remove();
|
85 |
checkout.reloadProgressBlock('billing');
|
86 |
checkout.reloadProgressBlock('shipping');
|
87 |
checkout.reloadProgressBlock('shipping_method');
|
app/design/frontend/base/default/template/{taxce → vertexsmb}/popup.phtml
RENAMED
@@ -1,4 +1,11 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<style>
|
3 |
.address-window {z-index:9999; background: #fff; position:absolute; width:500px; height:auto; border: 1px solid #ccc; top: 40%; left:30%; display:none; }
|
4 |
.selectaddress-container { margin:auto; padding: 25px;}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package VertexSMB_TaxCE
|
4 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
5 |
+
* @author Alex Lukyanau
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
<?php if (Mage::helper('taxce')->IsVertexSMBActive()): ?>
|
9 |
<style>
|
10 |
.address-window {z-index:9999; background: #fff; position:absolute; width:500px; height:auto; border: 1px solid #ccc; top: 40%; left:30%; display:none; }
|
11 |
.selectaddress-container { margin:auto; padding: 25px;}
|
app/etc/modules/VertexSMB_TaxCE.xml
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<VertexSMB_TaxCE>
|
1 |
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @package VertexSMB_TaxCE
|
5 |
+
* @license http://opensource.org/licenses/OSL-3.0 The Open Software License 3.0 (OSL 3.0)
|
6 |
+
* @author Alex Lukyanau
|
7 |
+
*/
|
8 |
+
-->
|
9 |
<config>
|
10 |
<modules>
|
11 |
<VertexSMB_TaxCE>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VertexSMB_TaxCE</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Sales and Use Tax Automation</summary>
|
10 |
<description>Built on industry-leading Vertex software, Vertex SMB offers a proven, accurate, and simple sales and use tax solution for small to medium-sized businesses that integrates directly with Magento. This cloud-based, scalable solution allows customers to manage complex sales and use tax across multiple jurisdictions and states. Vertex SMB runs on a pay-as-you-go pricing model with no upfront fees, and provides tax calculations and returns in one comprehensive solution, resulting in signature-ready PDF returns at no additional charge.</description>
|
11 |
-
<notes>
|
12 |
<authors><author><name>Vertex SMB</name><user>VertexSMB</user><email>support@vertexSMB.com</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magelocal"><dir name="VertexSMB"><dir name="TaxCE"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><file name="View.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VertexSMB_TaxCE</name>
|
4 |
+
<version>1.1.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Sales and Use Tax Automation</summary>
|
10 |
<description>Built on industry-leading Vertex software, Vertex SMB offers a proven, accurate, and simple sales and use tax solution for small to medium-sized businesses that integrates directly with Magento. This cloud-based, scalable solution allows customers to manage complex sales and use tax across multiple jurisdictions and states. Vertex SMB runs on a pay-as-you-go pricing model with no upfront fees, and provides tax calculations and returns in one comprehensive solution, resulting in signature-ready PDF returns at no additional charge.</description>
|
11 |
+
<notes> - Fixed bug "Object of class stdClass could not be converted to double" when customer adds product to cart</notes>
|
12 |
<authors><author><name>Vertex SMB</name><user>VertexSMB</user><email>support@vertexSMB.com</email></author></authors>
|
13 |
+
<date>2015-08-18</date>
|
14 |
+
<time>16:21:19</time>
|
15 |
+
<contents><target name="magelocal"><dir name="VertexSMB"><dir name="TaxCE"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><file name="View.php" hash="4398798a0e8bb691b5355ed614775223"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="ShippingCodes.php" hash="e281a250118dbc5d0f3d9f68adbcafb5"/><file name="VertexSMBStatus.php" hash="9de3aa176e27f26af6348924ed871d21"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="b85e695fe836e7a87e97ff55d9c18074"/><file name="Data.php" hash="c98af2c1995f27ad0a1f26e57e2d7c1f"/></dir><dir name="Model"><file name="Observer.php" hash="b9353d3b287a751f76ddc2da1c327e9d"/><file name="RequestItem.php" hash="87d54b83c59efbb7f4670e85e2204327"/><dir name="Resource"><file name="Setup.php" hash="704dac02b22a1e8c5ab29da4de4aeec0"/><dir name="TaxRequest"><file name="Collection.php" hash="13ad33ed10990a4def5a2e5ca375232a"/></dir><file name="TaxRequest.php" hash="d0ace8df43583036b656bccb31e9a86c"/></dir><dir name="Source"><file name="Taxinvoice.php" hash="ae36306cc712474eb24f9c7809710d70"/><file name="Usregions.php" hash="250e9f4291a12b33267eb577ed469d34"/></dir><dir name="Tax"><dir name="Sales"><dir name="Total"><dir name="Quote"><file name="Tax.php" hash="d36ef5320486ce02e4f4a7fee1ae92fa"/></dir></dir></dir></dir><file name="TaxAreaRequest.php" hash="aeef925be94c81eb329867798822d63c"/><file name="TaxAreaResponse.php" hash="3af622ec7c859f1898181758632a9846"/><file name="TaxInvoice.php" hash="aee7c25367baa70db7b6c4b42345f700"/><file name="TaxQuote.php" hash="464fc5b66d9acec5d8ab26d41ea998f7"/><file name="TaxQuoteResponse.php" hash="220bff64c4d40d8ad4a4b1450d05f51b"/><file name="TaxRequest.php" hash="cef4d43d7d4f34c253f834ff9c2e4300"/><file name="VertexSMB.php" hash="56f7a9da6869924ee480d9a8b613d04e"/></dir><dir name="controllers"><file name="OnepageController.php" hash="9d8841c1be268553e02767adcde8e8b6"/><file name="VertexSMBController.php" hash="a49d257949b7a261dfabdd169ad1087f"/></dir><dir name="data"><dir name="taxce_setup"><file name="data-install-0.1.1.php" hash="3fdaa84edd5b8b2c4fee9c94238a9a0a"/><file name="data-upgrade-0.1.4-0.1.5.php" hash="7aa5fe2857bb2903cebcfa086ae31a92"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f71cfdfac25d0023ee3cbf1547322ef6"/><file name="config.xml" hash="6f407baad498f5deb091f88796a66cd4"/><file name="system.xml" hash="833c977b6158ea6387877153047aa9d6"/></dir><dir name="sql"><dir name="taxce_setup"><file name="mysql4-install-0.1.1.php" hash="f898612c40edbd0b0adf89c82985d37a"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="6c934924c36ae65434275ceee78a9a10"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="f34c5c681ed0514bcffb798267cbe596"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="cff2b3726daaeae0fb50ac3c99a9114c"/><file name="mysql4-upgrade-1.1.0-1.1.1.php" hash="e5fb1826eda6975e19aece9be5302ac6"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VertexSMB_TaxCE.xml" hash="f4aeca6acb09d5666f5e0d5450a1bc03"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="vertexsmb.xml" hash="53772aad58b12196ccd043376f7883fb"/></dir><dir name="template"><dir name="vertexsmb"><file name="addresschange-popup-content.phtml" hash="25f39d390fcee2b2c1982ca4a9cbfcd8"/><file name="popup-content.phtml" hash="991723bfca8f11a3eab34162d8f97321"/><file name="popup.phtml" hash="bc05a25f9868445666b44cb7c290a91b"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="vertexsmb.xml" hash="3d1acd91ba402257f8ce2b4df89dce9f"/></dir><dir name="template"><dir name="vertexsmb"><file name="addresschange-popup-content.phtml" hash="69c05b7c70a9ec788e554f5eeae6edc4"/><file name="popup-content.phtml" hash="26252a6383a45dd7958c5f81bbb41431"/><file name="popup.phtml" hash="c6441cb7b74e14b2d6d60d830f2ad3a0"/></dir></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|