WhiteSunrise_Bongo_International - Version 1.2.1

Version Notes

New and improved module with full International support for Bongo Checkout and Bongo Export

Download this release

Release Info

Developer Brent Wierson
Extension WhiteSunrise_Bongo_International
Version 1.2.1
Comparing to
See all releases


Version 1.2.1

Files changed (105) hide show
  1. app/code/community/Bongo/International/Block/Adminhtml/CallbackUrl.php +34 -0
  2. app/code/community/Bongo/International/Block/Adminhtml/ContinueUrl.php +34 -0
  3. app/code/community/Bongo/International/Block/Adminhtml/ExportButton.php +28 -0
  4. app/code/community/Bongo/International/Block/Adminhtml/Sales/Order/View/Bongointernational.php +21 -0
  5. app/code/community/Bongo/International/Block/Adminhtml/SyncButton.php +28 -0
  6. app/code/community/Bongo/International/Block/Checkout/Form.php +100 -0
  7. app/code/community/Bongo/International/Block/Checkout/Link.php +12 -0
  8. app/code/community/Bongo/International/Block/Checkout/Redirect.php +22 -0
  9. app/code/community/Bongo/International/Block/Compatibility/Checkout.php +15 -0
  10. app/code/community/Bongo/International/Block/Compatibility/Checkout/Firecheckout.php +5 -0
  11. app/code/community/Bongo/International/Block/Compatibility/Checkout/Onestepcheckout.php +5 -0
  12. app/code/community/Bongo/International/Block/Currency/Selector.php +340 -0
  13. app/code/community/Bongo/International/Block/Currency/Selector/Default.php +5 -0
  14. app/code/community/Bongo/International/Block/Currency/Selector/Experimental.php +11 -0
  15. app/code/community/Bongo/International/Block/Currency/Selector/Lightbox.php +11 -0
  16. app/code/community/Bongo/International/Block/Extend/Code.php +15 -0
  17. app/code/community/Bongo/International/Block/Sales/Order/Totals.php +23 -0
  18. app/code/community/Bongo/International/Helper/Data.php +30 -0
  19. app/code/community/Bongo/International/Model/Adminhtml/DefaultCountry.php +13 -0
  20. app/code/community/Bongo/International/Model/Adminhtml/IntegrationType.php +9 -0
  21. app/code/community/Bongo/International/Model/Adminhtml/ShippingMethods.php +7 -0
  22. app/code/community/Bongo/International/Model/Adminhtml/ShippingType.php +30 -0
  23. app/code/community/Bongo/International/Model/Adminhtml/SyncFrequency.php +13 -0
  24. app/code/community/Bongo/International/Model/Adminhtml/TransferType.php +7 -0
  25. app/code/community/Bongo/International/Model/Currency/Cache.php +25 -0
  26. app/code/community/Bongo/International/Model/Currency/Converter.php +51 -0
  27. app/code/community/Bongo/International/Model/Order/Observer.php +134 -0
  28. app/code/community/Bongo/International/Model/Payment/Standard.php +20 -0
  29. app/code/community/Bongo/International/Model/Products/Status.php +32 -0
  30. app/code/community/Bongo/International/Model/Products/Sync.php +111 -0
  31. app/code/community/Bongo/International/Model/Resource/Status.php +7 -0
  32. app/code/community/Bongo/International/Model/Resource/Status/Collection.php +7 -0
  33. app/code/community/Bongo/International/Model/Shipping/Carrier/Bongo.php +258 -0
  34. app/code/community/Bongo/International/Model/Shipping/Observer.php +124 -0
  35. app/code/community/Bongo/International/Model/Status.php +7 -0
  36. app/code/community/Bongo/International/Model/Total/Duty/Creditmemo.php +28 -0
  37. app/code/community/Bongo/International/Model/Total/Duty/Invoice.php +28 -0
  38. app/code/community/Bongo/International/Model/Total/Duty/Quote.php +61 -0
  39. app/code/community/Bongo/International/Model/Total/Insurance/Creditmemo.php +28 -0
  40. app/code/community/Bongo/International/Model/Total/Insurance/Invoice.php +28 -0
  41. app/code/community/Bongo/International/Model/Total/Insurance/Quote.php +61 -0
  42. app/code/community/Bongo/International/Model/Total/Tax/Creditmemo.php +28 -0
  43. app/code/community/Bongo/International/Model/Total/Tax/Invoice.php +28 -0
  44. app/code/community/Bongo/International/Model/Total/Tax/Quote.php +61 -0
  45. app/code/community/Bongo/International/controllers/Adminhtml/BongointernationalController.php +86 -0
  46. app/code/community/Bongo/International/controllers/CallbackController.php +269 -0
  47. app/code/community/Bongo/International/controllers/ContinueController.php +23 -0
  48. app/code/community/Bongo/International/etc/config.xml +357 -0
  49. app/code/community/Bongo/International/etc/system.xml +588 -0
  50. app/code/community/Bongo/International/lib/IP2Location.php +776 -0
  51. app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-install-1.1.2.php +38 -0
  52. app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-install-1.2.0.php +41 -0
  53. app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-install-1.2.1.php +46 -0
  54. app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-upgrade-1.1.2-1.2.0.php +9 -0
  55. app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-upgrade-1.2.0-1.2.1.php +11 -0
  56. app/design/adminhtml/default/default/layout/bongointernational.xml +31 -0
  57. app/design/adminhtml/default/default/template/bongointernational/sales/order/view/bongointernational.phtml +110 -0
  58. app/design/frontend/base/default/layout/bongointernational.xml +93 -0
  59. app/design/frontend/base/default/template/bongointernational/checkout/form.phtml +80 -0
  60. app/design/frontend/base/default/template/bongointernational/checkout/link.phtml +3 -0
  61. app/design/frontend/base/default/template/bongointernational/checkout/redirect.phtml +12 -0
  62. app/design/frontend/base/default/template/bongointernational/compatibility/checkout.phtml +21 -0
  63. app/design/frontend/base/default/template/bongointernational/compatibility/checkout/firecheckout.phtml +110 -0
  64. app/design/frontend/base/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml +101 -0
  65. app/design/frontend/base/default/template/bongointernational/currency/selector/default.phtml +53 -0
  66. app/design/frontend/base/default/template/bongointernational/currency/selector/experimental.phtml +53 -0
  67. app/design/frontend/base/default/template/bongointernational/currency/selector/lightbox.phtml +67 -0
  68. app/design/frontend/base/default/template/bongointernational/extend/code.phtml +3 -0
  69. app/design/frontend/default/default/layout/bongointernational.xml +93 -0
  70. app/design/frontend/default/default/template/bongointernational/checkout/form.phtml +80 -0
  71. app/design/frontend/default/default/template/bongointernational/checkout/link.phtml +3 -0
  72. app/design/frontend/default/default/template/bongointernational/checkout/redirect.phtml +12 -0
  73. app/design/frontend/default/default/template/bongointernational/compatibility/checkout.phtml +21 -0
  74. app/design/frontend/default/default/template/bongointernational/compatibility/checkout/firecheckout.phtml +110 -0
  75. app/design/frontend/default/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml +101 -0
  76. app/design/frontend/default/default/template/bongointernational/currency/selector/default.phtml +53 -0
  77. app/design/frontend/default/default/template/bongointernational/currency/selector/experimental.phtml +53 -0
  78. app/design/frontend/default/default/template/bongointernational/currency/selector/lightbox.phtml +67 -0
  79. app/design/frontend/default/default/template/bongointernational/extend/code.phtml +3 -0
  80. app/design/frontend/enterprise/default/layout/bongointernational.xml +93 -0
  81. app/design/frontend/enterprise/default/template/bongointernational/checkout/form.phtml +80 -0
  82. app/design/frontend/enterprise/default/template/bongointernational/checkout/link.phtml +3 -0
  83. app/design/frontend/enterprise/default/template/bongointernational/checkout/redirect.phtml +12 -0
  84. app/design/frontend/enterprise/default/template/bongointernational/compatibility/checkout.phtml +21 -0
  85. app/design/frontend/enterprise/default/template/bongointernational/compatibility/checkout/firecheckout.phtml +110 -0
  86. app/design/frontend/enterprise/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml +101 -0
  87. app/design/frontend/enterprise/default/template/bongointernational/currency/selector/default.phtml +53 -0
  88. app/design/frontend/enterprise/default/template/bongointernational/currency/selector/experimental.phtml +53 -0
  89. app/design/frontend/enterprise/default/template/bongointernational/currency/selector/lightbox.phtml +67 -0
  90. app/design/frontend/enterprise/default/template/bongointernational/extend/code.phtml +3 -0
  91. app/design/frontend/rwd/default/layout/bongointernational.xml +93 -0
  92. app/design/frontend/rwd/default/template/bongointernational/checkout/form.phtml +80 -0
  93. app/design/frontend/rwd/default/template/bongointernational/checkout/link.phtml +3 -0
  94. app/design/frontend/rwd/default/template/bongointernational/checkout/redirect.phtml +12 -0
  95. app/design/frontend/rwd/default/template/bongointernational/compatibility/checkout.phtml +21 -0
  96. app/design/frontend/rwd/default/template/bongointernational/compatibility/checkout/firecheckout.phtml +110 -0
  97. app/design/frontend/rwd/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml +101 -0
  98. app/design/frontend/rwd/default/template/bongointernational/currency/selector/default.phtml +53 -0
  99. app/design/frontend/rwd/default/template/bongointernational/currency/selector/experimental.phtml +53 -0
  100. app/design/frontend/rwd/default/template/bongointernational/currency/selector/lightbox.phtml +67 -0
  101. app/design/frontend/rwd/default/template/bongointernational/extend/code.phtml +3 -0
  102. app/etc/modules/Bongo_International.xml +12 -0
  103. app/locale/en_US/Bongo_International.csv +6 -0
  104. package.xml +22 -0
  105. var/bongointernational/IP2LOCATION-LITE-DB1.BIN +0 -0
app/code/community/Bongo/International/Block/Adminhtml/CallbackUrl.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Block_Adminhtml_CallbackUrl extends Mage_Adminhtml_Block_System_Config_Form_Field {
3
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
4
+ $this->setElement ( $element );
5
+
6
+ $store_id = null;
7
+
8
+ $website = Mage::app ()->getRequest ()->getParam ( 'website' );
9
+ $store = Mage::app ()->getRequest ()->getParam ( 'store' );
10
+
11
+ if (! empty ( $store )) {
12
+ $store_id = Mage::getModel ( 'core/store' )->load ( $store )->getId ();
13
+ } else if (! empty ( $website )) {
14
+ $website_id = Mage::getModel ( 'core/website' )->load ( $website )->getId ();
15
+ $store_id = Mage::app ()->getWebsite ( $website_id )->getDefaultStore ()->getId ();
16
+ } else {
17
+ $websites = Mage::app ()->getWebsites ();
18
+
19
+ foreach ( $websites as $website ) {
20
+ $store_id = Mage::app ()->getWebsite ( $website->getId () )->getDefaultStore ()->getId ();
21
+
22
+ break;
23
+ }
24
+ }
25
+
26
+ $url = Mage::app ()->getStore ( $store_id )->getUrl ( 'bongointernational/callback', array ('_secure' => 1, '_forced_secure' => 1, '_nosid' => 1 ) );
27
+
28
+ $html = <<<END
29
+ <input type="text" id="{$element->getHtmlId()}" value="{$url}" readonly="readonly" class=" input-text" onclick="this.select()" />
30
+ END;
31
+
32
+ return $html;
33
+ }
34
+ }
app/code/community/Bongo/International/Block/Adminhtml/ContinueUrl.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Block_Adminhtml_ContinueUrl extends Mage_Adminhtml_Block_System_Config_Form_Field {
3
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
4
+ $this->setElement ( $element );
5
+
6
+ $store_id = null;
7
+
8
+ $website = Mage::app ()->getRequest ()->getParam ( 'website' );
9
+ $store = Mage::app ()->getRequest ()->getParam ( 'store' );
10
+
11
+ if (! empty ( $store )) {
12
+ $store_id = Mage::getModel ( 'core/store' )->load ( $store )->getId ();
13
+ } else if (! empty ( $website )) {
14
+ $website_id = Mage::getModel ( 'core/website' )->load ( $website )->getId ();
15
+ $store_id = Mage::app ()->getWebsite ( $website_id )->getDefaultStore ()->getId ();
16
+ } else {
17
+ $websites = Mage::app ()->getWebsites ();
18
+
19
+ foreach ( $websites as $website ) {
20
+ $store_id = Mage::app ()->getWebsite ( $website->getId () )->getDefaultStore ()->getId ();
21
+
22
+ break;
23
+ }
24
+ }
25
+
26
+ $url = Mage::app ()->getStore ( $store_id )->getUrl ( 'bongointernational/continue', array ('_secure' => 1, '_forced_secure' => 1, '_nosid' => 1 ) );
27
+
28
+ $html = <<<END
29
+ <input type="text" id="{$element->getHtmlId()}" value="{$url}" readonly="readonly" class=" input-text" onclick="this.select()" />
30
+ END;
31
+
32
+ return $html;
33
+ }
34
+ }
app/code/community/Bongo/International/Block/Adminhtml/ExportButton.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Block_Adminhtml_ExportButton extends Mage_Adminhtml_Block_System_Config_Form_Field {
3
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
4
+ $this->setElement ( $element );
5
+ $url = $this->getUrl ( 'adminhtml/bongointernational/export' . $this->_appendParams () );
6
+
7
+ $html = $this->getLayout ()->createBlock ( 'adminhtml/widget_button' )->setType ( 'button' )->setClass ( 'scalable' )->setLabel ( Mage::helper ( 'bongointernational' )->__ ( 'Export Now!' ) )->setOnClick ( "setLocation('$url')" )->toHtml ();
8
+
9
+ return $html;
10
+ }
11
+
12
+ protected function _appendParams() {
13
+ $params = null;
14
+
15
+ $website = Mage::app ()->getRequest ()->getParam ( 'website' );
16
+ $store = Mage::app ()->getRequest ()->getParam ( 'store' );
17
+
18
+ if (! empty ( $website )) {
19
+ $params .= "/website/{$website}";
20
+ }
21
+
22
+ if (! empty ( $store )) {
23
+ $params .= "/store/{$store}";
24
+ }
25
+
26
+ return $params;
27
+ }
28
+ }
app/code/community/Bongo/International/Block/Adminhtml/Sales/Order/View/Bongointernational.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Adminhtml_Sales_Order_View_Bongointernational extends Mage_Adminhtml_Block_Sales_Order_Abstract {
4
+ public function getIsEnabled($store_id = null) {
5
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type', $store_id ), array ("2", "3" ) )) {
6
+ return true;
7
+ } else {
8
+ return false;
9
+ }
10
+ }
11
+
12
+ public function getOrderStatusHistory($order_id = null) {
13
+ $history = Mage::getModel ( 'bongointernational/status' )->getCollection ();
14
+
15
+ if (! empty ( $order_id )) {
16
+ $history->addFieldToFilter ( 'order_id', $order_id );
17
+ }
18
+
19
+ return $history;
20
+ }
21
+ }
app/code/community/Bongo/International/Block/Adminhtml/SyncButton.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Block_Adminhtml_SyncButton extends Mage_Adminhtml_Block_System_Config_Form_Field {
3
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
4
+ $this->setElement ( $element );
5
+ $url = $this->getUrl ( 'adminhtml/bongointernational/sync' . $this->_appendParams () );
6
+
7
+ $html = $this->getLayout ()->createBlock ( 'adminhtml/widget_button' )->setType ( 'button' )->setClass ( 'scalable' )->setLabel ( Mage::helper ( 'bongointernational' )->__ ( 'Run Now!' ) )->setOnClick ( "setLocation('$url')" )->toHtml ();
8
+
9
+ return $html;
10
+ }
11
+
12
+ protected function _appendParams() {
13
+ $params = null;
14
+
15
+ $website = Mage::app ()->getRequest ()->getParam ( 'website' );
16
+ $store = Mage::app ()->getRequest ()->getParam ( 'store' );
17
+
18
+ if (! empty ( $website )) {
19
+ $params .= "/website/{$website}";
20
+ }
21
+
22
+ if (! empty ( $store )) {
23
+ $params .= "/store/{$store}";
24
+ }
25
+
26
+ return $params;
27
+ }
28
+ }
app/code/community/Bongo/International/Block/Checkout/Form.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Checkout_Form extends Mage_Core_Block_Template {
4
+ public function getIsEnabled() {
5
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ) == "2") {
6
+ return true;
7
+ } else {
8
+ return false;
9
+ }
10
+ }
11
+
12
+ public function getCheckoutUrl() {
13
+ return Mage::getStoreConfig ( 'bongointernational_config/config/checkout_url' );
14
+ }
15
+
16
+ public function getApiKey() {
17
+ return Mage::getStoreConfig ( 'bongointernational_config/config/api_key' );
18
+ }
19
+
20
+ public function getBillingAddress() {
21
+ return $this->_getQuote ()->getBillingAddress ();
22
+ }
23
+
24
+ public function getShippingAddress() {
25
+ return $this->_getQuote ()->getShippingAddress ();
26
+ }
27
+
28
+ public function getBillingRegion() {
29
+ $region = $this->getBillingAddress ()->getRegionId ();
30
+
31
+ if (empty ( $region )) {
32
+ $region = $this->getBillingAddress ()->getRegion ();
33
+ } else {
34
+ $region = Mage::getModel ( 'directory/region' )->load ( $region )->getName ();
35
+ }
36
+
37
+ return $region;
38
+ }
39
+
40
+ public function getShippingRegion() {
41
+ $region = $this->getShippingAddress ()->getRegionId ();
42
+
43
+ if (empty ( $region )) {
44
+ $region = $this->getShippingAddress ()->getRegion ();
45
+ } else {
46
+ $region = Mage::getModel ( 'directory/region' )->load ( $region )->getName ();
47
+ }
48
+
49
+ return $region;
50
+ }
51
+
52
+ public function getShippingCountry() {
53
+ $country = $this->getShippingAddress ()->getCountryId ();
54
+
55
+ if (empty ( $country )) {
56
+ $country = $this->getRequest ()->getParam ( '__country' );
57
+ }
58
+
59
+ if (empty ( $country )) {
60
+ $country = Mage::getSingleton ( 'core/session' )->getBongoCustomerCountry ();
61
+ }
62
+
63
+ return $country;
64
+ }
65
+
66
+ public function getQuoteId() {
67
+ return $this->_getQuote ()->getId ();
68
+ }
69
+
70
+ public function getCustomerId() {
71
+ $cid = '';
72
+
73
+ if (Mage::getSingleton ( 'customer/session' )->isLoggedIn ()) {
74
+ $_customer = Mage::getSingleton ( 'customer/session' )->getCustomer ();
75
+ $cid = $_customer->getId ();
76
+ }
77
+
78
+ return $cid;
79
+ }
80
+
81
+ public function getCustomerEmail() {
82
+ return $this->_getQuote ()->getCustomerEmail ();
83
+ }
84
+
85
+ public function getDomesticShipping() {
86
+ return round ( Mage::getModel ( 'bongointernational/shipping_carrier_bongo' )->getDomesticShipping ( $this->getItems () ), 2 );
87
+ }
88
+
89
+ public function getItems() {
90
+ return $this->_getQuote ()->getAllVisibleItems ();
91
+ }
92
+
93
+ public function getCurrencyCode() {
94
+ return Mage::getStoreConfig ( Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT );
95
+ }
96
+
97
+ protected function _getQuote() {
98
+ return Mage::getSingleton ( 'checkout/session' )->getQuote ();
99
+ }
100
+ }
app/code/community/Bongo/International/Block/Checkout/Link.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Checkout_Link extends Mage_Core_Block_Template {
4
+ public function getIsEnabled() {
5
+ //if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ) == "2" && (Mage::getStoreConfig ( 'bongointernational_config/config/transfer_type' ) == "1" || Mage::getStoreConfig ( 'bongointernational_config/config/transfer_type' ) == "3") && Mage::getModel ( 'bongointernational/shipping_carrier_bongo' )->checkSkuStatus ( Mage::getSingleton ( 'checkout/session' )->getQuote ()->getAllItems (), false )) {
6
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ) == "2" && (Mage::getStoreConfig ( 'bongointernational_config/config/transfer_type' ) == "1" || Mage::getStoreConfig ( 'bongointernational_config/config/transfer_type' ) == "3")) {
7
+ return true;
8
+ } else {
9
+ return false;
10
+ }
11
+ }
12
+ }
app/code/community/Bongo/International/Block/Checkout/Redirect.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Checkout_Redirect extends Mage_Core_Block_Template {
4
+ public function getIsEnabled() {
5
+ $allowed_countries = explode ( ',', Mage::getStoreConfig ( 'bongointernational_config/config/allow_countries' ) );
6
+
7
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ) == "2" && (Mage::getStoreConfig ( 'bongointernational_config/config/transfer_type' ) == "2" || Mage::getStoreConfig ( 'bongointernational_config/config/transfer_type' ) == "3") && in_array ( Mage::getSingleton ( 'checkout/session' )->getQuote ()->getShippingAddress ()->getCountryId (), $allowed_countries )) {
8
+ /*if (! Mage::getModel ( 'bongointernational/shipping_carrier_bongo' )->checkSkuStatus ( Mage::getSingleton ( 'checkout/session' )->getQuote ()->getAllItems (), true )) {
9
+ session_write_close ();
10
+ $this->_redirect ( 'checkout/cart' );
11
+ }*/
12
+
13
+ return true;
14
+ } else {
15
+ return false;
16
+ }
17
+ }
18
+
19
+ public function getCheckoutUrl() {
20
+ return Mage::getStoreConfig ( 'bongointernational_config/config/checkout_url' );
21
+ }
22
+ }
app/code/community/Bongo/International/Block/Compatibility/Checkout.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Compatibility_Checkout extends Mage_Core_Block_Template {
4
+ public function getIsEnabled() {
5
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) )) {
6
+ return true;
7
+ } else {
8
+ return false;
9
+ }
10
+ }
11
+
12
+ public function getAllowedCountries() {
13
+ return explode ( ',', Mage::getStoreConfig ( 'bongointernational_config/config/allow_countries' ) );
14
+ }
15
+ }
app/code/community/Bongo/International/Block/Compatibility/Checkout/Firecheckout.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Compatibility_Checkout_Firecheckout extends Bongo_International_Block_Compatibility_Checkout {
4
+
5
+ }
app/code/community/Bongo/International/Block/Compatibility/Checkout/Onestepcheckout.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Compatibility_Checkout_Onestepcheckout extends Bongo_International_Block_Compatibility_Checkout {
4
+
5
+ }
app/code/community/Bongo/International/Block/Currency/Selector.php ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Currency_Selector extends Mage_Directory_Block_Currency {
4
+ var $countries = array (), $currencies = array ();
5
+
6
+ public function __construct() {
7
+ $this->countries ["AF"] = array ("name" => "Afghanistan", "currency" => "USD" );
8
+ $this->countries ["AL"] = array ("name" => "Albania", "currency" => "EUR" );
9
+ $this->countries ["DZ"] = array ("name" => "Algeria", "currency" => "DZD" );
10
+ $this->countries ["AS"] = array ("name" => "American Samoa", "currency" => "USD" );
11
+ $this->countries ["AD"] = array ("name" => "Andorra", "currency" => "EUR" );
12
+ $this->countries ["AO"] = array ("name" => "Angola", "currency" => "USD" );
13
+ $this->countries ["AI"] = array ("name" => "Anguilla", "currency" => "XCD" );
14
+ $this->countries ["AG"] = array ("name" => "Antigua", "currency" => "XCD" );
15
+ $this->countries ["AR"] = array ("name" => "Argentina", "currency" => "ARS" );
16
+ $this->countries ["AM"] = array ("name" => "Armenia", "currency" => "AMD" );
17
+ $this->countries ["AW"] = array ("name" => "Aruba", "currency" => "AWG" );
18
+ $this->countries ["AU"] = array ("name" => "Australia", "currency" => "AUD" );
19
+ $this->countries ["AT"] = array ("name" => "Austria", "currency" => "EUR" );
20
+ $this->countries ["AZ"] = array ("name" => "Azerbaijan", "currency" => "AZN" );
21
+ $this->countries ["1F"] = array ("name" => "Azores (Portugal) ", "currency" => "EUR" );
22
+ $this->countries ["BS"] = array ("name" => "Bahamas", "currency" => "BSD" );
23
+ $this->countries ["BH"] = array ("name" => "Bahrain", "currency" => "BHD" );
24
+ $this->countries ["BD"] = array ("name" => "Bangladesh", "currency" => "BDT" );
25
+ $this->countries ["BB"] = array ("name" => "Barbados", "currency" => "BBD" );
26
+ $this->countries ["1A"] = array ("name" => "Barbuda", "currency" => "XCD" );
27
+ $this->countries ["BY"] = array ("name" => "Belarus", "currency" => "BYR" );
28
+ $this->countries ["BE"] = array ("name" => "Belgium", "currency" => "EUR" );
29
+ $this->countries ["BZ"] = array ("name" => "Belize", "currency" => "BZD" );
30
+ $this->countries ["BJ"] = array ("name" => "Benin", "currency" => "XOF" );
31
+ $this->countries ["BM"] = array ("name" => "Bermuda", "currency" => "BMD" );
32
+ $this->countries ["BT"] = array ("name" => "Bhutan", "currency" => "INR" );
33
+ $this->countries ["BO"] = array ("name" => "Bolivia", "currency" => "BOB" );
34
+ $this->countries ["X1"] = array ("name" => "Bonaire", "currency" => "USD" );
35
+ $this->countries ["BA"] = array ("name" => "Bosnia and Herzegovina", "currency" => "EUR" );
36
+ $this->countries ["BW"] = array ("name" => "Botswana", "currency" => "BWP" );
37
+ $this->countries ["BR"] = array ("name" => "Brazil", "currency" => "BRL" );
38
+ $this->countries ["BN"] = array ("name" => "Brunei", "currency" => "BND" );
39
+ $this->countries ["BG"] = array ("name" => "Bulgaria", "currency" => "BGN" );
40
+ $this->countries ["BF"] = array ("name" => "Burkina Faso", "currency" => "XOF" );
41
+ $this->countries ["BI"] = array ("name" => "Burundi", "currency" => "EUR" );
42
+ $this->countries ["KH"] = array ("name" => "Cambodia", "currency" => "KHR" );
43
+ $this->countries ["CM"] = array ("name" => "Cameroon", "currency" => "XAF" );
44
+ $this->countries ["CA"] = array ("name" => "Canada", "currency" => "CAD" );
45
+ $this->countries ["X2"] = array ("name" => "Canary Islands", "currency" => "EUR" );
46
+ $this->countries ["CV"] = array ("name" => "Cape Verde", "currency" => "CVE" );
47
+ $this->countries ["KY"] = array ("name" => "Cayman Islands", "currency" => "KYD" );
48
+ $this->countries ["CF"] = array ("name" => "Central African Republic", "currency" => "XAF" );
49
+ $this->countries ["TD"] = array ("name" => "Chad", "currency" => "XAF" );
50
+ $this->countries ["CL"] = array ("name" => "Chile", "currency" => "CLP" );
51
+ $this->countries ["CN"] = array ("name" => "China", "currency" => "CNY" );
52
+ $this->countries ["CO"] = array ("name" => "Colombia", "currency" => "COP" );
53
+ $this->countries ["MP"] = array ("name" => "Commonwealth No. Mariana Islands", "currency" => "USD" );
54
+ $this->countries ["KM"] = array ("name" => "Comoros Islands", "currency" => "KMF" );
55
+ $this->countries ["CG"] = array ("name" => "Congo", "currency" => "XAF" );
56
+ $this->countries ["CD"] = array ("name" => "Congo, Democratic Republic", "currency" => "EUR" );
57
+ $this->countries ["CK"] = array ("name" => "Cook Islands", "currency" => "NZD" );
58
+ $this->countries ["CR"] = array ("name" => "Costa Rica", "currency" => "CRC" );
59
+ $this->countries ["HR"] = array ("name" => "Croatia", "currency" => "EUR" );
60
+ $this->countries ["CW"] = array ("name" => "Curacao", "currency" => "ANG" );
61
+ $this->countries ["CY"] = array ("name" => "Cyprus", "currency" => "EUR" );
62
+ $this->countries ["CZ"] = array ("name" => "Czech Republic", "currency" => "CZK" );
63
+ $this->countries ["DK"] = array ("name" => "Denmark", "currency" => "DKK" );
64
+ $this->countries ["DJ"] = array ("name" => "Djibouti", "currency" => "DJF" );
65
+ $this->countries ["DM"] = array ("name" => "Dominica", "currency" => "XCD" );
66
+ $this->countries ["DO"] = array ("name" => "Dominican Republic", "currency" => "DOP" );
67
+ $this->countries ["TP"] = array ("name" => "East Timor", "currency" => "USD" );
68
+ $this->countries ["EC"] = array ("name" => "Ecuador", "currency" => "USD" );
69
+ $this->countries ["EG"] = array ("name" => "Egypt", "currency" => "EGP" );
70
+ $this->countries ["SV"] = array ("name" => "El Salvador", "currency" => "USD" );
71
+ $this->countries ["1D"] = array ("name" => "England (U.K)", "currency" => "GBP" );
72
+ $this->countries ["GQ"] = array ("name" => "Equatorial Guinea", "currency" => "XAF" );
73
+ $this->countries ["ER"] = array ("name" => "Eritrea", "currency" => "EUR" );
74
+ $this->countries ["EE"] = array ("name" => "Estonia", "currency" => "EUR" );
75
+ $this->countries ["ET"] = array ("name" => "Ethiopia", "currency" => "ETB" );
76
+ $this->countries ["FK"] = array ("name" => "Falkland Islands", "currency" => "FKP" );
77
+ $this->countries ["FO"] = array ("name" => "Faroe Islands", "currency" => "DKK" );
78
+ $this->countries ["FJ"] = array ("name" => "Fiji Islands", "currency" => "FJD" );
79
+ $this->countries ["FI"] = array ("name" => "Finland", "currency" => "EUR" );
80
+ $this->countries ["FR"] = array ("name" => "France", "currency" => "EUR" );
81
+ $this->countries ["GF"] = array ("name" => "French Guiana", "currency" => "EUR" );
82
+ $this->countries ["PF"] = array ("name" => "French Polynesia", "currency" => "XPF" );
83
+ $this->countries ["GA"] = array ("name" => "Gabon", "currency" => "XAF" );
84
+ $this->countries ["GM"] = array ("name" => "Gambia", "currency" => "GMD" );
85
+ $this->countries ["GE"] = array ("name" => "Georgia", "currency" => "GEL" );
86
+ $this->countries ["DE"] = array ("name" => "Germany", "currency" => "EUR" );
87
+ $this->countries ["GH"] = array ("name" => "Ghana", "currency" => "USD" );
88
+ $this->countries ["GI"] = array ("name" => "Gibraltar", "currency" => "GIP" );
89
+ $this->countries ["GR"] = array ("name" => "Greece", "currency" => "EUR" );
90
+ $this->countries ["GL"] = array ("name" => "Greenland", "currency" => "DKK" );
91
+ $this->countries ["GD"] = array ("name" => "Grenada", "currency" => "XCD" );
92
+ $this->countries ["GP"] = array ("name" => "Guadeloupe", "currency" => "EUR" );
93
+ $this->countries ["GU"] = array ("name" => "Guam", "currency" => "USD" );
94
+ $this->countries ["GT"] = array ("name" => "Guatemala", "currency" => "GTQ" );
95
+ $this->countries ["GG"] = array ("name" => "Guernsey", "currency" => "GBP" );
96
+ $this->countries ["GN"] = array ("name" => "Guinea", "currency" => "GNF" );
97
+ $this->countries ["GW"] = array ("name" => "Guinea-Bissau", "currency" => "XOF" );
98
+ $this->countries ["GY"] = array ("name" => "Guyana", "currency" => "GYD" );
99
+ $this->countries ["HT"] = array ("name" => "Haiti", "currency" => "USD" );
100
+ $this->countries ["HN"] = array ("name" => "Honduras", "currency" => "HNL" );
101
+ $this->countries ["HK"] = array ("name" => "Hong Kong", "currency" => "HKD" );
102
+ $this->countries ["HU"] = array ("name" => "Hungary", "currency" => "HUF" );
103
+ $this->countries ["IS"] = array ("name" => "Iceland", "currency" => "ISK" );
104
+ $this->countries ["IN"] = array ("name" => "India", "currency" => "INR" );
105
+ $this->countries ["ID"] = array ("name" => "Indonesia", "currency" => "IDR" );
106
+ $this->countries ["IR"] = array ("name" => "Iran", "currency" => "EUR" );
107
+ $this->countries ["IQ"] = array ("name" => "Iraq", "currency" => "USD" );
108
+ $this->countries ["1E"] = array ("name" => "Ireland, Northern (U.K.) ", "currency" => "GBP" );
109
+ $this->countries ["IE"] = array ("name" => "Ireland, Republic of ", "currency" => "EUR" );
110
+ $this->countries ["IL"] = array ("name" => "Israel", "currency" => "ILS" );
111
+ $this->countries ["IT"] = array ("name" => "Italy", "currency" => "EUR" );
112
+ $this->countries ["CI"] = array ("name" => "Ivory Coast", "currency" => "XOF" );
113
+ $this->countries ["JM"] = array ("name" => "Jamaica", "currency" => "JMD" );
114
+ $this->countries ["JP"] = array ("name" => "Japan", "currency" => "JPY" );
115
+ $this->countries ["JE"] = array ("name" => "Jersey", "currency" => "GBP" );
116
+ $this->countries ["JO"] = array ("name" => "Jordan", "currency" => "JOD" );
117
+ $this->countries ["KZ"] = array ("name" => "Kazakhstan", "currency" => "KZT" );
118
+ $this->countries ["KE"] = array ("name" => "Kenya", "currency" => "KES" );
119
+ $this->countries ["KI"] = array ("name" => "Kiribati", "currency" => "AUD" );
120
+ $this->countries ["KR"] = array ("name" => "Korea, Republic of", "currency" => "KRW" );
121
+ $this->countries ["KP"] = array ("name" => "Korea, The D.P.R of (North K.)", "currency" => "EUR" );
122
+ $this->countries ["KV"] = array ("name" => "Kosovo", "currency" => "EUR" );
123
+ $this->countries ["KW"] = array ("name" => "Kuwait", "currency" => "KWD" );
124
+ $this->countries ["KG"] = array ("name" => "Kyrgyzstan", "currency" => "KGS" );
125
+ $this->countries ["LA"] = array ("name" => "Laos", "currency" => "LAK" );
126
+ $this->countries ["LV"] = array ("name" => "Latvia", "currency" => "EUR" );
127
+ $this->countries ["LB"] = array ("name" => "Lebanon", "currency" => "LBP" );
128
+ $this->countries ["LS"] = array ("name" => "Lesotho", "currency" => "ZAR" );
129
+ $this->countries ["LR"] = array ("name" => "Liberia", "currency" => "USD" );
130
+ $this->countries ["LY"] = array ("name" => "Libya", "currency" => "LYD" );
131
+ $this->countries ["LI"] = array ("name" => "Liechtenstein", "currency" => "CHF" );
132
+ $this->countries ["LT"] = array ("name" => "Lithuania", "currency" => "LTL" );
133
+ $this->countries ["LU"] = array ("name" => "Luxembourg", "currency" => "EUR" );
134
+ $this->countries ["MO"] = array ("name" => "Macau", "currency" => "MOP" );
135
+ $this->countries ["MK"] = array ("name" => "Macedonia", "currency" => "USD" );
136
+ $this->countries ["MG"] = array ("name" => "Madagascar", "currency" => "EUR" );
137
+ $this->countries ["1G"] = array ("name" => "Madeira (Portugal)", "currency" => "EUR" );
138
+ $this->countries ["MW"] = array ("name" => "Malawi", "currency" => "MWK" );
139
+ $this->countries ["MY"] = array ("name" => "Malaysia", "currency" => "MYR" );
140
+ $this->countries ["MV"] = array ("name" => "Maldives", "currency" => "MVR" );
141
+ $this->countries ["ML"] = array ("name" => "Mali", "currency" => "XOF" );
142
+ $this->countries ["MT"] = array ("name" => "Malta", "currency" => "EUR" );
143
+ $this->countries ["MH"] = array ("name" => "Marshall Islands", "currency" => "USD" );
144
+ $this->countries ["MQ"] = array ("name" => "Martinique", "currency" => "EUR" );
145
+ $this->countries ["MR"] = array ("name" => "Mauritania", "currency" => "MRO" );
146
+ $this->countries ["MU"] = array ("name" => "Mauritius", "currency" => "MUR" );
147
+ $this->countries ["YT"] = array ("name" => "Mayotte", "currency" => "EUR" );
148
+ $this->countries ["MX"] = array ("name" => "Mexico", "currency" => "MXN" );
149
+ $this->countries ["FM"] = array ("name" => "Micronesia", "currency" => "USD" );
150
+ $this->countries ["MD"] = array ("name" => "Moldova", "currency" => "MDL" );
151
+ $this->countries ["MC"] = array ("name" => "Monaco", "currency" => "EUR" );
152
+ $this->countries ["MN"] = array ("name" => "Mongolia", "currency" => "MNT" );
153
+ $this->countries ["ME"] = array ("name" => "Montenegro, Republica of", "currency" => "EUR" );
154
+ $this->countries ["MS"] = array ("name" => "Montserrat", "currency" => "XCD" );
155
+ $this->countries ["MA"] = array ("name" => "Morocco", "currency" => "MAD" );
156
+ $this->countries ["MZ"] = array ("name" => "Mozambique", "currency" => "USD" );
157
+ $this->countries ["MM"] = array ("name" => "Myanmar (Burma)", "currency" => "USD" );
158
+ $this->countries ["NA"] = array ("name" => "Namibia", "currency" => "ZAR" );
159
+ $this->countries ["NR"] = array ("name" => "Nauru, Republic of", "currency" => "AUD" );
160
+ $this->countries ["NP"] = array ("name" => "Nepal", "currency" => "NPR" );
161
+ $this->countries ["NL"] = array ("name" => "Netherlands, The", "currency" => "EUR" );
162
+ $this->countries ["NK"] = array ("name" => "Nevis", "currency" => "XCD" );
163
+ $this->countries ["NC"] = array ("name" => "New Caledonia", "currency" => "XPF" );
164
+ $this->countries ["NZ"] = array ("name" => "New Zealand", "currency" => "NZD" );
165
+ $this->countries ["NI"] = array ("name" => "Nicaragua", "currency" => "NIO" );
166
+ $this->countries ["NE"] = array ("name" => "Niger", "currency" => "XOF" );
167
+ $this->countries ["NG"] = array ("name" => "Nigeria", "currency" => "NGN" );
168
+ $this->countries ["NU"] = array ("name" => "Niue Island", "currency" => "NZD" );
169
+ $this->countries ["NO"] = array ("name" => "Norway", "currency" => "NOK" );
170
+ $this->countries ["OM"] = array ("name" => "Oman", "currency" => "OMR" );
171
+ $this->countries ["PK"] = array ("name" => "Pakistan", "currency" => "PKR" );
172
+ $this->countries ["PW"] = array ("name" => "Palau", "currency" => "USD" );
173
+ $this->countries ["PS"] = array ("name" => "Palestine", "currency" => "JOD" );
174
+ $this->countries ["PA"] = array ("name" => "Panama", "currency" => "USD" );
175
+ $this->countries ["PG"] = array ("name" => "Papua New Guinea", "currency" => "PGK" );
176
+ $this->countries ["PY"] = array ("name" => "Paraguay", "currency" => "PYG" );
177
+ $this->countries ["PE"] = array ("name" => "Peru", "currency" => "PEN" );
178
+ $this->countries ["PH"] = array ("name" => "Philippines", "currency" => "PHP" );
179
+ $this->countries ["PL"] = array ("name" => "Poland", "currency" => "PLN" );
180
+ $this->countries ["PT"] = array ("name" => "Portugal", "currency" => "EUR" );
181
+ $this->countries ["PR"] = array ("name" => "Puerto Rico", "currency" => "USD" );
182
+ $this->countries ["QA"] = array ("name" => "Qatar", "currency" => "QAR" );
183
+ $this->countries ["RE"] = array ("name" => "Reunion Island", "currency" => "EUR" );
184
+ $this->countries ["RO"] = array ("name" => "Romania", "currency" => "RON" );
185
+ $this->countries ["RU"] = array ("name" => "Russia", "currency" => "RUB" );
186
+ $this->countries ["RW"] = array ("name" => "Rwanda", "currency" => "RWF" );
187
+ $this->countries ["AN"] = array ("name" => "Saba", "currency" => "USD" );
188
+ $this->countries ["X8"] = array ("name" => "Saipan", "currency" => "USD" );
189
+ $this->countries ["1M"] = array ("name" => "Samoa", "currency" => "WST" );
190
+ $this->countries ["SM"] = array ("name" => "San Marino", "currency" => "EUR" );
191
+ $this->countries ["ST"] = array ("name" => "Sao Tome and Principe", "currency" => "STD" );
192
+ $this->countries ["SA"] = array ("name" => "Saudi Arabia", "currency" => "SAR" );
193
+ $this->countries ["1C"] = array ("name" => "Scotland (U.K)", "currency" => "GBP" );
194
+ $this->countries ["SN"] = array ("name" => "Senegal", "currency" => "XOF" );
195
+ $this->countries ["RS"] = array ("name" => "Serbia, Republic of", "currency" => "EUR" );
196
+ $this->countries ["SC"] = array ("name" => "Seychelles", "currency" => "SCR" );
197
+ $this->countries ["SL"] = array ("name" => "Sierra Leone", "currency" => "SLL" );
198
+ $this->countries ["SG"] = array ("name" => "Singapore", "currency" => "SGD" );
199
+ $this->countries ["SK"] = array ("name" => "Slovakia", "currency" => "EUR" );
200
+ $this->countries ["SI"] = array ("name" => "Slovenia", "currency" => "EUR" );
201
+ $this->countries ["SB"] = array ("name" => "Solomon Islands", "currency" => "SBD" );
202
+ $this->countries ["SO"] = array ("name" => "Somalia", "currency" => "SOS" );
203
+ $this->countries ["X9"] = array ("name" => "Somaliland", "currency" => "USD" );
204
+ $this->countries ["ZA"] = array ("name" => "South Africa", "currency" => "ZAR" );
205
+ $this->countries ["ES"] = array ("name" => "Spain", "currency" => "EUR" );
206
+ $this->countries ["LK"] = array ("name" => "Sri Lanka", "currency" => "LKR" );
207
+ $this->countries ["BL"] = array ("name" => "St. Barthelemy", "currency" => "EUR" );
208
+ $this->countries ["1L"] = array ("name" => "St. Croix", "currency" => "USD" );
209
+ $this->countries ["XB"] = array ("name" => "St. Eustatius", "currency" => "USD" );
210
+ $this->countries ["1J"] = array ("name" => "St. John", "currency" => "USD" );
211
+ $this->countries ["KN"] = array ("name" => "St. Kitts", "currency" => "XCD" );
212
+ $this->countries ["LC"] = array ("name" => "St. Lucia", "currency" => "XCD" );
213
+ $this->countries ["MF"] = array ("name" => "St. Maarten", "currency" => "ANG" );
214
+ $this->countries ["1K"] = array ("name" => "St. Thomas", "currency" => "USD" );
215
+ $this->countries ["VC"] = array ("name" => "St. Vincent", "currency" => "XCD" );
216
+ $this->countries ["SR"] = array ("name" => "Suriname", "currency" => "EUR" );
217
+ $this->countries ["SZ"] = array ("name" => "Swaziland", "currency" => "SZL" );
218
+ $this->countries ["SE"] = array ("name" => "Sweden", "currency" => "SEK" );
219
+ $this->countries ["CH"] = array ("name" => "Switzerland", "currency" => "CHF" );
220
+ $this->countries ["SY"] = array ("name" => "Syria", "currency" => "EUR" );
221
+ $this->countries ["XG"] = array ("name" => "Tahiti", "currency" => "EUR" );
222
+ $this->countries ["TW"] = array ("name" => "Taiwan", "currency" => "TWD" );
223
+ $this->countries ["TJ"] = array ("name" => "Tajikistan", "currency" => "USD" );
224
+ $this->countries ["TZ"] = array ("name" => "Tanzania", "currency" => "TZS" );
225
+ $this->countries ["TH"] = array ("name" => "Thailand", "currency" => "THB" );
226
+ $this->countries ["TG"] = array ("name" => "Togo", "currency" => "XOF" );
227
+ $this->countries ["TO"] = array ("name" => "Tonga", "currency" => "TOP" );
228
+ $this->countries ["TT"] = array ("name" => "Trinidad and Tobago", "currency" => "TTD" );
229
+ $this->countries ["TN"] = array ("name" => "Tunisia", "currency" => "TND" );
230
+ $this->countries ["TR"] = array ("name" => "Turkey", "currency" => "TRY" );
231
+ $this->countries ["TM"] = array ("name" => "Turkmenistan", "currency" => "USD" );
232
+ $this->countries ["TC"] = array ("name" => "Turks and Caicos Islands", "currency" => "USD" );
233
+ $this->countries ["TV"] = array ("name" => "Tuvalu", "currency" => "AUD" );
234
+ $this->countries ["UG"] = array ("name" => "Uganda", "currency" => "UGX" );
235
+ $this->countries ["UA"] = array ("name" => "Ukraine", "currency" => "UAH" );
236
+ $this->countries ["AE"] = array ("name" => "United Arab Emirates", "currency" => "AED" );
237
+ $this->countries ["GB"] = array ("name" => "United Kingdom", "currency" => "GBP" );
238
+ $this->countries ["US"] = array ("name" => "United States", "currency" => "USD" );
239
+ $this->countries ["AK"] = array ("name" => "United States - Alaska", "currency" => "USD" );
240
+ $this->countries ["HI"] = array ("name" => "United States - Hawaii", "currency" => "USD" );
241
+ $this->countries ["UY"] = array ("name" => "Uruguay", "currency" => "UYU" );
242
+ $this->countries ["UZ"] = array ("name" => "Uzbekistan", "currency" => "UZS" );
243
+ $this->countries ["VU"] = array ("name" => "Vanuatu", "currency" => "VUV" );
244
+ $this->countries ["VE"] = array ("name" => "Venezuela", "currency" => "EUR" );
245
+ $this->countries ["VN"] = array ("name" => "Vietnam", "currency" => "VND" );
246
+ $this->countries ["VG"] = array ("name" => "Virgin Islands (BR)", "currency" => "USD" );
247
+ $this->countries ["VI"] = array ("name" => "Virgin Islands (US)", "currency" => "USD" );
248
+ $this->countries ["1B"] = array ("name" => "Wales (U.K.) ", "currency" => "GBP" );
249
+ $this->countries ["WF"] = array ("name" => "Wallis and Futuna ", "currency" => "XPF" );
250
+ $this->countries ["WS"] = array ("name" => "Western Samoa", "currency" => "WST" );
251
+ $this->countries ["YE"] = array ("name" => "Yemen", "currency" => "YER" );
252
+ $this->countries ["YU"] = array ("name" => "Yugoslavia", "currency" => "EUR" );
253
+ $this->countries ["ZM"] = array ("name" => "Zambia", "currency" => "USD" );
254
+ $this->countries ["ZW"] = array ("name" => "Zimbabwe", "currency" => "USD" );
255
+
256
+ foreach ( $this->getCurrencies () as $_code => $_name ) {
257
+ $this->currencies [] = $_code;
258
+ }
259
+
260
+ parent::__construct ();
261
+ }
262
+
263
+ public function getIsEnabled() {
264
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ) == "2" && Mage::getStoreConfig ( 'bongointernational_config/currency/currency_conversion' ) && $this->getCurrencyCount () > 1) {
265
+ return true;
266
+ } else {
267
+ return false;
268
+ }
269
+ }
270
+
271
+ public function getIsGeoEnabled() {
272
+ return Mage::getStoreConfig ( 'bongointernational_config/currency/ip_geolocation' );
273
+ }
274
+
275
+ public function getIsLightboxEnabled() {
276
+ return Mage::getStoreConfig ( 'bongointernational_config/currency/welcome_lightbox' );
277
+ }
278
+
279
+ public function getCountries() {
280
+ return $this->countries;
281
+ }
282
+
283
+ public function getCurrentCountry() {
284
+ $current_country = $this->getRequest ()->getParam ( '__country' );
285
+
286
+ if (! empty ( $current_country ) && array_key_exists ( $current_country, $this->countries )) {
287
+ Mage::getSingleton ( 'core/session' )->setBongoCustomerCountry ( $current_country );
288
+ } else {
289
+ $current_country = Mage::getSingleton ( 'core/session' )->getBongoCustomerCountry ();
290
+ }
291
+
292
+ return $current_country;
293
+ }
294
+
295
+ public function getDefaultCountry() {
296
+ return Mage::getStoreConfig ( 'general/country/default' );
297
+ }
298
+
299
+ public function getGeoCountry() {
300
+ $geo_country = '';
301
+
302
+ if ($this->getIsGeoEnabled ()) {
303
+ if (! defined ( 'PHP_VERSION_ID' )) {
304
+ $version = explode ( '.', PHP_VERSION );
305
+
306
+ define ( 'PHP_VERSION_ID', ($version [0] * 10000 + $version [1] * 100 + $version [2]) );
307
+ }
308
+
309
+ $remote_ip = $this->helper ( 'core/http' )->getRemoteAddr ();
310
+
311
+ /*if (PHP_VERSION_ID >= 50300) {
312
+ require_once (Mage::getModuleDir ( '', 'Bongo_International' ) . DS . 'lib' . DS . 'geoip2.phar');
313
+ eval ( 'use GeoIp2\Database\Reader;' );
314
+
315
+ $reader = new Reader ( Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'GeoLite2-Country.mmdb' );
316
+ $record = $reader->country ( $remote_ip );
317
+ $geo_country = $record->country->isoCode;
318
+ } else {*/
319
+ require_once (Mage::getModuleDir ( '', 'Bongo_International' ) . DS . 'lib' . DS . 'IP2Location.php');
320
+
321
+ $loc = new IP2Location ( Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'IP2LOCATION-LITE-DB1.BIN', IP2Location::FILE_IO );
322
+ //$loc = new IP2Location(Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'IP2LOCATION-LITE-DB1.BIN', IP2Location::SHARED_MEMORY);
323
+ //$loc = new IP2Location(Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'IP2LOCATION-LITE-DB1.BIN', IP2Location::MEMORY_CACHE);
324
+
325
+
326
+ $geo_country = $loc->lookup ( $remote_ip, IP2Location::COUNTRY_CODE );
327
+ /*}*/
328
+ }
329
+
330
+ if (empty ( $geo_country )) {
331
+ $geo_country = $this->getDefaultCountry ();
332
+ }
333
+
334
+ return $geo_country;
335
+ }
336
+
337
+ public function getCountrySwitchUrl($_code, $_country) {
338
+ return $this->getUrl ( 'directory/currency/switch', array ('currency' => in_array ( $_country ['currency'], $this->currencies ) ? $_country ['currency'] : Mage::app ()->getStore ()->getBaseCurrencyCode (), Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper ( 'core' )->urlEncode ( Mage::getUrl ( '*/*/*', array ('_current' => true, '_query' => array ('__country' => $_code ) ) ) ) ) );
339
+ }
340
+ }
app/code/community/Bongo/International/Block/Currency/Selector/Default.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Currency_Selector_Default extends Bongo_International_Block_Currency_Selector {
4
+
5
+ }
app/code/community/Bongo/International/Block/Currency/Selector/Experimental.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Currency_Selector_Experimental extends Bongo_International_Block_Currency_Selector {
4
+ public function getIsEnabled() {
5
+ if (parent::getIsEnabled () && Mage::getStoreConfig ( 'bongointernational_config/currency/country_selector' )) {
6
+ return true;
7
+ } else {
8
+ return false;
9
+ }
10
+ }
11
+ }
app/code/community/Bongo/International/Block/Currency/Selector/Lightbox.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Currency_Selector_Lightbox extends Bongo_International_Block_Currency_Selector {
4
+ public function getIsEnabled() {
5
+ if (parent::getIsEnabled () && $this->getIsGeoEnabled () && $this->getIsLightboxEnabled ()) {
6
+ return true;
7
+ } else {
8
+ return false;
9
+ }
10
+ }
11
+ }
app/code/community/Bongo/International/Block/Extend/Code.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Block_Extend_Code extends Mage_Core_Block_Template {
4
+ public function getIsEnabled() {
5
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active' ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ) == "1") {
6
+ return true;
7
+ } else {
8
+ return false;
9
+ }
10
+ }
11
+
12
+ public function getExtendCode() {
13
+ return Mage::getStoreConfig ( 'bongointernational_config/config/extend_code' );
14
+ }
15
+ }
app/code/community/Bongo/International/Block/Sales/Order/Totals.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Block_Sales_Order_Totals extends Mage_Sales_Block_Order_Totals {
3
+ public function initTotals() {
4
+ $order = $this->getParentBlock ()->getOrder ();
5
+
6
+ if ($order->getBongoTotalsShipping () != 0) {
7
+ $shipping = $order->getBongoTotalsShipping ();
8
+
9
+ $this->getParentBlock ()->removeTotal ( 'shipping' );
10
+ $this->getParentBlock ()->addTotal ( new Varien_Object ( array ('code' => 'shipping', 'value' => $shipping, 'base_value' => $shipping, 'label' => Mage::helper ( 'sales' )->__ ( 'Shipping & Handling' ) ) ), 'subtotal' );
11
+ }
12
+
13
+ $this->addBongoTotalsRow ( $custom_totals, Mage::getModel ( 'bongointernational/total_duty_quote' ), ( float ) $order->getBongoTotalsDuty () );
14
+ $this->addBongoTotalsRow ( $custom_totals, Mage::getModel ( 'bongointernational/total_tax_quote' ), ( float ) $order->getBongoTotalsTax () );
15
+ $this->addBongoTotalsRow ( $custom_totals, Mage::getModel ( 'bongointernational/total_insurance_quote' ), ( float ) $order->getBongoTotalsInsurance () );
16
+ }
17
+
18
+ public function addBongoTotalsRow($custom_totals, $quote_model, $total) {
19
+ if ($total != 0) {
20
+ $this->getParentBlock ()->addTotal ( new Varien_Object ( array ('code' => $quote_model->getCode (), 'value' => $total, 'base_value' => $total, 'label' => $quote_model->getLabel () ) ), 'shipping' );
21
+ }
22
+ }
23
+ }
app/code/community/Bongo/International/Helper/Data.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Helper_Data extends Mage_Core_Helper_Abstract {
3
+ public function sendNotificationEmail($subject, $message) {
4
+ $customName = Mage::getStoreConfig ( 'trans_email/ident_custom2/name' );
5
+ $customEmail = Mage::getStoreConfig ( 'trans_email/ident_custom2/email' );
6
+
7
+ $html = <<<END
8
+ Hello {$strCustomName},<br /><br />
9
+ The Bongo International module has reported the following critical notification:<br /><br />
10
+ {$message}<br /><br />
11
+ If you have any questions regarding this notification, please refer to your Magento logs specific to the Bongo International module (prefixed with "bongo_"), the documentation for the module or contact Bongo International directly.<br /><br />
12
+ Sincerely,<br /><br />
13
+ Bongo International
14
+ END;
15
+ $mail = Mage::getModel ( 'core/email' );
16
+ $mail->setToName ( $customName );
17
+ $mail->setToEmail ( $customEmail );
18
+ $mail->setBody ( $html );
19
+ $mail->setSubject ( 'Bongo International Critical Notification' . (! empty ( $subject ) ? ": {$subject}" : '') );
20
+ $mail->setFromName ( $customName );
21
+ $mail->setFromEmail ( $customEmail );
22
+ $mail->setType ( 'html' );
23
+
24
+ try {
25
+ $mail->send ();
26
+ } catch ( Exception $e ) {
27
+ Mage::log ( "Critical Notification email could not be sent: {$e->getMessage()}; Subject: {$subject}; Message: {$message}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ), null, 'bongo_exception.log' );
28
+ }
29
+ }
30
+ }
app/code/community/Bongo/International/Model/Adminhtml/DefaultCountry.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Adminhtml_DefaultCountry {
4
+ public function getCommentText() {
5
+ $setup = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup('core_setup');
6
+
7
+ if ($setup->getAttributeId ( 'catalog_product', 'country_of_manufacture' ) === false) {
8
+ return "Bongo International requires a Country of Manufacture for every product. Your version of Magento does not have the Country of Manufacture attribute on products so the default value you set here will be used for ALL products.<br /><b>If you'd like to specify a Country of Manufacture on a per-product basis, please upgrade to the latest version of Magento.</b>";
9
+ } else {
10
+ return "Bongo International requires a Country of Manufacture for every product. If you do not specify a Country of Manufacture for certain products, the default value you set here will be used.";
11
+ }
12
+ }
13
+ }
app/code/community/Bongo/International/Model/Adminhtml/IntegrationType.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Adminhtml_IntegrationType {
3
+ public function toOptionArray() {
4
+ return array (
5
+ /*array ('value' => 1, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Bongo Extend' ) ), */
6
+ array ('value' => 2, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Bongo Checkout' ) ), array ('value' => 3, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Bongo Export' ) ) );
7
+ }
8
+
9
+ }
app/code/community/Bongo/International/Model/Adminhtml/ShippingMethods.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Adminhtml_ShippingMethods {
3
+ public function toOptionArray() {
4
+ return array (array ('value' => 1, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Economy' ) ), array ('value' => 2, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Express' ) ), array ('value' => 3, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Economy & Express' ) ) );
5
+ }
6
+
7
+ }
app/code/community/Bongo/International/Model/Adminhtml/ShippingType.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Adminhtml_ShippingType {
3
+ public function toOptionArray() {
4
+ $activeCarriers = Mage::getSingleton ( 'shipping/config' )->getActiveCarriers ();
5
+ $methods = array ();
6
+ $options = array (array ('value' => 'bongointernational_free', 'label' => 'Free' ), array ('value' => 'bongointernational_manual', 'label' => 'Per Product' ) );
7
+ $methods [] = array ('value' => $options, 'label' => 'Bongo' );
8
+
9
+ foreach ( $activeCarriers as $carrierCode => $carrierModel ) {
10
+ if (empty ( $carrierCode ) || $carrierCode == 'bongointernational') {
11
+ continue;
12
+ }
13
+
14
+ if ($carrierMethods = $carrierModel->getAllowedMethods ()) {
15
+ $options = array ();
16
+
17
+ foreach ( $carrierMethods as $methodCode => $method ) {
18
+ $options [] = array ('value' => "{$carrierCode}_{$methodCode}", 'label' => $method );
19
+ }
20
+
21
+ $carrierTitle = Mage::getStoreConfig ( "carriers/{$carrierCode}/title" );
22
+
23
+ $methods [] = array ('value' => $options, 'label' => $carrierTitle );
24
+ }
25
+ }
26
+
27
+ return $methods;
28
+ }
29
+
30
+ }
app/code/community/Bongo/International/Model/Adminhtml/SyncFrequency.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Adminhtml_SyncFrequency
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value'=>1, 'label'=>Mage::helper('bongointernational')->__('Nightly')),
8
+ array('value'=>2, 'label'=>Mage::helper('bongointernational')->__('Weekly')),
9
+ array('value'=>3, 'label'=>Mage::helper('bongointernational')->__('Monthly')),
10
+ );
11
+ }
12
+
13
+ }
app/code/community/Bongo/International/Model/Adminhtml/TransferType.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Adminhtml_TransferType {
3
+ public function toOptionArray() {
4
+ return array (array ('value' => 1, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'International Checkout Button' ) ), array ('value' => 2, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'Auto Redirect' ) ), array ('value' => 3, 'label' => Mage::helper ( 'bongointernational' )->__ ( 'International Checkout Button & Auto Redirect' ) ) );
5
+ }
6
+
7
+ }
app/code/community/Bongo/International/Model/Currency/Cache.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Currency_Cache {
4
+ public function cron() {
5
+ try {
6
+ $content = file_get_contents ( 'https://partnertools.bongous.com/currency/exchanges.json?key=' . Mage::getStoreConfig ( 'bongointernational_config/config/api_key' ) );
7
+
8
+ if (empty ( $content )) {
9
+ throw new Exception ( 'Unable to retrieve currency exchange rates from Bongo' );
10
+ }
11
+
12
+ $currency_file = Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'currency_exchanges.json';
13
+
14
+ file_put_contents ( $currency_file, $content );
15
+ } catch ( Exception $e ) {
16
+ Mage::log ( "Currency Cache Error: {$e->getMessage()}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ), null, 'bongo_exception.log' );
17
+
18
+ Mage::helper ( 'bongointernational' )->sendNotificationEmail ( 'Currency Cache Error', $e->getMessage () );
19
+
20
+ die ( $e->getMessage () );
21
+ }
22
+
23
+ return true;
24
+ }
25
+ }
app/code/community/Bongo/International/Model/Currency/Converter.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Currency_Converter extends Mage_Directory_Model_Currency_Import_Abstract {
4
+ protected $_url = 'https://partnertools.bongous.com/currency/exchanges.json?key=';
5
+ protected $_messages = array ();
6
+ protected $_rates = array ();
7
+
8
+ protected function _convert($currencyFrom, $currencyTo, $retry = 0) {
9
+ try {
10
+ $content = file_get_contents ( Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'currency_exchanges.json' );
11
+
12
+ if (empty ( $content )) {
13
+ Mage::getModel ( 'bongointernational/currency_cache' )->cron ();
14
+
15
+ $content = file_get_contents ( Mage::getBaseDir ( 'var' ) . DS . 'bongointernational' . DS . 'currency_exchanges.json' );
16
+ }
17
+
18
+ if (empty ( $content )) {
19
+ throw new Exception ( 'Cache of currency exchange rates is missing' );
20
+ }
21
+ } catch ( Exception $e ) {
22
+ Mage::log ( "Currency Fetch Error: {$e->getMessage()}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ) . "; Raw Request: " . print_r ( $_POST, true ), null, 'bongo_exception.log' );
23
+
24
+ Mage::helper ( 'bongointernational' )->sendNotificationEmail ( 'Currency Fetch Error', $e->getMessage () );
25
+
26
+ die ( $e->getMessage () );
27
+ }
28
+
29
+ try {
30
+ if (empty ( $content )) {
31
+ $this->_messages [] = Mage::helper ( 'directory' )->__ ( 'Cannot retrieve rate from %s.', $this->_url );
32
+ return null;
33
+ }
34
+
35
+ $data = json_decode ( $content );
36
+
37
+ if (! $data->$currencyFrom || ! is_array ( $data->$currencyFrom )) {
38
+ $this->_messages [] = Mage::helper ( 'directory' )->__ ( 'Cannot retrieve rate from %s.', $this->_url );
39
+ return null;
40
+ }
41
+
42
+ foreach ( $data->$currencyFrom as $rate ) {
43
+ $this->_rates [$rate->code] = floatval ( $rate->value );
44
+ }
45
+
46
+ return ( float ) 1 / $this->_rates [$currencyFrom] * $this->_rates [$currencyTo];
47
+ } catch ( Exception $e ) {
48
+ $this->_messages [] = Mage::helper ( 'directory' )->__ ( 'Cannot retrieve rate from %s.', $this->_url );
49
+ }
50
+ }
51
+ }
app/code/community/Bongo/International/Model/Order/Observer.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Order_Observer extends Mage_Core_Model_Abstract {
4
+ public function sendBongoOrder($observer) {
5
+ $params = '';
6
+ $response = '';
7
+
8
+ try {
9
+ $order = $observer->getEvent ()->getOrder ();
10
+ $store_id = $order->getStoreId ();
11
+
12
+ if (! $this->getIsEnabled ( $store_id )) {
13
+ return;
14
+ }
15
+
16
+ if (! preg_match ( '/^bongointernational\_/i', $order->getShippingMethod () )) {
17
+ return;
18
+ }
19
+
20
+ $items = array ();
21
+ $items_track = array ();
22
+
23
+ if ($order->getAllItems ()) {
24
+ foreach ( $order->getAllItems () as $item ) {
25
+ if (! Mage::getModel ( 'bongointernational/shipping_carrier_bongo' )->isSimpleProduct ( $item->getProduct () )) {
26
+ continue;
27
+ }
28
+
29
+ $items [] = array ('productID' => $item->getSku (), 'quantity' => $item->getQtyOrdered (), 'price' => $item->getProduct ()->getFinalPrice () );
30
+ $items_track [] = array ('productID' => $item->getSku (), 'quantity' => $item->getQtyOrdered (), 'price' => $item->getProduct ()->getFinalPrice (), 'carrier' => '', 'trackingNumber' => '' );
31
+ }
32
+ }
33
+
34
+ $domestic_shipping = Mage::getModel ( 'bongointernational/shipping_carrier_bongo' )->getDomesticShipping ( $order->getAllItems (), '', $order->getQuote ()->getData () );
35
+
36
+ $client = new SoapClient ( "https://api.bongous.com/services/v4?wsdl" );
37
+
38
+ $params = array ('partnerKey' => Mage::getStoreConfig ( 'bongointernational_config/config/api_key', $store_id ), 'language' => 'en', 'privateIndividuals' => 'Y', 'shipmentOriginCountry' => Mage::getStoreConfig ( 'bongointernational_config/dc/country', $store_id ), 'shipmentDestinationCountry' => $order->getShippingAddress ()->getCountryId (), 'domesticShippingCost' => $domestic_shipping, 'items' => $items, 'insuranceFlag' => Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance', $store_id ) ? '1' : '0', 'currency' => Mage::getStoreConfig ( 'bongointernational_config/config/landed_cost_usd', $store_id ) ? '0' : '1', 'currencyConversionRate' => '', 'service' => $order->getShippingMethod () == 'bongointernational_express' ? '0' : '1' );
39
+ $response_cost = $client->ConnectLandedCost ( ( object ) $params );
40
+
41
+ if (( int ) $response_cost->error > 0) {
42
+ throw new Exception ( ( int ) $response_cost->error . ' - ' . ( string ) $response_cost->errorMessage . ' - ' . ( string ) $response_cost->errorMessageDetail );
43
+ }
44
+
45
+ $region = $order->getShippingAddress ()->getRegionId ();
46
+ $params = array ('partnerKey' => Mage::getStoreConfig ( 'bongointernational_config/config/api_key', $store_id ), 'language' => 'en', 'orderNumber' => $order->getIncrementId (), 'landedCostTransactionID' => ( string ) $response_cost->landedCostTransactionId, 'ordersInfo' => $items_track, 'shipToBusiness' => $order->getShippingAddress ()->getCompany (), 'shipToFirstName' => $order->getShippingAddress ()->getFirstname (), 'shipToLastName' => $order->getShippingAddress ()->getLastname (), 'shipToAddress1' => $order->getShippingAddress ()->getStreet ( 1 ), 'shipToAddress2' => $order->getShippingAddress ()->getStreet ( 2 ), 'shipToAddress3' => $order->getShippingAddress ()->getStreet ( 3 ), 'shipToCity' => $order->getShippingAddress ()->getCity (), 'shipToState' => empty ( $region ) ? $order->getShippingAddress ()->getRegion () : Mage::getModel ( 'directory/region' )->load ( $region )->getName (), 'shipToZip' => $order->getShippingAddress ()->getPostcode (), 'shipToCountry' => $order->getShippingAddress ()->getCountryId (), 'shipToPhone' => $order->getShippingAddress ()->getTelephone (), 'shipToEmail' => $order->getCustomerEmail (), 'shipToTaxID' => $order->getCustomerTaxvat (), 'repackage' => '', 'dutyPaid' => Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id ) ? '1' : '0', 'insurance' => Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance', $store_id ) ? '1' : '0', 'emailCustomerTracking' => Mage::getStoreConfig ( 'bongointernational_config/config/order_confirmation_bongo', $store_id ) ? '1' : '0', 'bongoCustomerService' => '', 'sellingStoreName' => '', 'sellingStoreURL' => '', 'sellingStoreURLCS' => '', 'sellingStoreURLImage' => '' );
47
+ $response_order = $client->ConnectOrder ( ( object ) $params );
48
+
49
+ if (( int ) $response_order->error > 0) {
50
+ throw new Exception ( ( int ) $response_order->error . ' - ' . ( string ) $response_order->errorMessage . ' - ' . ( string ) $response_order->errorMessageDetail );
51
+ }
52
+
53
+ $dc_address1 = Mage::getStoreConfig ( 'bongointernational_config/dc/address1', $store_id );
54
+ $dc_address2 = Mage::getStoreConfig ( 'bongointernational_config/dc/address2', $store_id );
55
+ $dc_city = Mage::getStoreConfig ( 'bongointernational_config/dc/city', $store_id );
56
+ $dc_state = Mage::getStoreConfig ( 'bongointernational_config/dc/state', $store_id );
57
+ $dc_zip = Mage::getStoreConfig ( 'bongointernational_config/dc/zip', $store_id );
58
+ $dc_country = Mage::getStoreConfig ( 'bongointernational_config/dc/country', $store_id );
59
+
60
+ $shipping_address = Mage::getModel ( 'sales/order_address' )->load ( $order->getShippingAddress ()->getId () );
61
+ $shipping_address->setStreet ( array ($dc_address1, $dc_address2 ) );
62
+ $shipping_address->setCity ( $dc_city );
63
+ $shipping_address->setRegionId ( $dc_state );
64
+ $shipping_address->setRegion ( '' );
65
+ $shipping_address->setPostcode ( $dc_zip );
66
+ $shipping_address->setCountryId ( $dc_country );
67
+ $shipping_address->save ();
68
+
69
+ $subtotal = $order->getSubtotal () - $order->getDiscountAmount ();
70
+ $duty = Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id ) && ( int ) $response_cost->ddpAvailable == 1 ? ( string ) $response_cost->dutyCost : '0.00';
71
+ $insurance = Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance', $store_id ) ? ( string ) $response_cost->insuranceCost : '0.00';
72
+ $shipping_total = ( float ) $duty + ( float ) $response_cost->taxCost + ( float ) $response_cost->shippingCost + ( float ) $insurance;
73
+ $grand_total = $subtotal + $shipping_total;
74
+
75
+ $order->setBongoId ( ( int ) $order->getIncrementId () );
76
+ $order->setBongoTracking ( ( string ) $response_order->trackingLink );
77
+ $order->setBongoLandedcosttransactionid ( ( string ) $response_cost->landedCostTransactionId );
78
+ $order->setBongoTotalsSubtotal ( $subtotal );
79
+ $order->setBongoTotalsDuty ( $duty );
80
+ $order->setBongoTotalsTax ( ( string ) $response_cost->taxCost );
81
+ $order->setBongoTotalsShipping ( ( string ) $response_cost->shippingCost );
82
+ $order->setBongoTotalsDomestic ( $domestic_shipping );
83
+ $order->setBongoTotalsInsurance ( $insurance );
84
+ $order->setShippingAmount ( $shipping_total );
85
+ $order->setBaseShippingAmount ( $shipping_total );
86
+ $order->setBongoTotalsTotal ( $grand_total );
87
+ $order->setGrandTotal ( $grand_total );
88
+ $order->setBaseGrandTotal ( $grand_total );
89
+ $order->save ();
90
+ } catch ( Exception $e ) {
91
+ Mage::log ( "Order Sending Error: {$e->getMessage()}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ) . "; Raw Request Params: " . print_r ( $params, true ) . "; Raw Response: " . print_r ( $response, true ), null, 'bongo_exception.log' );
92
+
93
+ echo $e->getMessage ();
94
+ }
95
+ }
96
+
97
+ public function cancelBongoOrder($observer) {
98
+ $params = '';
99
+ $response = '';
100
+
101
+ try {
102
+ $order = $observer->getEvent ()->getOrder ();
103
+ $store_id = $order->getStoreId ();
104
+
105
+ if (! $this->getIsEnabled ( $store_id )) {
106
+ return;
107
+ }
108
+
109
+ $origData = $order->getOrigData ();
110
+
111
+ if ($order->getBongoId () && $order->getState () == Mage_Sales_Model_Order::STATE_CANCELED && $origData ['state'] !== Mage_Sales_Model_Order::STATE_CANCELED) {
112
+ $client = new SoapClient ( "https://api.bongous.com/services/v4?wsdl" );
113
+ $params = array ('partnerKey' => Mage::getStoreConfig ( 'bongointernational_config/config/api_key', $store_id ), 'language' => 'en', 'orderNumber' => ( string ) $order->getBongoId () );
114
+ $response = $client->ConnectOrderRemove ( ( object ) $params );
115
+
116
+ if (( int ) $response->error > 0) {
117
+ throw new Exception ( ( int ) $response->error . ' - ' . ( string ) $response->errorMessage . ' - ' . ( string ) $response->errorMessageDetail );
118
+ }
119
+ }
120
+ } catch ( Exception $e ) {
121
+ Mage::log ( "Order Cancellation Error: {$e->getMessage()}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ) . "; Raw Request Params: " . print_r ( $params, true ) . "; Raw Response: " . print_r ( $response, true ), null, 'bongo_exception.log' );
122
+
123
+ echo $e->getMessage ();
124
+ }
125
+ }
126
+
127
+ public function getIsEnabled($store_id = null) {
128
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && Mage::getStoreConfig ( 'bongointernational_config/config/integration_type', $store_id ) == "3") {
129
+ return true;
130
+ } else {
131
+ return false;
132
+ }
133
+ }
134
+ }
app/code/community/Bongo/International/Model/Payment/Standard.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Payment_Standard extends Mage_Payment_Model_Method_Abstract {
4
+ protected $_code = 'bongointernational';
5
+
6
+ protected $_canUseInternal = true;
7
+ protected $_canUseCheckout = false;
8
+ protected $_canUseForMultishipping = false;
9
+ protected $_canManageRecurringProfiles = false;
10
+
11
+ public function authorize(Varien_Object $payment, $amount) {
12
+ // nothing to do, internal module used for tracking only
13
+ }
14
+
15
+ public function capture(Varien_Object $payment, $amount) {
16
+ // nothing to do, internal module used for tracking only
17
+ }
18
+ }
19
+
20
+ ?>
app/code/community/Bongo/International/Model/Products/Status.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Products_Status {
4
+ public function status($skus, $names, $error = false) {
5
+ $client = new SoapClient ( "https://api.bongous.com/services/v4?wsdl" );
6
+ $params = ( object ) array ('partnerKey' => Mage::getStoreConfig ( 'bongointernational_config/config/api_key' ), 'language' => 'en', 'items' => $skus );
7
+ $response = $client->connectSkuStatus ( $params );
8
+
9
+ if ($response->error > 0) {
10
+ return false;
11
+ }
12
+
13
+ $items = $response->items;
14
+ $failed = array ();
15
+
16
+ foreach ( $items as $item ) {
17
+ if (( int ) $item->productStatus !== 2) {
18
+ $failed [] = $names [$item->productID];
19
+ }
20
+ }
21
+
22
+ if (count ( $failed ) > 0) {
23
+ if ($error) {
24
+ Mage::getSingleton ( 'checkout/session' )->addError ( Mage::helper ( 'bongointernational' )->__ ( 'The following products cannot be shipped internationally at this time. Please remove these products from your shopping cart before proceeding.' ) . '<br /><ul style="list-style:disc outside none !important;margin-left:20px !important;"><li>' . implode ( '</li><li>', $failed ) . '</li></ul>' );
25
+ }
26
+
27
+ return false;
28
+ }
29
+
30
+ return true;
31
+ }
32
+ }
app/code/community/Bongo/International/Model/Products/Sync.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Products_Sync {
4
+ public function sync($send = false, $store_id = null) {
5
+ set_time_limit ( 0 );
6
+ ignore_user_abort ( true );
7
+
8
+ $collection = Mage::getModel ( 'catalog/product' )->getCollection ();
9
+
10
+ if (! empty ( $store_id )) {
11
+ $collection->setStoreId ( $store_id )->addStoreFilter ( $store_id );
12
+ }
13
+
14
+ $count = $collection->count ();
15
+
16
+ if ($count < 1) {
17
+ return "No products found";
18
+ }
19
+
20
+ $country_manufacture = Mage::getStoreConfig ( 'bongointernational_config/config/country_manufacture', $store_id );
21
+ $num_pages = ceil ( $count / 1000 );
22
+ $items_combined = array ();
23
+
24
+ if ($send) {
25
+ $partner_key = Mage::getStoreConfig ( 'bongointernational_config/config/api_key', $store_id );
26
+ $client = new SoapClient ( "https://api.bongous.com/services/v4?wsdl" );
27
+ }
28
+
29
+ for($cur_page = 1; $cur_page <= $num_pages; $cur_page ++) {
30
+ $collection = Mage::getModel ( 'catalog/product' )->getCollection ();
31
+
32
+ if (! empty ( $store_id )) {
33
+ $collection->setStoreId ( $store_id )->addStoreFilter ( $store_id );
34
+ }
35
+
36
+ $collection->removeAttributeToSelect ( '*' )->addAttributeToSelect ( 'type_id' )->addAttributeToSelect ( 'special_price' )->addAttributeToSelect ( 'price' )->addAttributeToSelect ( 'url_path' )->addAttributeToSelect ( 'image' )->addAttributeToSelect ( 'name' )->addAttributeToSelect ( 'sku' )->addAttributeToSelect ( 'name' )->addAttributeToSelect ( 'country_of_manufacture' )->addAttributeToSelect ( 'weight' )->setPageSize ( 1000 )->setCurPage ( $cur_page )->load ();
37
+
38
+ $items = array ();
39
+
40
+ foreach ( $collection as $product ) {
41
+ if ($product->getTypeId () == 'configurable' || $product->getTypeId () == 'bundle' || $product->getTypeId () == 'grouped') {
42
+ continue;
43
+ }
44
+
45
+ $price = $product->getSpecialPrice ();
46
+
47
+ if ($price < 0.01) {
48
+ $price = $product->getPrice ();
49
+ }
50
+
51
+ $product_url = '';
52
+ $image_url = '';
53
+
54
+ try {
55
+ $description = trim ( $product->getName () );
56
+ /*$description = trim ( $product->getShortDescription () );
57
+
58
+ if (empty ( $description )) {
59
+ $description = trim ( $product->getDescription () );
60
+ }
61
+
62
+ if (empty ( $description )) {
63
+ $description = trim ( $product->getName () );
64
+ }*/
65
+
66
+ $product_url = Mage::app ()->getStore ( $store_id )->getUrl ('', array('_nosid'=>1)) . $product->getUrlPath ();
67
+ $image_url = $product->getImageUrl ();
68
+ } catch ( Exception $e ) {
69
+ }
70
+
71
+ $items [] = array ('productID' => $product->getSku (), 'description' => $description, 'url' => $product_url, 'imageUrl' => $image_url, 'price' => $price, 'countryOfOrigin' => $product->getCountryOfManufacture () ? $product->getCountryOfManufacture () : $country_manufacture, 'hsCode' => '', 'eccn' => '', 'hazFlag' => '', 'licenseFlag' => '', 'importFlag' => '', 'productType' => '', 'itemInformation' => array (array ('l' => '', 'w' => '', 'h' => '', 'wt' => $product->getWeight () ) ) );
72
+ }
73
+
74
+ if ($send) {
75
+ $params = ( object ) array ('partnerKey' => $partner_key, 'language' => 'en', 'items' => $items );
76
+ $response = $client->connectProductInfo ( $params );
77
+
78
+ if ($response->error > 0) {
79
+ return $response;
80
+ }
81
+ } else {
82
+ $items_combined = array_merge ( $items_combined, $items );
83
+ }
84
+ }
85
+
86
+ if ($send) {
87
+ return ( object ) array ('error' => 0 );
88
+ } else {
89
+ return $items_combined;
90
+ }
91
+ }
92
+
93
+ public function cron() {
94
+ $stores = Mage::app ()->getStores ();
95
+
96
+ foreach ( $stores as $store ) {
97
+ if ($store->getId () == "0") {
98
+ continue;
99
+ }
100
+
101
+ $frequency = Mage::getStoreConfig ( 'bongointernational_products/automated/frequency', $store->getId () );
102
+
103
+ if ($frequency == "1" || ($frequency == "2" && date ( 'w' ) == "0") || ($frequency == "3" && date ( 'j' ) == "1")) {
104
+ $response = $this->sync ( true, $store->getId () );
105
+ Mage::log ( "Cron synced on " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ) . "; Store ID: {$store->getId()}; Raw Response: " . print_r ( $response, true ), null, 'bongo_cron.log' );
106
+ }
107
+ }
108
+
109
+ return true;
110
+ }
111
+ }
app/code/community/Bongo/International/Model/Resource/Status.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Resource_Status extends Mage_Core_Model_Resource_Db_Abstract {
4
+ protected function _construct() {
5
+ $this->_init ( 'bongointernational/status', 'status_id' );
6
+ }
7
+ }
app/code/community/Bongo/International/Model/Resource/Status/Collection.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Resource_Status_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
4
+ public function _construct() {
5
+ $this->_init ( 'bongointernational/status' );
6
+ }
7
+ }
app/code/community/Bongo/International/Model/Shipping/Carrier/Bongo.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Shipping_Carrier_Bongo extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
4
+ protected $_code = 'bongointernational';
5
+
6
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
7
+ if (! $this->getConfigFlag ( 'active' ) || ! Mage::getStoreConfig ( 'bongointernational_config/config/active' ) || ! in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) )) {
8
+ return false;
9
+ }
10
+
11
+ $allowed_countries = explode ( ',', Mage::getStoreConfig ( 'bongointernational_config/config/allow_countries' ) );
12
+
13
+ if (! in_array ( $request->getDestCountryId (), $allowed_countries )) {
14
+ return false;
15
+ }
16
+
17
+ if ($request->getDestCountryId () == Mage::getStoreConfig ( 'bongointernational_config/dc/country' ) && $request->getDestRegionId () == Mage::getStoreConfig ( 'bongointernational_config/dc/state' ) && $request->getDestCity () == Mage::getStoreConfig ( 'bongointernational_config/dc/city' ) && $request->getDestPostcode () == Mage::getStoreConfig ( 'bongointernational_config/dc/zip' ) && $request->getDestStreet ( 0 ) == Mage::getStoreConfig ( 'bongointernational_config/dc/address1' ) && $request->getDestStreet ( 1 ) == Mage::getStoreConfig ( 'bongointernational_config/dc/address2' )) {
18
+ return false;
19
+ }
20
+
21
+ //$this->checkSkuStatus ( $request->getAllItems (), true );
22
+
23
+
24
+ $items = array ();
25
+ $names = array ();
26
+ $domestic_shipping = $this->getDomesticShipping ( $request->getAllItems (), $request );
27
+
28
+ if ($request->getAllItems ()) {
29
+ foreach ( $request->getAllItems () as $item ) {
30
+ if (! $this->isSimpleProduct ( $item->getProduct () )) {
31
+ continue;
32
+ }
33
+
34
+ $items [] = array ('productID' => $item->getSku (), 'quantity' => $item->getQty (), 'price' => $item->getProduct ()->getFinalPrice () );
35
+ $names [$item->getSku ()] = $item->getName ();
36
+ }
37
+ }
38
+
39
+ $client = new SoapClient ( "https://api.bongous.com/services/v4?wsdl" );
40
+ $params = array ('partnerKey' => Mage::getStoreConfig ( 'bongointernational_config/config/api_key' ), 'language' => 'en', 'privateIndividuals' => 'Y', 'shipmentOriginCountry' => Mage::getStoreConfig ( 'bongointernational_config/dc/country' ), 'shipmentDestinationCountry' => $request->getDestCountryId (), 'domesticShippingCost' => $domestic_shipping, 'items' => $items, 'insuranceFlag' => Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance' ) ? '1' : '0', 'currency' => Mage::getStoreConfig ( 'bongointernational_config/config/landed_cost_usd' ) ? '0' : '1', 'currencyConversionRate' => '' );
41
+ $response_economy = $client->ConnectLandedCost ( ( object ) ($params + array ('service' => '1' )) );
42
+
43
+ if (! preg_match ( '/checkout\/cart\/[add|delete|updatePost]/i', $_SERVER ['REQUEST_URI'] ) && (in_array ( ( int ) $response_economy->error, array (2025, 2026, 2027, 2028, 2029, 2030, 2031 ) ) || preg_match ( '/[2025|2026|2027|2028|2029|2030|2031]/', ( string ) $response_economy->errorMessageDetail ))) {
44
+ $failed = array ();
45
+
46
+ foreach ( $response_economy->items as $item ) {
47
+ if (( int ) $item->calculated == 0) {
48
+ $failed [] = $names [$item->productID];
49
+ }
50
+ }
51
+
52
+ $has_error = false;
53
+ $messages = Mage::getSingleton ( 'checkout/session' )->getMessages ()->getItems ();
54
+
55
+ foreach ( $messages as $message ) {
56
+ if (stripos ( $message->getText (), Mage::helper ( 'bongointernational' )->__ ( 'The following products cannot be shipped internationally at this time. Please remove these products from your shopping cart before proceeding.' ) ) !== 'false') {
57
+ $has_error = true;
58
+ }
59
+ }
60
+
61
+ if (count ( $failed ) > 0 && ! $has_error) {
62
+ Mage::getSingleton ( 'checkout/session' )->addError ( Mage::helper ( 'bongointernational' )->__ ( 'The following products cannot be shipped internationally at this time. Please remove these products from your shopping cart before proceeding.' ) . '<br /><ul style="list-style:disc outside none !important;margin-left:20px !important;"><li>' . implode ( '</li><li>', $failed ) . '</li></ul>' );
63
+ }
64
+ }
65
+
66
+ //$shipping_cost = $response_economy->shippingCost + $response_economy->dutyCost + $response_economy->taxCost;
67
+ $shipping_cost = $response_economy->shippingCost;
68
+ $shipping_cost_express = 0;
69
+ $append = false;
70
+
71
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsDuty ( '' );
72
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsInsurance ( '' );
73
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsTax ( '' );
74
+
75
+ $result = Mage::getModel ( 'shipping/rate_result' );
76
+
77
+ if (in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/shipping_methods' ), array ("1", "3" ) ) && $shipping_cost > 0) {
78
+ $method = Mage::getModel ( 'shipping/rate_result_method' );
79
+ $method->setCarrier ( 'bongointernational' );
80
+ $method->setCarrierTitle ( $this->getConfigData ( 'title' ) );
81
+ $method->setMethod ( 'economy' );
82
+ $method->setMethodTitle ( $this->getConfigData ( 'name' ) );
83
+ $method->setPrice ( $shipping_cost );
84
+ $method->setCost ( $shipping_cost );
85
+ $result->append ( $method );
86
+ $append = true;
87
+
88
+ if (Mage::getSingleton ( 'checkout/session' )->getQuote ()->getShippingAddress()->getShippingMethod () == 'bongointernational_economy') {
89
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsDuty ( ( string ) $response_economy->dutyCost );
90
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsInsurance ( ( string ) $response_economy->insuranceCost );
91
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsTax ( ( string ) $response_economy->taxCost );
92
+ }
93
+ }
94
+
95
+ if (in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/shipping_methods' ), array ("2", "3" ) )) {
96
+ $response_express = $client->ConnectLandedCost ( ( object ) ($params + array ('service' => '0' )) );
97
+ $shipping_cost_express = $response_express->shippingCost;
98
+
99
+ if ($shipping_cost_express > 0) {
100
+ $method = Mage::getModel ( 'shipping/rate_result_method' );
101
+ $method->setCarrier ( 'bongointernational' );
102
+ $method->setCarrierTitle ( $this->getConfigData ( 'title' ) );
103
+ $method->setMethod ( 'express' );
104
+ $method->setMethodTitle ( $this->getConfigData ( 'name_express' ) );
105
+ $method->setPrice ( $shipping_cost_express );
106
+ $method->setCost ( $shipping_cost_express );
107
+ $result->append ( $method );
108
+ $append = true;
109
+
110
+ if (Mage::getSingleton ( 'checkout/session' )->getQuote ()->getShippingAddress()->getShippingMethod () == 'bongointernational_express') {
111
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsDuty ( ( string ) $response_express->dutyCost );
112
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsInsurance ( ( string ) $response_express->insuranceCost );
113
+ Mage::getSingleton ( 'checkout/session' )->setBongoTotalsTax ( ( string ) $response_express->taxCost );
114
+ }
115
+ }
116
+ }
117
+
118
+ return ($append == true ? $result : false);
119
+ }
120
+
121
+ public function checkSkuStatus($items, $error = false) {
122
+ if ($items) {
123
+ $skus = array ();
124
+ $names = array ();
125
+
126
+ foreach ( $items as $item ) {
127
+ if (! $this->isSimpleProduct ( $item->getProduct () )) {
128
+ continue;
129
+ }
130
+
131
+ $skus [] = array ('productID' => $item->getSku () );
132
+ $names [$item->getSku ()] = $item->getName ();
133
+ }
134
+
135
+ if (! Mage::getModel ( 'bongointernational/products_status' )->status ( $skus, $names, $error )) {
136
+ return false;
137
+ }
138
+ }
139
+
140
+ return true;
141
+ }
142
+
143
+ public function getDomesticShipping($items, $request = '', $quote_data = '') {
144
+ $domestic_shipping = 0;
145
+ $domestic_method = Mage::getStoreConfig ( 'bongointernational_config/config/shipping_type' );
146
+ $domestic_default = Mage::getStoreConfig ( 'bongointernational_config/config/domestic_shipping' );
147
+
148
+ if ($domestic_method == 'bongointernational_manual') {
149
+ if ($items) {
150
+ foreach ( $items as $item ) {
151
+ if (! $this->isSimpleProduct ( $item->getProduct () )) {
152
+ continue;
153
+ }
154
+
155
+ $_product = Mage::getModel ( 'catalog/product' )->load ( $item->getProduct ()->getId () );
156
+ $domestic_shipping += ($_product->getBongoDomesticCost () > 0 ? $_product->getBongoDomesticCost () : $domestic_default) * $item->getQty ();
157
+ }
158
+ }
159
+ } else if (! in_array ( $domestic_method, array ('bongointernational_free', 'bongointernational_manual' ) )) {
160
+ try {
161
+ $street = array (Mage::getStoreConfig ( 'bongointernational_config/dc/address1' ) );
162
+ $address2 = Mage::getStoreConfig ( 'bongointernational_config/dc/address2' );
163
+
164
+ if (! empty ( $address2 )) {
165
+ $street [] = $address2;
166
+ }
167
+
168
+ if (empty ( $request )) {
169
+ $domestic_shipping = Mage::getSingleton ( 'core/session' )->getBongoDomesticShipping ();
170
+
171
+ if (( float ) $domestic_shipping > 0) {
172
+ return $domestic_shipping;
173
+ }
174
+
175
+ $quote = Mage::getModel ( 'sales/quote' );
176
+ $quote->setData ( ! empty ( $quote_data ) ? $quote_data : Mage::getSingleton ( 'checkout/session' )->getQuote ()->getData () );
177
+ $address = $quote->getShippingAddress ();
178
+ $address_data = $address->getData ();
179
+ $street = array (Mage::getStoreConfig ( 'bongointernational_config/dc/address1' ) );
180
+ $address2 = Mage::getStoreConfig ( 'bongointernational_config/dc/address2' );
181
+
182
+ if (! empty ( $address2 )) {
183
+ $street [] = $address2;
184
+ }
185
+
186
+ $address->setCountryId ( Mage::getStoreConfig ( 'bongointernational_config/dc/country' ) )->setRegionId ( Mage::getStoreConfig ( 'bongointernational_config/dc/state' ) )->setRegion ( '' )->setCity ( Mage::getStoreConfig ( 'bongointernational_config/dc/city' ) )->setPostcode ( Mage::getStoreConfig ( 'bongointernational_config/dc/zip' ) )->setStreet ( $street );
187
+ $address->setCollectShippingRates ( true );
188
+ $address->collectTotals ();
189
+
190
+ $rate = $address->getShippingRateByCode ( $domestic_method );
191
+
192
+ if (is_object ( $rate ) && $rate->getPrice ()) {
193
+ $domestic_shipping = $rate->getPrice ();
194
+ } else {
195
+ $rates = $address->getGroupedAllShippingRates ();
196
+
197
+ foreach ( $rates as $carrier ) {
198
+ foreach ( $carrier as $rate ) {
199
+ if ($domestic_shipping == 0 || $domestic_shipping > $rate->getPrice ()) {
200
+ $domestic_shipping = $rate->getPrice ();
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ $address->setData ( $address_data );
207
+ } else {
208
+ $request_clone = new Mage_Shipping_Model_Rate_Request ();
209
+ $request_clone->setData ( $request->getData () );
210
+ $request_clone->setDestCountryId ( Mage::getStoreConfig ( 'bongointernational_config/dc/country' ) )->setDestRegionId ( Mage::getStoreConfig ( 'bongointernational_config/dc/state' ) )->setDestRegionCode ( '' )->setDestCity ( Mage::getStoreConfig ( 'bongointernational_config/dc/city' ) )->setDestPostcode ( Mage::getStoreConfig ( 'bongointernational_config/dc/zip' ) )->setDestStreet ( implode ( ',', $street ) );
211
+
212
+ $carriers = Mage::getStoreConfig ( 'carriers', $request_clone->getStoreId () );
213
+ $shipping = Mage::getModel ( 'shipping/shipping' );
214
+
215
+ foreach ( $carriers as $carrierCode => $carrierConfig ) {
216
+ $shipping->collectCarrierRates ( $carrierCode, $request_clone );
217
+ }
218
+
219
+ $shippingRates = $shipping->getResult ()->getAllRates ();
220
+
221
+ foreach ( $shippingRates as $shippingRate ) {
222
+ $rate = Mage::getModel ( 'sales/quote_address_rate' )->importShippingRate ( $shippingRate );
223
+
224
+ if ($rate->getCode () == $domestic_method) {
225
+ $domestic_shipping = $rate->getPrice ();
226
+ }
227
+ }
228
+
229
+ if ($domestic_shipping == 0) {
230
+ foreach ( $shippingRates as $shippingRate ) {
231
+ $rate = Mage::getModel ( 'sales/quote_address_rate' )->importShippingRate ( $shippingRate );
232
+
233
+ if ($domestic_shipping == 0 || $domestic_shipping > $rate->getPrice ()) {
234
+ $domestic_shipping = $rate->getPrice ();
235
+ }
236
+ }
237
+ }
238
+ }
239
+ } catch ( Exception $err ) {
240
+ }
241
+ }
242
+
243
+ Mage::getSingleton ( 'core/session' )->setBongoDomesticShipping ( $domestic_shipping );
244
+ return $domestic_shipping;
245
+ }
246
+
247
+ public function isSimpleProduct($product) {
248
+ if ($product->getTypeId () == 'configurable' || $product->getTypeId () == 'bundle' || $product->getTypeId () == 'grouped') {
249
+ return false;
250
+ }
251
+
252
+ return true;
253
+ }
254
+
255
+ public function getAllowedMethods() {
256
+ return array ('economy' => $this->getConfigData ( 'name' ), 'express' => $this->getConfigData ( 'name_express' ) );
257
+ }
258
+ }
app/code/community/Bongo/International/Model/Shipping/Observer.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Shipping_Observer extends Mage_Core_Model_Abstract {
4
+ public function sendDomesticTracking($observer) {
5
+ $params = '';
6
+ $response = '';
7
+
8
+ try {
9
+ $shipment = $observer->getEvent ()->getShipment ();
10
+ $order = $shipment->getOrder ();
11
+ $store_id = $order->getStoreId ();
12
+
13
+ if (! $this->getIsEnabled ( $store_id )) {
14
+ return;
15
+ }
16
+
17
+ $bongo_id = $order->getBongoId ();
18
+
19
+ if (! $bongo_id) {
20
+ return;
21
+ }
22
+
23
+ $tracking_numbers = array ();
24
+ $tracking_list = array ();
25
+ $domestic_numbers = array ();
26
+ $i = 0;
27
+
28
+ foreach ( $shipment->getAllTracks () as $tracking ) {
29
+ $carrier = $tracking->getCarrierCode ();
30
+
31
+ if ($carrier == "bongointernational") {
32
+ continue;
33
+ }
34
+
35
+ switch ($carrier) {
36
+ case "ups" :
37
+ $tracking_numbers [$i] ['carrier'] = "1";
38
+
39
+ break;
40
+ case "fedex" :
41
+ $tracking_numbers [$i] ['carrier'] = "2";
42
+
43
+ break;
44
+ case "dhl" :
45
+ $tracking_numbers [$i] ['carrier'] = "3";
46
+
47
+ break;
48
+ case "usps" :
49
+ $tracking_numbers [$i] ['carrier'] = "4";
50
+
51
+ break;
52
+ case "custom" :
53
+ default :
54
+ $tracking_numbers [$i] ['carrier'] = "6";
55
+
56
+ break;
57
+ }
58
+
59
+ $tracking_numbers [$i] ['number'] = $tracking->getNumber ();
60
+ $domestic_numbers [] = $tracking->getNumber ();
61
+
62
+ $i ++;
63
+ }
64
+
65
+ if (count ( $tracking_numbers ) > 0) {
66
+ $items = $shipment->getItemsCollection ();
67
+ $i = 0;
68
+
69
+ foreach ( $items as $item ) {
70
+ if ($item->getQty () > 0) {
71
+ $tracking_number = isset ( $tracking_numbers [$i] ) ? $tracking_numbers [$i] : $tracking_numbers [0];
72
+ $tracking_list [] = ( object ) array ('productID' => $item->getSku (), 'trackingNumber' => $tracking_number ['number'], 'quantity' => $item->getQty (), 'carrier' => $tracking_number ['carrier'] );
73
+ $i ++;
74
+ }
75
+ }
76
+ }
77
+
78
+ if (count ( $tracking_list ) > 0) {
79
+ $client = new SoapClient ( "https://api.bongous.com/services/v4?wsdl" );
80
+ $params = array ('partnerKey' => Mage::getStoreConfig ( 'bongointernational_config/config/api_key', $store_id ), 'language' => 'en', 'orderNumber' => $bongo_id, 'trackList' => $tracking_list );
81
+ $response = $client->ConnectOrderTrackingUpdate ( ( object ) $params );
82
+
83
+ if (( int ) $response->error > 0) {
84
+ throw new Exception ( ( int ) $response->error . ' - ' . ( string ) $response->errorMessage . ' - ' . ( string ) $response->errorMessageDetail );
85
+ } else {
86
+ $unified = $order->getBongoTracking ();
87
+
88
+ if (! empty ( $unified )) {
89
+ foreach ( $shipment->getAllTracks () as $tracking ) {
90
+ //$tracking->reset ();
91
+ }
92
+
93
+ $track = Mage::getModel ( 'sales/order_shipment_track' )->addData ( array ('carrier_code' => $order->getShippingCarrier ()->getCarrierCode (), 'title' => $order->getShippingCarrier ()->getConfigData ( 'title' ), 'number' => $unified ) );
94
+ $shipment->addTrack ( $track );
95
+ $shipment->save ();
96
+
97
+ $domestic_tracking = unserialize ( $order->getBongoTrackingDomestic () );
98
+
99
+ if (is_array ( $domestic_tracking )) {
100
+ foreach ( $domestic_tracking as $val ) {
101
+ $domestic_numbers [] = $val;
102
+ }
103
+ }
104
+
105
+ $order->setBongoTrackingDomestic ( serialize ( $domestic_numbers ) );
106
+ $order->save ();
107
+ }
108
+ }
109
+ }
110
+ } catch ( Exception $e ) {
111
+ Mage::log ( "Shipment Error: {$e->getMessage()}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ) . "; Raw Request Params: " . print_r ( $params, true ) . "; Raw Response: " . print_r ( $response, true ), null, 'bongo_exception.log' );
112
+
113
+ echo $e->getMessage ();
114
+ }
115
+ }
116
+
117
+ public function getIsEnabled($store_id = null) {
118
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id )) {
119
+ return true;
120
+ } else {
121
+ return false;
122
+ }
123
+ }
124
+ }
app/code/community/Bongo/International/Model/Status.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Model_Status extends Mage_Core_Model_Abstract {
4
+ protected function _construct() {
5
+ $this->_init ( 'bongointernational/status' );
6
+ }
7
+ }
app/code/community/Bongo/International/Model/Total/Duty/Creditmemo.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Duty_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
3
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) {
4
+ $order = $creditmemo->getOrder ();
5
+ $store_id = $order->getStoreId ();
6
+
7
+ if (! $this->getIsEnabled ( $store_id )) {
8
+ return $this;
9
+ }
10
+
11
+ $amount = $order->getBongoTotalsDuty ();
12
+
13
+ if ($amount > 0) {
14
+ $creditmemo->setGrandTotal ( $creditmemo->getGrandTotal () + $amount );
15
+ $creditmemo->setBaseGrandTotal ( $creditmemo->getBaseGrandTotal () + $amount );
16
+ }
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function getIsEnabled($store_id = null) {
22
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id )) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ }
app/code/community/Bongo/International/Model/Total/Duty/Invoice.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Duty_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
3
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
4
+ $order = $invoice->getOrder ();
5
+ $store_id = $order->getStoreId ();
6
+
7
+ if (! $this->getIsEnabled ( $store_id )) {
8
+ return $this;
9
+ }
10
+
11
+ $amount = $order->getBongoTotalsDuty ();
12
+
13
+ if ($amount > 0) {
14
+ $invoice->setGrandTotal ( $invoice->getGrandTotal () + $amount );
15
+ $invoice->setBaseGrandTotal ( $invoice->getBaseGrandTotal () + $amount );
16
+ }
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function getIsEnabled($store_id = null) {
22
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id )) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ }
app/code/community/Bongo/International/Model/Total/Duty/Quote.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Duty_Quote extends Mage_Sales_Model_Quote_Address_Total_Abstract {
3
+ public function __construct() {
4
+ $this->setCode ( 'bongointernational_duty' );
5
+ }
6
+
7
+ public function getLabel() {
8
+ return Mage::helper ( 'bongointernational' )->__ ( 'Duty' );
9
+ }
10
+
11
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
12
+ parent::collect ( $address );
13
+
14
+ if (($address->getAddressType () == 'billing')) {
15
+ return $this;
16
+ }
17
+
18
+ $quote = $address->getQuote ();
19
+ $store_id = $quote->getStoreId ();
20
+
21
+ if (! $this->getIsEnabled ( $store_id )) {
22
+ return $this;
23
+ }
24
+
25
+ $amount = Mage::getSingleton ( 'checkout/session' )->getBongoTotalsDuty ();
26
+
27
+ if ($amount > 0) {
28
+ $this->_addAmount ( $amount );
29
+ $this->_addBaseAmount ( $amount );
30
+ }
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function fetch(Mage_Sales_Model_Quote_Address $address) {
36
+ $quote = $address->getQuote ();
37
+ $store_id = $quote->getStoreId ();
38
+
39
+ if (! $this->getIsEnabled ( $store_id )) {
40
+ return $this;
41
+ }
42
+
43
+ if ($address->getAddressType () == 'billing') {
44
+ $amount = Mage::getSingleton ( 'checkout/session' )->getBongoTotalsDuty ();
45
+
46
+ if ($amount > 0) {
47
+ $address->addTotal ( array ('code' => $this->getCode (), 'title' => $this->getLabel (), 'value' => $amount ) );
48
+ }
49
+ }
50
+
51
+ return $this;
52
+ }
53
+
54
+ public function getIsEnabled($store_id = null) {
55
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id )) {
56
+ return true;
57
+ } else {
58
+ return false;
59
+ }
60
+ }
61
+ }
app/code/community/Bongo/International/Model/Total/Insurance/Creditmemo.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Insurance_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
3
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) {
4
+ $order = $creditmemo->getOrder ();
5
+ $store_id = $order->getStoreId ();
6
+
7
+ if (! $this->getIsEnabled ( $store_id )) {
8
+ return $this;
9
+ }
10
+
11
+ $amount = $order->getBongoTotalsInsurance ();
12
+
13
+ if ($amount > 0) {
14
+ $creditmemo->setGrandTotal ( $creditmemo->getGrandTotal () + $amount );
15
+ $creditmemo->setBaseGrandTotal ( $creditmemo->getBaseGrandTotal () + $amount );
16
+ }
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function getIsEnabled($store_id = null) {
22
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type', $store_id ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance', $store_id )) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ }
app/code/community/Bongo/International/Model/Total/Insurance/Invoice.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Insurance_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
3
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
4
+ $order = $invoice->getOrder ();
5
+ $store_id = $order->getStoreId ();
6
+
7
+ if (! $this->getIsEnabled ( $store_id )) {
8
+ return $this;
9
+ }
10
+
11
+ $amount = $order->getBongoTotalsInsurance ();
12
+
13
+ if ($amount > 0) {
14
+ $invoice->setGrandTotal ( $invoice->getGrandTotal () + $amount );
15
+ $invoice->setBaseGrandTotal ( $invoice->getBaseGrandTotal () + $amount );
16
+ }
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function getIsEnabled($store_id = null) {
22
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type', $store_id ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance', $store_id )) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ }
app/code/community/Bongo/International/Model/Total/Insurance/Quote.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Insurance_Quote extends Mage_Sales_Model_Quote_Address_Total_Abstract {
3
+ public function __construct() {
4
+ $this->setCode ( 'bongointernational_insurance' );
5
+ }
6
+
7
+ public function getLabel() {
8
+ return Mage::helper ( 'bongointernational' )->__ ( 'Shipping Insurance' );
9
+ }
10
+
11
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
12
+ parent::collect ( $address );
13
+
14
+ if (($address->getAddressType () == 'billing')) {
15
+ return $this;
16
+ }
17
+
18
+ $quote = $address->getQuote ();
19
+ $store_id = $quote->getStoreId ();
20
+
21
+ if (! $this->getIsEnabled ( $store_id )) {
22
+ return $this;
23
+ }
24
+
25
+ $amount = Mage::getSingleton ( 'checkout/session' )->getBongoTotalsInsurance ();
26
+
27
+ if ($amount > 0) {
28
+ $this->_addAmount ( $amount );
29
+ $this->_addBaseAmount ( $amount );
30
+ }
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function fetch(Mage_Sales_Model_Quote_Address $address) {
36
+ $quote = $address->getQuote ();
37
+ $store_id = $quote->getStoreId ();
38
+
39
+ if (! $this->getIsEnabled ( $store_id )) {
40
+ return $this;
41
+ }
42
+
43
+ if ($address->getAddressType () == 'billing') {
44
+ $amount = Mage::getSingleton ( 'checkout/session' )->getBongoTotalsInsurance ();
45
+
46
+ if ($amount > 0) {
47
+ $address->addTotal ( array ('code' => $this->getCode (), 'title' => $this->getLabel (), 'value' => $amount ) );
48
+ }
49
+ }
50
+
51
+ return $this;
52
+ }
53
+
54
+ public function getIsEnabled($store_id = null) {
55
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type', $store_id ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/include_insurance', $store_id )) {
56
+ return true;
57
+ } else {
58
+ return false;
59
+ }
60
+ }
61
+ }
app/code/community/Bongo/International/Model/Total/Tax/Creditmemo.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Tax_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract {
3
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo) {
4
+ $order = $creditmemo->getOrder ();
5
+ $store_id = $order->getStoreId ();
6
+
7
+ if (! $this->getIsEnabled ( $store_id )) {
8
+ return $this;
9
+ }
10
+
11
+ $amount = $order->getBongoTotalsTax ();
12
+
13
+ if ($amount > 0) {
14
+ $creditmemo->setGrandTotal ( $creditmemo->getGrandTotal () + $amount );
15
+ $creditmemo->setBaseGrandTotal ( $creditmemo->getBaseGrandTotal () + $amount );
16
+ }
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function getIsEnabled($store_id = null) {
22
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id )) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ }
app/code/community/Bongo/International/Model/Total/Tax/Invoice.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Tax_Invoice extends Mage_Sales_Model_Order_Invoice_Total_Abstract {
3
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice) {
4
+ $order = $invoice->getOrder ();
5
+ $store_id = $order->getStoreId ();
6
+
7
+ if (! $this->getIsEnabled ( $store_id )) {
8
+ return $this;
9
+ }
10
+
11
+ $amount = $order->getBongoTotalsTax ();
12
+
13
+ if ($amount > 0) {
14
+ $invoice->setGrandTotal ( $invoice->getGrandTotal () + $amount );
15
+ $invoice->setBaseGrandTotal ( $invoice->getBaseGrandTotal () + $amount );
16
+ }
17
+
18
+ return $this;
19
+ }
20
+
21
+ public function getIsEnabled($store_id = null) {
22
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id )) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
27
+ }
28
+ }
app/code/community/Bongo/International/Model/Total/Tax/Quote.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bongo_International_Model_Total_Tax_Quote extends Mage_Sales_Model_Quote_Address_Total_Abstract {
3
+ public function __construct() {
4
+ $this->setCode ( 'bongointernational_tax' );
5
+ }
6
+
7
+ public function getLabel() {
8
+ return Mage::helper ( 'bongointernational' )->__ ( 'Taxes' );
9
+ }
10
+
11
+ public function collect(Mage_Sales_Model_Quote_Address $address) {
12
+ parent::collect ( $address );
13
+
14
+ if (($address->getAddressType () == 'billing')) {
15
+ return $this;
16
+ }
17
+
18
+ $quote = $address->getQuote ();
19
+ $store_id = $quote->getStoreId ();
20
+
21
+ if (! $this->getIsEnabled ( $store_id )) {
22
+ return $this;
23
+ }
24
+
25
+ $amount = Mage::getSingleton ( 'checkout/session' )->getBongoTotalsTax ();
26
+
27
+ if ($amount > 0) {
28
+ $this->_addAmount ( $amount );
29
+ $this->_addBaseAmount ( $amount );
30
+ }
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function fetch(Mage_Sales_Model_Quote_Address $address) {
36
+ $quote = $address->getQuote ();
37
+ $store_id = $quote->getStoreId ();
38
+
39
+ if (! $this->getIsEnabled ( $store_id )) {
40
+ return $this;
41
+ }
42
+
43
+ if ($address->getAddressType () == 'billing') {
44
+ $amount = Mage::getSingleton ( 'checkout/session' )->getBongoTotalsTax ();
45
+
46
+ if ($amount > 0) {
47
+ $address->addTotal ( array ('code' => $this->getCode (), 'title' => $this->getLabel (), 'value' => $amount ) );
48
+ }
49
+ }
50
+
51
+ return $this;
52
+ }
53
+
54
+ public function getIsEnabled($store_id = null) {
55
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/active', $store_id ) && in_array ( Mage::getStoreConfig ( 'bongointernational_config/config/integration_type' ), array ("2", "3" ) ) && Mage::getStoreConfig ( 'bongointernational_config/config/duty_paid', $store_id )) {
56
+ return true;
57
+ } else {
58
+ return false;
59
+ }
60
+ }
61
+ }
app/code/community/Bongo/International/controllers/Adminhtml/BongointernationalController.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_Adminhtml_BongointernationalController extends Mage_Adminhtml_Controller_Action {
4
+ public function syncAction() {
5
+ if (! $this->_checkActive ()) {
6
+ return false;
7
+ }
8
+
9
+ $response = Mage::getModel ( 'bongointernational/products_sync' )->sync ( true, $this->_currentStoreId () );
10
+
11
+ if ($response->error > 0) {
12
+ Mage::getSingleton ( 'adminhtml/session' )->addError ( "Error {$response->error}: {$response->errorMessage} - {$response->errorMessageDetail}" );
13
+ } else {
14
+ Mage::getSingleton ( 'adminhtml/session' )->addSuccess ( Mage::helper ( 'bongointernational' )->__ ( 'Your products have been successfully synchronized to Bongo!' ) );
15
+ }
16
+
17
+ session_write_close ();
18
+ $this->_redirect ( 'adminhtml/system_config/edit/section/bongointernational_products' . $this->_appendParams () );
19
+ }
20
+
21
+ public function exportAction() {
22
+ if (! $this->_checkActive ()) {
23
+ return false;
24
+ }
25
+
26
+ $export = 'language,productId,productDescription,url,imageUrl,price,originCountry,hsCode,ECCN,haz,licenseFlag,importFlag,productType,L1,W1,H1,WT1,L2,W2,H2,WT2,L3,W3,H3,WT3,L4,W4,H4,WT4' . "\n";
27
+ $products = Mage::getModel ( 'bongointernational/products_sync' )->sync ( false, $this->_currentStoreId () );
28
+
29
+ foreach ( $products as $prod ) {
30
+ $export .= 'en,"' . str_replace ( '"', '""', $prod ['productID'] ) . '","' . str_replace ( '"', '""', $prod ['description'] ) . '","' . str_replace ( '"', '""', $prod ['url'] ) . '","' . str_replace ( '"', '""', $prod ['imageUrl'] ) . '","' . $prod ['price'] . '","' . $prod ['countryOfOrigin'] . '","' . $prod ['hsCode'] . '","' . $prod ['eccn'] . '","' . $prod ['hazFlag'] . '","' . $prod ['licenseFlag'] . '","' . $prod ['importFlag'] . '","' . $prod ['productType'] . '",,,,"' . $prod ['itemInformation'] [0] ['wt'] . '",,,,,,,,,,,,' . "\n";
31
+ }
32
+
33
+ header ( 'Content-Type: application/csv' );
34
+ header ( 'Content-Disposition: attachment; filename=productexport_' . date ( 'Y-m-d' ) . '.csv' );
35
+ header ( 'Pragma: no-cache' );
36
+
37
+ echo $export;
38
+ exit ();
39
+ }
40
+
41
+ protected function _checkActive() {
42
+ if (! Mage::getStoreConfig ( 'bongointernational_config/config/active', $this->_currentStoreId () )) {
43
+ Mage::getSingleton ( 'adminhtml/session' )->addError ( Mage::helper ( 'bongointernational' )->__ ( 'This action cannot be completed because the Bongo International module is currently Disabled.' ) );
44
+
45
+ session_write_close ();
46
+ $this->_redirect ( 'adminhtml/system_config/edit/section/bongointernational_products' . $this->_appendParams () );
47
+
48
+ return false;
49
+ }
50
+
51
+ return true;
52
+ }
53
+
54
+ protected function _currentStoreId() {
55
+ $store_id = null;
56
+
57
+ $website = Mage::app ()->getRequest ()->getParam ( 'website' );
58
+ $store = Mage::app ()->getRequest ()->getParam ( 'store' );
59
+
60
+ if (! empty ( $store )) {
61
+ $store_id = Mage::getModel ( 'core/store' )->load ( $store )->getId ();
62
+ } else if (! empty ( $website )) {
63
+ $website_id = Mage::getModel ( 'core/website' )->load ( $website )->getId ();
64
+ $store_id = Mage::app ()->getWebsite ( $website_id )->getDefaultStore ()->getId ();
65
+ }
66
+
67
+ return $store_id;
68
+ }
69
+
70
+ protected function _appendParams() {
71
+ $params = null;
72
+
73
+ $website = Mage::app ()->getRequest ()->getParam ( 'website' );
74
+ $store = Mage::app ()->getRequest ()->getParam ( 'store' );
75
+
76
+ if (! empty ( $website )) {
77
+ $params .= "/website/{$website}";
78
+ }
79
+
80
+ if (! empty ( $store )) {
81
+ $params .= "/store/{$store}";
82
+ }
83
+
84
+ return $params;
85
+ }
86
+ }
app/code/community/Bongo/International/controllers/CallbackController.php ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_CallbackController extends Mage_Core_Controller_Front_Action {
4
+ public function indexAction() {
5
+ try {
6
+ if (empty ( $_POST ['status'] ) || empty ( $_POST ['partner_key'] ) || empty ( $_POST ['order'] )) {
7
+ throw new Exception ( 'Invalid request' );
8
+ }
9
+
10
+ if (! in_array ( $_POST ['status'], array ('R', 'C', 'N', 'V', 'B', 'P', 'I', 'S', 'D', 'Q' ) )) {
11
+ throw new Exception ( 'Invalid status' );
12
+ }
13
+
14
+ if ($_POST ['partner_key'] !== Mage::getStoreConfig ( 'bongointernational_config/config/api_key' )) {
15
+ throw new Exception ( 'Invalid partner key' );
16
+ }
17
+
18
+ if (! function_exists ( 'simplexml_load_string' )) {
19
+ throw new Exception ( 'PHP extension SimpleXML not installed' );
20
+ }
21
+
22
+ $xml = simplexml_load_string ( base64_decode ( $_POST ['order'] ) );
23
+
24
+ if (! $xml) {
25
+ throw new Exception ( 'Invalid or malformed order request' );
26
+ }
27
+
28
+ $orders = array ($xml->channel->item );
29
+
30
+ Mage::app ()->getStore ()->setConfig ( Mage_Sales_Model_Order::XML_PATH_EMAIL_ENABLED, "0" );
31
+
32
+ foreach ( $orders as $order ) {
33
+ $collection = Mage::getModel ( 'sales/order' )->getCollection ()->addAttributeToSelect ( 'entity_id' )->addAttributeToFilter ( 'bongo_id', ( int ) $order->idorder )->load ();
34
+
35
+ $order_id = null;
36
+
37
+ if ($collection->count () > 0) {
38
+ foreach ( $collection as $existing ) {
39
+ $order_id = ( int ) $existing->getId ();
40
+ }
41
+ }
42
+
43
+ if (empty ( $order_id )) {
44
+ $order_items = array ();
45
+
46
+ foreach ( $order->products as $product ) {
47
+ $order_items [( string ) $product->itemproducts->productid] = ( int ) $product->itemproducts->qty;
48
+ }
49
+
50
+ $quote = Mage::getModel ( 'sales/quote' )->load ( ( int ) $order->custom_order1 );
51
+ $quote->setIsActive ( true )->save ();
52
+ $quote->reserveOrderId ();
53
+
54
+ $customer = Mage::getModel ( 'customer/customer' );
55
+ $customer->setWebsiteId ( Mage::app ()->getWebsite ()->getId () );
56
+ $customer->loadByEmail ( ( string ) $order->customeremail );
57
+
58
+ $customer_region = Mage::getModel ( 'directory/region' )->loadByName ( ( string ) $order->customerstate, ( string ) $order->customercountry );
59
+ $customer_region_id = $customer_region->getId ();
60
+
61
+ $_new_address = array ('firstname' => ( string ) $order->customerfirstname, 'lastname' => ( string ) $order->customerlastname, 'street' => array ('0' => ( string ) $order->customeraddres1, '1' => ( string ) $order->customeraddres2 ),
62
+
63
+ 'city' => ( string ) $order->customercity, 'region_id' => ! empty ( $customer_region_id ) ? $customer_region_id : '', 'region' => ! empty ( $customer_region_id ) ? '' : ( string ) $order->customerstate, 'postcode' => ( string ) $order->customerzip, 'country_id' => ( string ) $order->customercountry, 'telephone' => ( string ) $order->customerphone );
64
+
65
+ $customerAddress = Mage::getModel ( 'customer/address' );
66
+ $passwordHash = $quote->getPasswordHash ();
67
+
68
+ if ($customer->getId ()) {
69
+ $customerAddress->setData ( $_new_address )->setCustomerId ( $customer->getId () )->setIsDefaultBilling ( '1' )->setSaveInAddressBook ( '1' );
70
+ $customerAddress->save ();
71
+ } else if ($quote->getCheckoutMethod () == "register" && ! empty ( $passwordHash )) {
72
+ $customer->setEmail ( ( string ) $order->customeremail );
73
+ $customer->setFirstname ( ( string ) $order->customerfirstname );
74
+ $customer->setLastname ( ( string ) $order->customerlastname );
75
+ $customer->setPassword ( $customer->decryptPassword ( $passwordHash ) );
76
+ $customer->setPasswordHash ( $customer->hashPassword ( $customer->getPassword () ) );
77
+ $customer->save ();
78
+ $customer->setConfirmation ( null );
79
+ $customer->save ();
80
+
81
+ if (Mage::getStoreConfig ( 'bongointernational_config/config/new_account_magento' )) {
82
+ $customer->sendNewAccountEmail ();
83
+ }
84
+
85
+ $customerAddress->setData ( $_new_address )->setCustomerId ( $customer->getId () )->setIsDefaultBilling ( '1' )->setIsDefaultShipping ( '1' )->setSaveInAddressBook ( '1' );
86
+ $customerAddress->save ();
87
+ }
88
+
89
+ if ($customer->getId ()) {
90
+ $quote->assignCustomer ( $customer );
91
+ }
92
+
93
+ $billing = $quote->getBillingAddress ();
94
+ $billing->setFirstname ( ( string ) $order->customerfirstname );
95
+ $billing->setLastname ( ( string ) $order->customerlastname );
96
+ $billing->setCompany ( ( string ) $order->company );
97
+
98
+ $billing_street = array (( string ) $order->customeraddres1 );
99
+
100
+ if (( string ) $order->customeraddres2 != "") {
101
+ $street [] = ( string ) $order->customeraddres2;
102
+ }
103
+
104
+ $billing->setStreet ( $billing_street );
105
+ $billing->setCity ( ( string ) $order->customercity );
106
+ $billing->setRegion ( ! empty ( $customer_region_id ) ? '' : ( string ) $order->customerstate );
107
+ $billing->setRegionId ( ! empty ( $customer_region_id ) ? $customer_region_id : '' );
108
+ $billing->setPostcode ( ( string ) $order->customerzip );
109
+ $billing->setCountryId ( ( string ) $order->customercountry );
110
+ $billing->setTelephone ( ( string ) $order->customerphone );
111
+ $billing->setEmail ( ( string ) $order->customeremail );
112
+
113
+ $shipping = $quote->getShippingAddress ();
114
+ $shipping->setFirstname ( ( string ) $order->customerfirstname );
115
+ $shipping->setLastname ( ( string ) $order->customerlastname );
116
+ $shipping->setCompany ( ( string ) $order->company );
117
+
118
+ $shipping_street = array (( string ) $order->shipaddress1 );
119
+
120
+ if (( string ) $order->shipaddress2 != "") {
121
+ $shipping_street [] = ( string ) $order->shipaddress2;
122
+ }
123
+
124
+ $shipping->setStreet ( $shipping_street );
125
+ $shipping->setCity ( ( string ) $order->shipcity );
126
+
127
+ $shipping_region = Mage::getModel ( 'directory/region' )->loadByName ( ( string ) $order->shipstate, ( string ) $order->shipcountry );
128
+ $shipping_region_id = $shipping_region->getId ();
129
+
130
+ $shipping->setRegion ( ! empty ( $shipping_region_id ) ? '' : ( string ) $order->shipstate );
131
+ $shipping->setRegionId ( ! empty ( $shipping_region_id ) ? $shipping_region_id : '' );
132
+ $shipping->setPostcode ( ( string ) $order->shipzip );
133
+ $shipping->setCountryId ( ( string ) $order->shipcountry );
134
+ $shipping->setTelephone ( ( string ) $order->shipphone );
135
+ $shipping->setSameAsBilling ( false );
136
+ $shipping->setShippingMethod ( 'bongointernational_economy' );
137
+ $quote->setShippingMethod ( 'bongointernational_economy' );
138
+ $quote->getPayment ()->importData ( array ('method' => 'bongointernational' ) );
139
+ $quote->setPaymentMethod ( 'bongointernational' );
140
+
141
+ $quote->setCustomerEmail ( ( string ) $order->customeremail );
142
+
143
+ $quote->save ();
144
+
145
+ $convert = Mage::getModel ( 'sales/convert_quote' );
146
+ $new_order = $convert->toOrder ( $quote );
147
+ //$new_order->addressToOrder ( $quote->getShippingAddress(), $new_order );
148
+ $new_order->setBillingAddress ( $convert->addressToOrderAddress ( $billing ) );
149
+ $new_order->setShippingAddress ( $convert->addressToOrderAddress ( $shipping ) );
150
+ $new_order->setPayment ( $convert->paymentToOrderPayment ( $quote->getPayment () ) );
151
+ $new_order->setSendConfirmation ( false );
152
+
153
+ foreach ( $quote->getAllItems () as $item ) {
154
+ $product = $item->getProduct ();
155
+
156
+ if ($product->getTypeId () !== 'configurable' && $product->getTypeId () !== 'bundle' && $product->getTypeId () !== 'grouped' && ! in_array ( ( string ) $item->getSku (), array_keys ( $order_items ) )) {
157
+ continue;
158
+ }
159
+
160
+ $item->setQty ( $order_items [( string ) $item->getSku ()] );
161
+
162
+ $orderItem = $convert->itemToOrderItem ( $item );
163
+
164
+ $options = array ();
165
+ if ($productOptions = $product->getTypeInstance ( true )->getOrderOptions ( $product )) {
166
+
167
+ $options = $productOptions;
168
+ }
169
+ if ($addOptions = $item->getOptionByCode ( 'additional_options' )) {
170
+ $options ['additional_options'] = unserialize ( $addOptions->getValue () );
171
+ }
172
+ if ($options) {
173
+ $orderItem->setProductOptions ( $options );
174
+ }
175
+ if ($item->getParentItem ()) {
176
+ $orderItem->setParentItem ( $new_order->getItemByQuoteItemId ( $item->getParentItem ()->getId () ) );
177
+ }
178
+ $new_order->addItem ( $orderItem );
179
+ }
180
+
181
+ $shippingtotal = ( float ) $order->orderdutycost + ( float ) $order->ordertaxcost + ( float ) $order->ordershippingcost + ( float ) $order->ordershippingcostdomestic + ( float ) $order->orderinsurancecost;
182
+ $total = ( float ) $order->ordersubtotal + $shippingtotal;
183
+ $new_order->setShippingMethod ( 'bongointernational_economy' );
184
+ $new_order->setShippingDescription ( Mage::getStoreConfig ( 'carriers/bongointernational/title' ) . ' - ' . Mage::getStoreConfig ( 'carriers/bongointernational/name' ) );
185
+ $new_order->setSubtotal ( ( float ) $order->ordersubtotal );
186
+ $new_order->setBaseSubtotal ( ( float ) $order->ordersubtotal );
187
+ $new_order->setShippingAmount ( $shippingtotal );
188
+ $new_order->setBaseShippingAmount ( $shippingtotal );
189
+ $new_order->setGrandTotal ( $total );
190
+ $new_order->setBaseGrandTotal ( $total );
191
+
192
+ $new_order->addStatusToHistory ( 'pending', 'Imported order from Bongo' )->setIsCustomerNotified ( false );
193
+ $new_order->place ();
194
+ $new_order->save ();
195
+
196
+ $quote->setIsActive ( false )->save ();
197
+
198
+ /*if (Mage::getStoreConfig ( 'bongointernational_config/config/order_confirmation_magento' )) {
199
+ $new_order->getSendConfirmation ( null );
200
+ $new_order->sendNewOrderEmail ();
201
+ $new_order->save ();
202
+ }*/
203
+
204
+ $order_id = ( int ) $new_order->getId ();
205
+ }
206
+
207
+ if (empty ( $order_id )) {
208
+ throw new Exception ( 'Unable to create order' );
209
+ }
210
+
211
+ $update_order = Mage::getModel ( 'sales/order' )->load ( ( int ) $order_id );
212
+ $update_order->setBongoId ( ( int ) $order->idorder );
213
+ $update_order->setBongoTracking ( ( string ) $order->trackinglink );
214
+ $update_order->setBongoStatusCode ( $_POST ['status'] );
215
+ $update_order->setBongoStatusDate ( strftime ( '%Y-%m-%d %H:%M:%S', Mage::getModel ( 'core/date' )->timestamp ( time () ) ) );
216
+ $update_order->setBongoLandedcosttransactionid ( ( string ) $order->orderlandedCostTransactionID );
217
+ $update_order->setBongoTotalsSubtotal ( ( string ) $order->ordersubtotal );
218
+ $update_order->setBongoTotalsDuty ( ( string ) $order->orderdutycost );
219
+ $update_order->setBongoTotalsTax ( ( string ) $order->ordertaxcost );
220
+ $update_order->setBongoTotalsShipping ( ( string ) $order->ordershippingcost );
221
+ $update_order->setBongoTotalsDomestic ( ( string ) $order->ordershippingcostdomestic );
222
+ $update_order->setBongoTotalsInsurance ( ( string ) $order->orderinsurancecost );
223
+ $update_order->setBongoTotalsTotal ( ( string ) $order->ordertotal );
224
+ $update_order->save ();
225
+
226
+ if ($_POST ['status'] == 'C' && $update_order->canCancel ()) {
227
+ $update_order->addStatusToHistory ( Mage_Sales_Model_Order::STATE_CANCELED, 'Order canceled by Bongo' )->setIsCustomerNotified ( false );
228
+ $update_order->cancel ()->save ();
229
+ } else if ($_POST ['status'] == 'B' && $update_order->canCancel ()) {
230
+ $update_order->addStatusToHistory ( Mage_Sales_Model_Order::STATE_CANCELED, 'Order blacklisted by Bongo' )->setIsCustomerNotified ( false );
231
+ $update_order->cancel ()->save ();
232
+ } else if ($_POST ['status'] == 'V' && $update_order->canInvoice ()) {
233
+ $invoice = Mage::getModel ( 'sales/service_order', $update_order )->prepareInvoice ();
234
+
235
+ if (! $invoice->getTotalQty ()) {
236
+ throw new Exception ( 'Order is missing products' );
237
+ }
238
+
239
+ $invoice->setRequestedCaptureCase ( Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE );
240
+ $invoice->register ();
241
+ $transactionSave = Mage::getModel ( 'core/resource_transaction' )->addObject ( $invoice )->addObject ( $invoice->getOrder () );
242
+ $transactionSave->save ();
243
+ $update_order->addStatusToHistory ( Mage_Sales_Model_Order::STATE_PROCESSING, 'Payment processed by Bongo' )->setIsCustomerNotified ( false );
244
+ $update_order->save ();
245
+ } else if ($_POST ['status'] == 'R' && $update_order->getStatus () !== 'pending') {
246
+ $update_order->addStatusToHistory ( 'pending', 'Marked as Pending by Bongo' )->setIsCustomerNotified ( false );
247
+ $update_order->save ();
248
+ } else if ($_POST ['status'] == 'N' && $update_order->getStatus () !== 'pending') {
249
+ $update_order->addStatusToHistory ( 'pending', 'Marked as New by Bongo' )->setIsCustomerNotified ( false );
250
+ $update_order->save ();
251
+ } else if (in_array ( $_POST ['status'], array ('P', 'I', 'S', 'D', 'Q' ) )) {
252
+ /*$update_order->addStatusToHistory ( $update_order->getStatus(), $_POST ['status'] )->setIsCustomerNotified ( false );
253
+ $update_order->save ();*/
254
+ }
255
+
256
+ $status_data = array ('order_id' => ( int ) $order_id, 'code' => $_POST ['status'], 'description' => '', 'notes' => ( string ) $order->CustomerService, 'created_at' => strftime ( '%Y-%m-%d %H:%M:%S', Mage::getModel ( 'core/date' )->timestamp ( time () ) ) ); // no status code mapping for now
257
+
258
+
259
+ Mage::getModel ( 'bongointernational/status' )->setData ( $status_data )->save ();
260
+
261
+ echo '{SUCCESS}';
262
+ }
263
+ } catch ( Exception $e ) {
264
+ Mage::log ( "Callback Error: {$e->getMessage()}; Timestamp: " . date ( "Y-m-d H:i:s", Mage::getModel ( 'core/date' )->timestamp ( time () ) ) . "; Raw Request: " . print_r ( $_POST, true ), null, 'bongo_exception.log' );
265
+
266
+ echo $e->getMessage ();
267
+ }
268
+ }
269
+ }
app/code/community/Bongo/International/controllers/ContinueController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bongo_International_ContinueController extends Mage_Core_Controller_Front_Action {
4
+ public function indexAction() {
5
+ Mage::getSingleton ( 'customer/session' )->clear ();
6
+ Mage::getSingleton ( 'checkout/session' )->clear ();
7
+
8
+ /*if (Mage::getSingleton ( 'customer/session' )->isLoggedIn ()) {
9
+ try {
10
+ $customer = Mage::getModel ( 'customer/customer' )->load ( Mage::getSingleton ( 'customer/session' )->getCustomer ()->getId () );
11
+ $store = Mage::getModel ( 'core/store' )->load ( $customer->getStoreId () );
12
+ $quote = Mage::getModel ( 'sales/quote' )->setId ( null );
13
+ $quote->assignCustomer ( $customer );
14
+ $quote->setStore ( $store );
15
+ $quote->save ();
16
+ } catch ( Exception $e ) {
17
+ }
18
+ }*/
19
+
20
+ Mage::getSingleton ( 'core/session' )->addSuccess ( Mage::getStoreConfig ( 'bongointernational_config/config/continue_msg' ) );
21
+ $this->_redirect ( '' );
22
+ }
23
+ }
app/code/community/Bongo/International/etc/config.xml ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Bongo_International>
5
+ <version>1.2.1</version>
6
+ </Bongo_International>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <bongointernational>
11
+ <class>Bongo_International_Block</class>
12
+ </bongointernational>
13
+ <sales>
14
+ <rewrite>
15
+ <order_totals>
16
+ <class>bongointernational/sales_order_totals</class>
17
+ </order_totals>
18
+ </rewrite>
19
+ </sales>
20
+ </blocks>
21
+ <models>
22
+ <bongointernational>
23
+ <class>Bongo_International_Model</class>
24
+ <resourceModel>bongointernational_resource</resourceModel>
25
+ </bongointernational>
26
+ <bongointernational_resource>
27
+ <class>Bongo_International_Model_Resource</class>
28
+ <entities>
29
+ <status>
30
+ <table>bongo_order_status</table>
31
+ </status>
32
+ </entities>
33
+ </bongointernational_resource>
34
+ </models>
35
+ <resources>
36
+ <bongointernational_setup>
37
+ <setup>
38
+ <module>Bongo_International</module>
39
+ </setup>
40
+ <connection>
41
+ <use>core_setup</use>
42
+ </connection>
43
+ </bongointernational_setup>
44
+ <bongointernational_write>
45
+ <connection>
46
+ <use>core_write</use>
47
+ </connection>
48
+ </bongointernational_write>
49
+ <bongointernational_read>
50
+ <connection>
51
+ <use>core_read</use>
52
+ </connection>
53
+ </bongointernational_read>
54
+ </resources>
55
+ <helpers>
56
+ <bongointernational>
57
+ <class>Bongo_International_Helper</class>
58
+ </bongointernational>
59
+ </helpers>
60
+ <events>
61
+ <sales_order_place_after>
62
+ <observers>
63
+ <bongointernational_order_observer_send>
64
+ <type>singleton</type>
65
+ <class>bongointernational/order_observer</class>
66
+ <method>sendBongoOrder</method>
67
+ </bongointernational_order_observer_send>
68
+ </observers>
69
+ </sales_order_place_after>
70
+ </events>
71
+ <fieldsets>
72
+ <sales_convert_quote>
73
+ <bongointernational_duty><to_order>*</to_order></bongointernational_duty>
74
+ <bongointernational_tax><to_order>*</to_order></bongointernational_tax>
75
+ <bongointernational_insurance><to_order>*</to_order></bongointernational_insurance>
76
+ </sales_convert_quote>
77
+ <sales_convert_order>
78
+ <bongointernational_duty><to_invoice>*</to_invoice></bongointernational_duty>
79
+ <bongointernational_tax><to_invoice>*</to_invoice></bongointernational_tax>
80
+ <bongointernational_insurance><to_invoice>*</to_invoice></bongointernational_insurance>
81
+ </sales_convert_order>
82
+ <sales_convert_quote_address>
83
+ <bongointernational_duty><to_order>*</to_order></bongointernational_duty>
84
+ <bongointernational_tax><to_order>*</to_order></bongointernational_tax>
85
+ <bongointernational_insurance><to_order>*</to_order></bongointernational_insurance>
86
+ </sales_convert_quote_address>
87
+ </fieldsets>
88
+ <currency>
89
+ <import>
90
+ <services>
91
+ <bongo_currency_converter>
92
+ <name>Bongo Currency Conversion</name>
93
+ <model>Bongo_International_Model_Currency_Converter</model>
94
+ </bongo_currency_converter>
95
+ <webservicex>
96
+ <name>---Please Select Bongo---</name>
97
+ <model></model>
98
+ </webservicex>
99
+ </services>
100
+ </import>
101
+ </currency>
102
+ <sales>
103
+ <quote>
104
+ <totals>
105
+ <bongointernational_duty>
106
+ <class>bongointernational/total_duty_quote</class>
107
+ <after>shipping</after>
108
+ <before>grand_total</before>
109
+ </bongointernational_duty>
110
+ <bongointernational_tax>
111
+ <class>bongointernational/total_tax_quote</class>
112
+ <after>shipping</after>
113
+ <before>grand_total</before>
114
+ </bongointernational_tax>
115
+ <bongointernational_insurance>
116
+ <class>bongointernational/total_insurance_quote</class>
117
+ <after>shipping</after>
118
+ <before>grand_total</before>
119
+ </bongointernational_insurance>
120
+ </totals>
121
+ </quote>
122
+ <order_invoice>
123
+ <totals>
124
+ <bongointernational_duty>
125
+ <class>bongointernational/total_duty_invoice</class>
126
+ <after>shipping</after>
127
+ <before>grand_total</before>
128
+ </bongointernational_duty>
129
+ <bongointernational_tax>
130
+ <class>bongointernational/total_tax_invoice</class>
131
+ <after>shipping</after>
132
+ <before>grand_total</before>
133
+ </bongointernational_tax>
134
+ <bongointernational_insurance>
135
+ <class>bongointernational/total_insurance_invoice</class>
136
+ <after>shipping</after>
137
+ <before>grand_total</before>
138
+ </bongointernational_insurance>
139
+ </totals>
140
+ </order_invoice>
141
+ <order_creditmemo>
142
+ <totals>
143
+ <bongointernational_duty>
144
+ <class>bongointernational/total_duty_creditmemo</class>
145
+ <after>shipping</after>
146
+ <before>grand_total</before>
147
+ </bongointernational_duty>
148
+ <bongointernational_tax>
149
+ <class>bongointernational/total_tax_creditmemo</class>
150
+ <after>shipping</after>
151
+ <before>grand_total</before>
152
+ </bongointernational_tax>
153
+ <bongointernational_insurance>
154
+ <class>bongointernational/total_insurance_creditmemo</class>
155
+ <after>shipping</after>
156
+ <before>grand_total</before>
157
+ </bongointernational_insurance>
158
+ </totals>
159
+ </order_creditmemo>
160
+ </sales>
161
+ </global>
162
+ <crontab>
163
+ <jobs>
164
+ <bongointernational_sync_cron>
165
+ <schedule>
166
+ <cron_expr>0 0 * * *</cron_expr>
167
+ </schedule>
168
+ <run>
169
+ <model>bongointernational/products_sync::cron</model>
170
+ </run>
171
+ </bongointernational_sync_cron>
172
+ <bongointernational_currency_cron>
173
+ <schedule>
174
+ <cron_expr>45 23 * * *</cron_expr>
175
+ </schedule>
176
+ <run>
177
+ <model>bongointernational/currency_cache::cron</model>
178
+ </run>
179
+ </bongointernational_currency_cron>
180
+ <currency_rates_update>
181
+ <schedule>
182
+ <cron_expr>0 0 * * *</cron_expr>
183
+ </schedule>
184
+ <run>
185
+ <model>directory/observer::scheduledUpdateCurrencyRates</model>
186
+ </run>
187
+ </currency_rates_update>
188
+ </jobs>
189
+ </crontab>
190
+ <admin>
191
+ <routers>
192
+ <adminhtml>
193
+ <args>
194
+ <modules>
195
+ <bongointernational after="Mage_Adminhtml">Bongo_International_Adminhtml</bongointernational>
196
+ </modules>
197
+ </args>
198
+ </adminhtml>
199
+ </routers>
200
+ </admin>
201
+ <adminhtml>
202
+ <acl>
203
+ <resources>
204
+ <admin>
205
+ <children>
206
+ <system>
207
+ <children>
208
+ <config>
209
+ <children>
210
+ <bongointernational_config>
211
+ <title>Bongo International Configuration</title>
212
+ </bongointernational_config>
213
+ <bongointernational_products>
214
+ <title>Bongo International Product Management</title>
215
+ </bongointernational_products>
216
+ </children>
217
+ </config>
218
+ </children>
219
+ </system>
220
+ </children>
221
+ </admin>
222
+ </resources>
223
+ </acl>
224
+ <translate>
225
+ <modules>
226
+ <Bongo_International>
227
+ <files>
228
+ <default>Bongo_International.csv</default>
229
+ </files>
230
+ </Bongo_International>
231
+ </modules>
232
+ </translate>
233
+ <layout>
234
+ <updates>
235
+ <bongointernational>
236
+ <file>bongointernational.xml</file>
237
+ </bongointernational>
238
+ </updates>
239
+ </layout>
240
+ <events>
241
+ <sales_order_shipment_save_after>
242
+ <observers>
243
+ <bongointernational_shipment_observer>
244
+ <type>singleton</type>
245
+ <class>bongointernational/shipping_observer</class>
246
+ <method>sendDomesticTracking</method>
247
+ </bongointernational_shipment_observer>
248
+ </observers>
249
+ </sales_order_shipment_save_after>
250
+ <sales_order_save_after>
251
+ <observers>
252
+ <bongointernational_order_observer_cancel>
253
+ <type>singleton</type>
254
+ <class>bongointernational/order_observer</class>
255
+ <method>cancelBongoOrder</method>
256
+ </bongointernational_order_observer_cancel>
257
+ </observers>
258
+ </sales_order_save_after>
259
+ </events>
260
+ </adminhtml>
261
+ <frontend>
262
+ <translate>
263
+ <modules>
264
+ <Bongo_International>
265
+ <files>
266
+ <default>Bongo_International.csv</default>
267
+ </files>
268
+ </Bongo_International>
269
+ </modules>
270
+ </translate>
271
+ <layout>
272
+ <updates>
273
+ <bongointernational>
274
+ <file>bongointernational.xml</file>
275
+ </bongointernational>
276
+ </updates>
277
+ </layout>
278
+ <routers>
279
+ <bongointernational>
280
+ <use>standard</use>
281
+ <args>
282
+ <module>Bongo_International</module>
283
+ <frontName>bongointernational</frontName>
284
+ </args>
285
+ </bongointernational>
286
+ </routers>
287
+ </frontend>
288
+ <default>
289
+ <currency>
290
+ <import>
291
+ <enabled>1</enabled>
292
+ <service>bongo_currency_converter</service>
293
+ <frequency>D</frequency>
294
+ </import>
295
+ </currency>
296
+ <payment>
297
+ <bongointernational>
298
+ <active>1</active>
299
+ <model>bongointernational/payment_standard</model>
300
+ <order_status>pending</order_status>
301
+ <title>Bongo International Payment</title>
302
+ <allowspecific>0</allowspecific>
303
+ </bongointernational>
304
+ </payment>
305
+ <carriers>
306
+ <bongointernational>
307
+ <active>1</active>
308
+ <sallowspecific>0</sallowspecific>
309
+ <model>bongointernational/shipping_carrier_bongo</model>
310
+ <title>International Shipping</title>
311
+ <name>Economy</name>
312
+ <name_express>Express</name_express>
313
+ <showmethod>0</showmethod>
314
+ <sort_order>1</sort_order>
315
+ <specificerrmsg><![CDATA[This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.]]></specificerrmsg>
316
+ </bongointernational>
317
+ </carriers>
318
+ <bongointernational_config>
319
+ <config>
320
+ <active>0</active>
321
+ <integration_type>2</integration_type>
322
+ <country_manufacture>US</country_manufacture>
323
+ <shipping_type>bongointernational_free</shipping_type>
324
+ <continue_msg><![CDATA[Your order is currently being processed. It may take up to 10 minutes for you to receive your order confirmation email and for your order to show up in your account's order history.]]></continue_msg>
325
+ <domestic_shipping>0.00</domestic_shipping>
326
+ <landed_cost_usd>1</landed_cost_usd>
327
+ <shipping_methods>3</shipping_methods>
328
+ <order_confirmation_bongo>0</order_confirmation_bongo>
329
+ <order_confirmation_magento>0</order_confirmation_magento>
330
+ <new_account_magento>1</new_account_magento>
331
+ <include_insurance>0</include_insurance>
332
+ <duty_paid>0</duty_paid>
333
+ <allow_countries>AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BA,BW,BV,BR,IO,VG,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,AN,NC,NZ,NI,NE,NG,NU,NF,MP,KP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SK,SI,SB,SO,ZA,GS,KR,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,UY,UM,VI,UZ,VU,VA,VE,VN,WF,EH,YE,ZM,ZW</allow_countries>
334
+ </config>
335
+ <currency>
336
+ <currency_conversion>1</currency_conversion>
337
+ <country_selector>0</country_selector>
338
+ <ip_geolocation>1</ip_geolocation>
339
+ <welcome_lightbox>1</welcome_lightbox>
340
+ <welcome_lightbox_contents><![CDATA[You appear to be visiting from <b>{COUNTRY}</b>. If this is not your country, please select your country below:]]></welcome_lightbox_contents>
341
+ </currency>
342
+ <dc>
343
+ <address1></address1>
344
+ <address2></address2>
345
+ <city></city>
346
+ <state></state>
347
+ <zip></zip>
348
+ <country>US</country>
349
+ </dc>
350
+ </bongointernational_config>
351
+ <bongointernational_products>
352
+ <automated>
353
+ <frequency>1</frequency>
354
+ </automated>
355
+ </bongointernational_products>
356
+ </default>
357
+ </config>
app/code/community/Bongo/International/etc/system.xml ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <bongointernationalsetup translate="label" module="bongointernational">
5
+ <label>Bongo International</label>
6
+ <sort_order>210</sort_order>
7
+ </bongointernationalsetup>
8
+ </tabs>
9
+ <sections>
10
+ <bongointernational_config translate="label" module="bongointernational">
11
+ <label>Configuration</label>
12
+ <tab>bongointernationalsetup</tab>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <config translate="label">
19
+ <label>General Configuration</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <active translate="label">
27
+ <label>Enabled</label>
28
+ <frontend_type>select</frontend_type>
29
+ <source_model>adminhtml/system_config_source_yesno</source_model>
30
+ <sort_order>1</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <comment><![CDATA[
35
+ <script type="text/javascript">
36
+ var bongoToggleFields = function() {
37
+ if ($('bongointernational_config_config_integration_type').getValue() == "1") {
38
+ $('bongointernational_config_config_api_key').up(1).fade();
39
+ $('bongointernational_config_config_country_manufacture').up(1).fade();
40
+ $('bongointernational_config_config_shipping_type').up(1).fade();
41
+ $('bongointernational_config_config_domestic_shipping').up(1).fade();
42
+ //$('bongointernational_config_config_landed_cost_usd').up(1).fade();
43
+ $('bongointernational_config_config_shipping_methods').up(1).fade();
44
+ $('bongointernational_config_config_allow_countries').up(1).fade();
45
+ $('bongointernational_config_dc').up(0).fade();
46
+ } else {
47
+ $('bongointernational_config_config_api_key').up(1).appear();
48
+ $('bongointernational_config_config_country_manufacture').up(1).appear();
49
+ $('bongointernational_config_config_shipping_type').up(1).appear();
50
+
51
+ if ($('bongointernational_config_config_shipping_type').getValue() == "bongointernational_manual") {
52
+ $('bongointernational_config_config_domestic_shipping').up(1).appear();
53
+ } else {
54
+ $('bongointernational_config_config_domestic_shipping').up(1).fade();
55
+ }
56
+
57
+ //$('bongointernational_config_config_landed_cost_usd').up(1).appear();
58
+ $('bongointernational_config_config_shipping_methods').up(1).appear();
59
+ $('bongointernational_config_config_allow_countries').up(1).appear();
60
+ $('bongointernational_config_dc').up(0).appear();
61
+ }
62
+
63
+ if ($('bongointernational_config_config_integration_type').getValue() == "2") {
64
+ $('bongointernational_config_currency').up(0).appear();
65
+ } else {
66
+ $('bongointernational_config_currency').up(0).fade();
67
+ }
68
+ }
69
+
70
+ var bongoToggleDomestic = function() {
71
+ if ($('bongointernational_config_config_shipping_type').getValue() == "bongointernational_manual") {
72
+ $('bongointernational_config_config_domestic_shipping').up(1).appear();
73
+ } else {
74
+ $('bongointernational_config_config_domestic_shipping').up(1).fade();
75
+ }
76
+ }
77
+
78
+ Event.observe(window, 'load', function() {
79
+ Event.observe('bongointernational_config_config_integration_type', 'change', bongoToggleFields);
80
+ Event.observe('bongointernational_config_config_shipping_type', 'change', bongoToggleDomestic);
81
+ bongoToggleFields();
82
+ });
83
+ </script>
84
+ ]]></comment>
85
+ </active>
86
+ <integration_type translate="label">
87
+ <label>Integration Type</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>bongointernational/adminhtml_integrationType
90
+ </source_model>
91
+ <sort_order>2</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <comment><![CDATA[<!-- <b>Bongo Extend:</b> Simple shopping cart plug-in that enables international shoppers to obtain EU and US shipping addresses and make purchases from your eCommerce store immediately.<br /> --><b>Bongo Checkout:</b> Modular eCommerce solution promotes safe acceptance of international eCommerce orders with guaranteed fraud protection.<br /><b>Bongo Export:</b> Fully integrated eCommerce solution provides a seamless shopping experience for international customers while maintaining merchant brand integrity.]]></comment>
96
+ </integration_type>
97
+ <!-- <extend_code translate="label">
98
+ <depends>
99
+ <integration_type>1</integration_type>
100
+ </depends>
101
+ <label>Bongo Extend Code</label>
102
+ <frontend_type>textarea</frontend_type>
103
+ <sort_order>3</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ </extend_code> -->
108
+ <api_key translate="label">
109
+ <label>Bongo API Key</label>
110
+ <frontend_type>text</frontend_type>
111
+ <sort_order>4</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </api_key>
116
+ <checkout_url translate="label">
117
+ <depends>
118
+ <integration_type>2</integration_type>
119
+ </depends>
120
+ <label>Bongo International Checkout URL</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>5</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </checkout_url>
127
+ <callback_url translate="label">
128
+ <depends>
129
+ <integration_type>2</integration_type>
130
+ </depends>
131
+ <label>Magento Callback URL</label>
132
+ <frontend_type>text</frontend_type>
133
+ <frontend_model>bongointernational/adminhtml_callbackUrl</frontend_model>
134
+ <sort_order>6</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ <comment><![CDATA[Copy and paste the above Callback URL into your Bongo International Partner Portal under <i>Implementation-&#62;Step 3: Orders-&#62;Http Notification-&#62;Callback Url</i> and make sure to check the box next to <i>Activate service</i>, then click the <i>Save / Update</i> button.]]></comment>
139
+ </callback_url>
140
+ <continue_url translate="label">
141
+ <depends>
142
+ <integration_type>2</integration_type>
143
+ </depends>
144
+ <label>Magento Continue Shopping URL</label>
145
+ <frontend_type>text</frontend_type>
146
+ <frontend_model>bongointernational/adminhtml_continueUrl</frontend_model>
147
+ <sort_order>7</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <comment><![CDATA[Copy and paste the above Continue Shopping URL into your Bongo International Partner Portal under <i>Configure-&#62;Tracking/Confirmation-&#62;Continue Shopping / Go Back URL</i>, then click the <i>save</i> button.]]></comment>
152
+ </continue_url>
153
+ <continue_msg translate="label">
154
+ <depends>
155
+ <integration_type>2</integration_type>
156
+ </depends>
157
+ <label>Magento Continue Shopping Message</label>
158
+ <frontend_type>textarea</frontend_type>
159
+ <sort_order>8</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>1</show_in_website>
162
+ <show_in_store>1</show_in_store>
163
+ <comment><![CDATA[This is the message that will be displayed to the customer after they are redirected to your store from Bongo. By default, this message is to inform the customer of a delay of up to 10 minutes for them to receive their order confirmation email and to see the order in their order history.]]></comment>
164
+ </continue_msg>
165
+ <country_manufacture translate="label">
166
+ <label>Default Country of Manufacture</label>
167
+ <frontend_type>select</frontend_type>
168
+ <sort_order>9</sort_order>
169
+ <source_model>adminhtml/system_config_source_country
170
+ </source_model>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ <comment>
175
+ <model>bongointernational/adminhtml_defaultCountry</model>
176
+ </comment>
177
+ </country_manufacture>
178
+ <shipping_type translate="label">
179
+ <label>Domestic Shipping Calculation</label>
180
+ <frontend_type>select</frontend_type>
181
+ <source_model>bongointernational/adminhtml_shippingType
182
+ </source_model>
183
+ <sort_order>10</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ <comment><![CDATA[<b>Bongo - Free:</b> No domestic shipping cost will ever be added to any order.<br /><b>Bongo - Per Product:</b> A predefined domestic shipping cost will be added to each product in a customer's order.<br /><b>Shipping Carrier - Method:</b> The shipping carrier/method you select will be used to calculate a real-time domestic shipping cost from the address you setup in <i>Configuration-&#62;Sales-&#62;Shipping Settings-&#62;Origin</i> to the Bongo DC Address you setup below. Only shipping carriers/methods that are Enabled are shown.<br /><br />The Domestic Shipping Calculation will be combined with the Calculated Shipping Cost returned from Bongo and the resulting total will be displayed in shipping estimates to the customer.]]></comment>
188
+ </shipping_type>
189
+ <domestic_shipping translate="label">
190
+ <label>Default Product Domestic Shipping Cost</label>
191
+ <frontend_type>text</frontend_type>
192
+ <sort_order>11</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>1</show_in_store>
196
+ <comment><![CDATA[If you leave the Bongo Domestic Shipping Cost field blank on a product, this value will be combined with the Calculated Shipping Cost returned from Bongo and the resulting total will be displayed in shipping estimates.]]></comment>
197
+ </domestic_shipping>
198
+ <!-- landed_cost_usd translate="label">
199
+ <label>Landed Cost in USD</label>
200
+ <frontend_type>select</frontend_type>
201
+ <source_model>adminhtml/system_config_source_yesno</source_model>
202
+ <sort_order>12</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ <comment><![CDATA[If you Disable this, the Bongo Landed Cost function will determine the currency based on the customer's shipping country.]]></comment>
207
+ </landed_cost_usd -->
208
+ <transfer_type translate="label">
209
+ <depends>
210
+ <integration_type>2</integration_type>
211
+ </depends>
212
+ <label>Transfer Type</label>
213
+ <frontend_type>select</frontend_type>
214
+ <source_model>bongointernational/adminhtml_transferType
215
+ </source_model>
216
+ <sort_order>13</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>1</show_in_store>
220
+ <comment><![CDATA[<b>International Checkout Button:</b> A button will be displayed below the regular Checkout button in the customer's shopping cart that will take them to Bongo to enter their billing/shipping details and complete payment.<br /><b>Auto Redirect:</b> If you are using the default Magento one-page checkout, the customer will be automatically redirected to Bongo to complete payment after entering their billing/shipping details if the shipping country they choose is selected in the "Allowed Countries" list below.<br /><br />Please note that Bongo does not support checking out with Multiple Addresses at this time.]]></comment>
221
+ </transfer_type>
222
+ <shipping_methods translate="label">
223
+ <label>Available Bongo Shipping Methods</label>
224
+ <frontend_type>select</frontend_type>
225
+ <source_model>bongointernational/adminhtml_shippingMethods
226
+ </source_model>
227
+ <sort_order>14</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </shipping_methods>
232
+ <order_confirmation_bongo translate="label">
233
+ <depends>
234
+ <integration_type>3</integration_type>
235
+ </depends>
236
+ <label>Send customers order tracking email from Bongo?</label>
237
+ <frontend_type>select</frontend_type>
238
+ <source_model>adminhtml/system_config_source_yesno</source_model>
239
+ <sort_order>15</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>1</show_in_store>
243
+ </order_confirmation_bongo>
244
+ <order_confirmation_magento translate="label">
245
+ <depends>
246
+ <integration_type>4</integration_type>
247
+ </depends>
248
+ <label>Send customers order confirmation email from Magento?</label>
249
+ <frontend_type>select</frontend_type>
250
+ <source_model>adminhtml/system_config_source_yesno</source_model>
251
+ <sort_order>16</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </order_confirmation_magento>
256
+ <new_account_magento translate="label">
257
+ <depends>
258
+ <integration_type>2</integration_type>
259
+ </depends>
260
+ <label>Send customers new account welcome email from Magento?</label>
261
+ <frontend_type>select</frontend_type>
262
+ <source_model>adminhtml/system_config_source_yesno</source_model>
263
+ <sort_order>17</sort_order>
264
+ <show_in_default>1</show_in_default>
265
+ <show_in_website>1</show_in_website>
266
+ <show_in_store>1</show_in_store>
267
+ </new_account_magento>
268
+ <include_insurance translate="label">
269
+ <depends>
270
+ <integration_type>3</integration_type>
271
+ </depends>
272
+ <label>Include Shipping Insurance?</label>
273
+ <frontend_type>select</frontend_type>
274
+ <source_model>adminhtml/system_config_source_yesno</source_model>
275
+ <sort_order>18</sort_order>
276
+ <show_in_default>1</show_in_default>
277
+ <show_in_website>1</show_in_website>
278
+ <show_in_store>1</show_in_store>
279
+ </include_insurance>
280
+ <duty_paid translate="label">
281
+ <depends>
282
+ <integration_type>3</integration_type>
283
+ </depends>
284
+ <label>Delivery Duty Paid?</label>
285
+ <frontend_type>select</frontend_type>
286
+ <source_model>adminhtml/system_config_source_yesno</source_model>
287
+ <sort_order>19</sort_order>
288
+ <show_in_default>1</show_in_default>
289
+ <show_in_website>1</show_in_website>
290
+ <show_in_store>1</show_in_store>
291
+ </duty_paid>
292
+ <allow_countries translate="label">
293
+ <label>Allowed Countries</label>
294
+ <frontend_type>multiselect</frontend_type>
295
+ <sort_order>20</sort_order>
296
+ <source_model>adminhtml/system_config_source_country
297
+ </source_model>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
+ <show_in_store>1</show_in_store>
301
+ <can_be_empty>1</can_be_empty>
302
+ <comment><![CDATA[During the checkout process, the customer will be shown Bongo as a new shipping method if the shipping country they select is allowed above.]]></comment>
303
+ </allow_countries>
304
+ </fields>
305
+ </config>
306
+ <currency translate="label">
307
+ <label>Currency Conversion</label>
308
+ <frontend_type>text</frontend_type>
309
+ <sort_order>2</sort_order>
310
+ <show_in_default>1</show_in_default>
311
+ <show_in_website>1</show_in_website>
312
+ <show_in_store>1</show_in_store>
313
+ <fields>
314
+ <currency_conversion translate="label">
315
+ <label>Currency Conversion</label>
316
+ <frontend_type>select</frontend_type>
317
+ <source_model>adminhtml/system_config_source_yesno</source_model>
318
+ <sort_order>1</sort_order>
319
+ <show_in_default>1</show_in_default>
320
+ <show_in_website>1</show_in_website>
321
+ <show_in_store>1</show_in_store>
322
+ <comment><![CDATA[All totals will be displayed in a currency based on the customer's country as determined by Bongo.<br />A country selector drop-down will be <i>available</i> but <b>not automatically added to the theme</b>.<br />(See installation instructions for more information.)]]></comment>
323
+ </currency_conversion>
324
+ <country_selector translate="label">
325
+ <depends>
326
+ <currency_conversion>1</currency_conversion>
327
+ </depends>
328
+ <label>Country Selector</label>
329
+ <frontend_type>select</frontend_type>
330
+ <source_model>adminhtml/system_config_source_yesno</source_model>
331
+ <sort_order>2</sort_order>
332
+ <show_in_default>1</show_in_default>
333
+ <show_in_website>1</show_in_website>
334
+ <show_in_store>1</show_in_store>
335
+ <comment><![CDATA[A country selector drop-down will be automatically added after the standard language selector drop-down.<br /><b>Not all themes include the language selector drop-down by default.</b>]]></comment>
336
+ </country_selector>
337
+ <ip_geolocation translate="label">
338
+ <depends>
339
+ <currency_conversion>1</currency_conversion>
340
+ </depends>
341
+ <label>IP Geolocation</label>
342
+ <frontend_type>select</frontend_type>
343
+ <source_model>adminhtml/system_config_source_yesno</source_model>
344
+ <sort_order>3</sort_order>
345
+ <show_in_default>1</show_in_default>
346
+ <show_in_website>1</show_in_website>
347
+ <show_in_store>1</show_in_store>
348
+ <comment><![CDATA[Automatically detect the customer's country based on their geographic region as determined by their IP address. This function uses IP2Location LITE data available from <a href="http://www.ip2location.com" target="_blank">http://www.ip2location.com</a>.]]></comment>
349
+ </ip_geolocation>
350
+ <welcome_lightbox translate="label">
351
+ <depends>
352
+ <currency_conversion>1</currency_conversion>
353
+ <ip_geolocation>1</ip_geolocation>
354
+ </depends>
355
+ <label>Welcome Lightbox</label>
356
+ <frontend_type>select</frontend_type>
357
+ <source_model>adminhtml/system_config_source_yesno</source_model>
358
+ <sort_order>4</sort_order>
359
+ <show_in_default>1</show_in_default>
360
+ <show_in_website>1</show_in_website>
361
+ <show_in_store>1</show_in_store>
362
+ <comment><![CDATA[Display a Welcome Lightbox when a customer first visits from an international country allowing them to change the country from the auto-detected one as determined by the IP Geolocation function.]]></comment>
363
+ </welcome_lightbox>
364
+ <welcome_lightbox_contents translate="label">
365
+ <depends>
366
+ <currency_conversion>1</currency_conversion>
367
+ <ip_geolocation>1</ip_geolocation>
368
+ <welcome_lightbox>1</welcome_lightbox>
369
+ </depends>
370
+ <label>Welcome Lightbox Contents</label>
371
+ <frontend_type>textarea</frontend_type>
372
+ <sort_order>5</sort_order>
373
+ <show_in_default>1</show_in_default>
374
+ <show_in_website>1</show_in_website>
375
+ <show_in_store>1</show_in_store>
376
+ <comment><![CDATA[The text or HTML you enter here will be displayed above the Country Selector drop-down within the Welcome Lightbox. If using HTML, do not enter code for new lines because they will be automatically inserted.<br />Any occurrence of <b>{COUNTRY}</b> in these Contents will be replaced by the customer's auto-detected country as determined by the IP Geolocation function.]]></comment>
377
+ </welcome_lightbox_contents>
378
+ </fields>
379
+ </currency>
380
+ <dc translate="label">
381
+ <label>Bongo DC Address</label>
382
+ <frontend_type>text</frontend_type>
383
+ <sort_order>3</sort_order>
384
+ <show_in_default>1</show_in_default>
385
+ <show_in_website>1</show_in_website>
386
+ <show_in_store>1</show_in_store>
387
+ <fields>
388
+ <address1 translate="label">
389
+ <label>Address 1</label>
390
+ <frontend_type>text</frontend_type>
391
+ <sort_order>1</sort_order>
392
+ <show_in_default>1</show_in_default>
393
+ <show_in_website>1</show_in_website>
394
+ <show_in_store>1</show_in_store>
395
+ </address1>
396
+ <address2 translate="label">
397
+ <label>Address 2</label>
398
+ <frontend_type>text</frontend_type>
399
+ <sort_order>2</sort_order>
400
+ <show_in_default>1</show_in_default>
401
+ <show_in_website>1</show_in_website>
402
+ <show_in_store>1</show_in_store>
403
+ </address2>
404
+ <city translate="label">
405
+ <label>City</label>
406
+ <frontend_type>text</frontend_type>
407
+ <sort_order>3</sort_order>
408
+ <show_in_default>1</show_in_default>
409
+ <show_in_website>1</show_in_website>
410
+ <show_in_store>1</show_in_store>
411
+ </city>
412
+ <state translate="label">
413
+ <label>State</label>
414
+ <frontend_type>select</frontend_type>
415
+ <sort_order>4</sort_order>
416
+ <source_model>adminhtml/system_config_source_allregion
417
+ </source_model>
418
+ <show_in_default>1</show_in_default>
419
+ <show_in_website>1</show_in_website>
420
+ <show_in_store>1</show_in_store>
421
+ </state>
422
+ <zip translate="label">
423
+ <label>Zip Code</label>
424
+ <frontend_type>text</frontend_type>
425
+ <sort_order>5</sort_order>
426
+ <show_in_default>1</show_in_default>
427
+ <show_in_website>1</show_in_website>
428
+ <show_in_store>1</show_in_store>
429
+ </zip>
430
+ <country translate="label">
431
+ <label>Country</label>
432
+ <frontend_type>select</frontend_type>
433
+ <sort_order>6</sort_order>
434
+ <source_model>adminhtml/system_config_source_country
435
+ </source_model>
436
+ <show_in_default>1</show_in_default>
437
+ <show_in_website>1</show_in_website>
438
+ <show_in_store>1</show_in_store>
439
+ </country>
440
+ </fields>
441
+ </dc>
442
+ </groups>
443
+ </bongointernational_config>
444
+ <bongointernational_products translate="label"
445
+ module="bongointernational">
446
+ <label>Product Management</label>
447
+ <tab>bongointernationalsetup</tab>
448
+ <sort_order>2000</sort_order>
449
+ <show_in_default>1</show_in_default>
450
+ <show_in_website>1</show_in_website>
451
+ <show_in_store>1</show_in_store>
452
+ <groups>
453
+ <manual translate="label">
454
+ <label>Manual Product Export</label>
455
+ <sort_order>1</sort_order>
456
+ <show_in_default>1</show_in_default>
457
+ <show_in_website>1</show_in_website>
458
+ <show_in_store>1</show_in_store>
459
+ <fields>
460
+ <active translate="label">
461
+ <label>Export Product CSV File</label>
462
+ <frontend_type>button</frontend_type>
463
+ <frontend_model>bongointernational/adminhtml_exportButton
464
+ </frontend_model>
465
+ <sort_order>1</sort_order>
466
+ <show_in_default>1</show_in_default>
467
+ <show_in_website>1</show_in_website>
468
+ <show_in_store>1</show_in_store>
469
+ </active>
470
+ </fields>
471
+ </manual>
472
+ <automated translate="label">
473
+ <label>Automated Product Synchronization</label>
474
+ <sort_order>2</sort_order>
475
+ <show_in_default>1</show_in_default>
476
+ <show_in_website>1</show_in_website>
477
+ <show_in_store>1</show_in_store>
478
+ <fields>
479
+ <frequency translate="label">
480
+ <label>Synchronization Frequency</label>
481
+ <frontend_type>select</frontend_type>
482
+ <source_model>bongointernational/adminhtml_syncFrequency
483
+ </source_model>
484
+ <sort_order>1</sort_order>
485
+ <show_in_default>1</show_in_default>
486
+ <show_in_website>1</show_in_website>
487
+ <show_in_store>1</show_in_store>
488
+ </frequency>
489
+ <active translate="label">
490
+ <label>One-Time Automated Synchronization</label>
491
+ <frontend_type>button</frontend_type>
492
+ <frontend_model>bongointernational/adminhtml_syncButton
493
+ </frontend_model>
494
+ <sort_order>2</sort_order>
495
+ <show_in_default>1</show_in_default>
496
+ <show_in_website>1</show_in_website>
497
+ <show_in_store>1</show_in_store>
498
+ </active>
499
+ </fields>
500
+ </automated>
501
+ </groups>
502
+ </bongointernational_products>
503
+ <payment>
504
+ <groups>
505
+ <bongointernational translate="label" module="bongointernational">
506
+ <label>Bongo International Payment</label>
507
+ <sort_order>1000</sort_order>
508
+ <show_in_default>1</show_in_default>
509
+ <show_in_website>1</show_in_website>
510
+ <show_in_store>1</show_in_store>
511
+ <fields>
512
+ <title translate="label">
513
+ <label>Title</label>
514
+ <frontend_type>text</frontend_type>
515
+ <sort_order>1</sort_order>
516
+ <show_in_default>1</show_in_default>
517
+ <show_in_website>1</show_in_website>
518
+ <show_in_store>1</show_in_store>
519
+ </title>
520
+ </fields>
521
+ </bongointernational>
522
+ </groups>
523
+ </payment>
524
+ <carriers>
525
+ <groups>
526
+ <bongointernational translate="label" module="bongointernational">
527
+ <label>Bongo International Shipping</label>
528
+ <frontend_type>text</frontend_type>
529
+ <sort_order>1000</sort_order>
530
+ <show_in_default>1</show_in_default>
531
+ <show_in_website>1</show_in_website>
532
+ <show_in_store>1</show_in_store>
533
+ <fields>
534
+ <title translate="label">
535
+ <label>Title</label>
536
+ <frontend_type>text</frontend_type>
537
+ <sort_order>1</sort_order>
538
+ <show_in_default>1</show_in_default>
539
+ <show_in_website>1</show_in_website>
540
+ <show_in_store>1</show_in_store>
541
+ </title>
542
+ <name translate="label">
543
+ <label>Economy Method Name</label>
544
+ <frontend_type>text</frontend_type>
545
+ <sort_order>2</sort_order>
546
+ <show_in_default>1</show_in_default>
547
+ <show_in_website>1</show_in_website>
548
+ <show_in_store>1</show_in_store>
549
+ </name>
550
+ <name_express translate="label">
551
+ <label>Express Method Name</label>
552
+ <frontend_type>text</frontend_type>
553
+ <sort_order>3</sort_order>
554
+ <show_in_default>1</show_in_default>
555
+ <show_in_website>1</show_in_website>
556
+ <show_in_store>1</show_in_store>
557
+ </name_express>
558
+ <sort_order translate="label">
559
+ <label>Sort Order</label>
560
+ <frontend_type>text</frontend_type>
561
+ <sort_order>4</sort_order>
562
+ <show_in_default>1</show_in_default>
563
+ <show_in_website>1</show_in_website>
564
+ <show_in_store>1</show_in_store>
565
+ </sort_order>
566
+ <showmethod translate="label">
567
+ <label>Show Method if Not Applicable</label>
568
+ <frontend_type>select</frontend_type>
569
+ <sort_order>5</sort_order>
570
+ <source_model>adminhtml/system_config_source_yesno</source_model>
571
+ <show_in_default>1</show_in_default>
572
+ <show_in_website>1</show_in_website>
573
+ <show_in_store>1</show_in_store>
574
+ </showmethod>
575
+ <specificerrmsg translate="label">
576
+ <label>Displayed Error Message</label>
577
+ <frontend_type>textarea</frontend_type>
578
+ <sort_order>6</sort_order>
579
+ <show_in_default>1</show_in_default>
580
+ <show_in_website>1</show_in_website>
581
+ <show_in_store>1</show_in_store>
582
+ </specificerrmsg>
583
+ </fields>
584
+ </bongointernational>
585
+ </groups>
586
+ </carriers>
587
+ </sections>
588
+ </config>
app/code/community/Bongo/International/lib/IP2Location.php ADDED
@@ -0,0 +1,776 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2005-2014 IP2Location.com
4
+ * All Rights Reserved
5
+ *
6
+ * This library is free software: you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation, either
9
+ * version 3 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+
20
+ class IP2LocationRecord {
21
+ public $ipAddress;
22
+ public $ipNumber;
23
+ public $countryCode;
24
+ public $countryName;
25
+ public $regionName;
26
+ public $cityName;
27
+ public $latitude;
28
+ public $longitude;
29
+ public $isp;
30
+ public $domainName;
31
+ public $zipCode;
32
+ public $timeZone;
33
+ public $netSpeed;
34
+ public $iddCode;
35
+ public $areaCode;
36
+ public $weatherStationCode;
37
+ public $weatherStationName;
38
+ public $mcc;
39
+ public $mnc;
40
+ public $mobileCarrierName;
41
+ public $elevation;
42
+ public $usageType;
43
+ }
44
+
45
+ class IP2Location {
46
+ // Current version.
47
+ const VERSION = '7.0.0';
48
+
49
+ // Database storage method.
50
+ const FILE_IO = 0;
51
+ const MEMORY_CACHE = 1;
52
+ const SHARED_MEMORY = 2;
53
+
54
+ // Unpack method.
55
+ const ENDIAN = 0;
56
+ const BIG_ENDIAN = 1;
57
+
58
+ // Record field.
59
+ const ALL = 100;
60
+ const COUNTRY_CODE = 1;
61
+ const COUNTRY_NAME = 2;
62
+ const REGION_NAME = 3;
63
+ const CITY_NAME = 4;
64
+ const LATITUDE = 5;
65
+ const LONGITUDE = 6;
66
+ const ISP = 7;
67
+ const DOMAIN_NAME = 8;
68
+ const ZIP_CODE = 9;
69
+ const TIME_ZONE = 10;
70
+ const NET_SPEED = 11;
71
+ const IDD_CODE = 12;
72
+ const AREA_CODE = 13;
73
+ const WEATHER_STATION_CODE = 14;
74
+ const WEATHER_STATION_NAME = 15;
75
+ const MCC = 16;
76
+ const MNC = 17;
77
+ const MOBILE_CARRIER_NAME = 18;
78
+ const ELEVATION = 19;
79
+ const USAGE_TYPE = 20;
80
+
81
+ // IP version.
82
+ const IPV4 = 0;
83
+ const IPV6 = 1;
84
+
85
+ // SHMOP memory address.
86
+ const SHM_KEY = 4194500608;
87
+
88
+ // Message.
89
+ const FIELD_NOT_SUPPORTED = 'This parameter is unavailable in selected .BIN data file. Please upgrade data file.';
90
+ const INVALID_IP_ADDRESS = 'Invalid IP address.';
91
+
92
+ private $columns = array(
93
+ 'COUNTRY_CODE' => array(
94
+ 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
95
+ ),
96
+ 'COUNTRY_NAME' => array(
97
+ 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
98
+ ),
99
+ 'REGION_NAME' => array(
100
+ 0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
101
+ ),
102
+ 'CITY_NAME' => array(
103
+ 0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
104
+ ),
105
+ 'LATITUDE' => array(
106
+ 0,0,0,0,0,5,5,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
107
+ ),
108
+ 'LONGITUDE' => array(
109
+ 0,0,0,0,0,6,6,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
110
+ ),
111
+ 'ISP' => array(
112
+ 0,0,3,0,5,0,7,5,7,0,8,0,9,0,9,0,9,0,9,7,9,0,9,7,9,
113
+ ),
114
+ 'DOMAIN_NAME' => array(
115
+ 0,0,0,0,0,0,0,6,8,0,9,0,10,0,10,0,10,0,10,8,10,0,10,8,10,
116
+ ),
117
+ 'ZIP_CODE' => array(
118
+ 0,0,0,0,0,0,0,0,0,7,7,7,7,0,7,7,7,0,7,0,7,7,7,0,7,
119
+ ),
120
+ 'TIME_ZONE' => array(
121
+ 0,0,0,0,0,0,0,0,0,0,0,8,8,7,8,8,8,7,8,0,8,8,8,0,8,
122
+ ),
123
+ 'NET_SPEED' => array(
124
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,8,11,0,11,8,11,0,11,0,11,0,11,
125
+ ),
126
+ 'IDD_CODE' => array(
127
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,12,0,12,0,12,9,12,0,12,
128
+ ),
129
+ 'AREA_CODE' => array(
130
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,13,0,13,0,13,10,13,0,13,
131
+ ),
132
+ 'WEATHER_STATION_CODE' => array(
133
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,14,0,14,0,14,0,14,
134
+ ),
135
+ 'WEATHER_STATION_NAME' => array(
136
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,15,0,15,0,15,0,15,
137
+ ),
138
+ 'MCC' => array(
139
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,16,0,16,9,16,
140
+ ),
141
+ 'MNC' => array(
142
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,17,0,17,10,17,
143
+ ),
144
+ 'MOBILE_CARRIER_NAME' => array(
145
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,18,0,18,11,18,
146
+ ),
147
+ 'ELEVATION' => array(
148
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,19,0,19,
149
+ ),
150
+ 'USAGE_TYPE' => array(
151
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,20,
152
+ ),
153
+ );
154
+
155
+ private $shmId = '';
156
+ private $database = array();
157
+ private $unpackMethod;
158
+ private $buffer;
159
+ private $mode;
160
+ private $resource;
161
+ private $result;
162
+
163
+ /**
164
+ * Constructor.
165
+ */
166
+ public function __construct($file = NULL, $mode = self::FILE_IO) {
167
+ if (!file_exists($file)) {
168
+ throw new Exception('IP2Location.class.php: Unable to open file "' . $file . '".');
169
+ }
170
+
171
+ // Define system unpack method.
172
+ list($test) = array_values(unpack('L1L', pack('V', 1)));
173
+
174
+ // Use Big Endian Unpack if endian test failed.
175
+ $this->unpackMethod = (($test != 1)) ? self::BIG_ENDIAN : self::ENDIAN;
176
+
177
+ switch ($mode) {
178
+ case self::SHARED_MEMORY:
179
+ if (!function_exists('shmop_open')) {
180
+ throw new Exception('IP2Location.class.php: Please make sure your PHP setup has "php_shmop" enabled.');
181
+ }
182
+
183
+ $this->mode = self::SHARED_MEMORY;
184
+
185
+ $this->shmId = @shmop_open(self::SHM_KEY, 'a', 0, 0);
186
+
187
+ if ($this->shmId === FALSE) {
188
+ // First execution, load database into memory.
189
+ if (($fp = fopen($file, 'rb')) === FALSE) {
190
+ throw new Exception('IP2Location.class.php: Unable to open file "' . $file . '".');
191
+ }
192
+
193
+ $stats = fstat($fp);
194
+
195
+ if ($shm_id = @shmop_open(self::SHM_KEY, 'w', 0, 0)) {
196
+ shmop_delete($shm_id);
197
+ shmop_close($shm_id);
198
+ }
199
+
200
+ if ($shm_id = @shmop_open(self::SHM_KEY, 'c', 0644, $stats['size'])) {
201
+ $pointer = 0;
202
+ while ($pointer < $stats['size']) {
203
+ $buf = fread($fp, 524288);
204
+ shmop_write($shm_id, $buf, $pointer);
205
+ $pointer += 524288;
206
+ }
207
+ shmop_close($shm_id);
208
+ }
209
+ fclose($fp);
210
+
211
+ $this->shmId = @shmop_open(self::SHM_KEY, 'a', 0, 0);
212
+
213
+ if ($this->shmId === FALSE) {
214
+ throw new Exception('IP2Location.class.php: Unable to access shared memory block.');
215
+ }
216
+ }
217
+ break;
218
+
219
+ default:
220
+ $this->mode = self::FILE_IO;
221
+ $this->resource = fopen($file, 'rb');
222
+
223
+ if ($mode == self::MEMORY_CACHE) {
224
+ $this->mode = self::MEMORY_CACHE;
225
+ $stats = fstat($this->resource);
226
+ $this->buffer = fread($this->resource, $stats['size']);
227
+ }
228
+ }
229
+
230
+ $this->database['type'] = $this->readByte(1, '8');
231
+ $this->database['column'] = $this->readByte(2, '8');
232
+ $this->database['year'] = $this->readByte(3, '8');
233
+ $this->database['month'] = $this->readByte(4, '8');
234
+ $this->database['day'] = $this->readByte(5, '8');
235
+ $this->database['ipv4_count'] = $this->readByte(6, '32');
236
+ $this->database['ipv4_base_address'] = $this->readByte(10, '32');
237
+ $this->database['ipv6_count'] = $this->readByte(14, '32');
238
+ $this->database['ipv6_base_address'] = $this->readByte(18, '32');
239
+
240
+ $this->result = new IP2LocationRecord();
241
+ }
242
+
243
+ /**
244
+ * Read bytes.
245
+ */
246
+ private function readByte($pos, $mode = 'string', $auto_size = FALSE) {
247
+ $result = '';
248
+
249
+ switch ($this->mode) {
250
+ case self::SHARED_MEMORY:
251
+ if ($mode == 'string') {
252
+ $data = shmop_read($this->shmId, $pos, ($auto_size) ? shmop_size($this->shmId) - $pos : 100);
253
+ }
254
+ else {
255
+ $data = shmop_read($this->shmId, $pos - 1, 50);
256
+ }
257
+ break;
258
+
259
+ case self::MEMORY_CACHE:
260
+ $data = substr($this->buffer, (($mode == 'string') ? $pos : $pos - 1), 100);
261
+ break;
262
+
263
+ default:
264
+ if ($mode == 'string') {
265
+ fseek($this->resource, $pos, SEEK_SET);
266
+ $data = @fread($this->resource, 1);
267
+ }
268
+ else {
269
+ fseek($this->resource, $pos - 1, SEEK_SET);
270
+ $data = @fread($this->resource, 50);
271
+ }
272
+ }
273
+
274
+ switch ($mode) {
275
+ case '8':
276
+ $out = $this->readBinary('C', $data);
277
+ $result = $out[1];
278
+
279
+ break;
280
+
281
+ case '32':
282
+ $out = $this->readBinary('V', $data);
283
+ if ($out[1] < 0) {
284
+ $out[1] += 4294967296;
285
+ }
286
+
287
+ $result = (int) $out[1];
288
+
289
+ break;
290
+
291
+ case '128':
292
+ $array = preg_split('//', $data, -1, PREG_SPLIT_NO_EMPTY);
293
+
294
+ if (count($array) != 16) {
295
+ $result = 0;
296
+ }
297
+
298
+ $ip96_127 = $this->readBinary('V', $array[0] . $array[1] . $array[2] . $array[3]);
299
+ $ip64_95 = $this->readBinary('V', $array[4] . $array[5] . $array[6] . $array[7]);
300
+ $ip32_63 = $this->readBinary('V', $array[8] . $array[9] . $array[10] . $array[11]);
301
+ $ip1_31 = $this->readBinary('V', $array[12] . $array[13] . $array[14] . $array[15]);
302
+
303
+ if ($ip96_127[1] < 0) {
304
+ $ip96_127[1] += 4294967296;
305
+ }
306
+ if ($ip64_95[1] < 0) {
307
+ $ip64_95[1] += 4294967296;
308
+ }
309
+ if ($ip32_63[1] < 0) {
310
+ $ip32_63[1] += 4294967296;
311
+ }
312
+ if ($ip1_31[1] < 0) {
313
+ $ip1_31[1] += 4294967296;
314
+ }
315
+
316
+ $result = bcadd(bcadd(bcmul($ip1_31[1], bcpow(4294967296, 3)), bcmul($ip32_63[1], bcpow(4294967296, 2))), bcadd(bcmul($ip64_95[1], 4294967296), $ip96_127[1]));
317
+
318
+ break;
319
+
320
+ case 'float':
321
+ $out = $this->readBinary('f', $data);
322
+
323
+ $result = $out[1];
324
+
325
+ break;
326
+
327
+ default:
328
+ $out = $this->readBinary('C', $data);
329
+ $result = (in_array($this->mode, array(self::SHARED_MEMORY, self::MEMORY_CACHE))) ? substr($data, 1, $out[1]) : @fread($this->resource, $out[1]);
330
+ }
331
+
332
+ return $result;
333
+ }
334
+
335
+ /**
336
+ * Read binary.
337
+ */
338
+ private function readBinary($format, $data) {
339
+ if ($this->unpackMethod == self::BIG_ENDIAN) {
340
+ $ar = unpack($format, $data);
341
+ $vals = array_values($ar);
342
+ $f = explode('/', $format);
343
+ $i = 0;
344
+
345
+ foreach ($f as $f_value) {
346
+ $repeater = intval(substr($f_value, 1));
347
+
348
+ if ($repeater == 0) {
349
+ $repeater = 1;
350
+ }
351
+ if ($f_value{1} == '*') {
352
+ $repeater = count($ar) - $i;
353
+ }
354
+ if ($f_value{0} != 'd') {
355
+ $i += $repeater;
356
+ continue;
357
+ }
358
+
359
+ $j = $i + $repeater;
360
+
361
+ for ($a = $i; $a < $j; ++$a) {
362
+ $p = pack('d', $vals[$i]);
363
+ $p = strrev($p);
364
+ list($vals[$i]) = array_values(unpack('d1d', $p));
365
+ ++$i;
366
+ }
367
+ }
368
+
369
+ $a = 0;
370
+ foreach ($ar as $ar_key => $ar_value) {
371
+ $ar[$ar_key] = $vals[$a];
372
+ ++$a;
373
+ }
374
+ return $ar;
375
+ }
376
+ return unpack($format, $data);
377
+ }
378
+
379
+ /**
380
+ * Convert IPv6 into long integer.
381
+ */
382
+ private function ipv6Numeric($ipv6) {
383
+ $ip_n = inet_pton($ipv6);
384
+ $bits = 15;
385
+
386
+ // 16 x 8 bit = 128bit
387
+ $ipv6long = 0;
388
+
389
+ while ($bits >= 0) {
390
+ $bin = sprintf("%08b", (ord($ip_n[$bits])));
391
+
392
+ if ($ipv6long) {
393
+ $ipv6long = $bin . $ipv6long;
394
+ }
395
+ else {
396
+ $ipv6long = $bin;
397
+ }
398
+ $bits--;
399
+ }
400
+ return gmp_strval(gmp_init($ipv6long, 2), 10);
401
+ }
402
+
403
+ /**
404
+ * Validate IP address.
405
+ */
406
+ private function validate($ip) {
407
+ if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
408
+ return 4;
409
+ }
410
+
411
+ if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
412
+ return 6;
413
+ }
414
+
415
+ return FALSE;
416
+ }
417
+
418
+ /**
419
+ * Core function to lookup geolocation data.
420
+ */
421
+ public function lookup($ip, $fields = self::ALL) {
422
+ $this->result->ipAddress = $ip;
423
+
424
+ if (($version = $this->validate($ip)) === FALSE) {
425
+ foreach ($this->result as &$obj) {
426
+ if ($obj) {
427
+ continue;
428
+ }
429
+
430
+ $obj = self::INVALID_IP_ADDRESS;
431
+ }
432
+
433
+ return $this->result;
434
+ }
435
+
436
+ if ($version == 4) {
437
+ return $this->ipv4Lookup($ip, $fields);
438
+ }
439
+
440
+ if ($version == 6) {
441
+ return $this->ipv6Lookup($ip, $fields);
442
+ }
443
+ }
444
+
445
+ /**
446
+ * Lookup for IPv4 records.
447
+ */
448
+ private function ipv4Lookup($ip, $fields) {
449
+ $keys = array_keys($this->columns);
450
+
451
+ $base_address = $this->database['ipv4_base_address'];
452
+ $high = $this->database['ipv4_count'];
453
+ $ip_number = sprintf('%u', ip2long($ip));
454
+ $ip_number = ($ip_number >= 4294967295) ? ($ip_number - 1) : $ip_number;
455
+ $this->result->ipNumber = $ip_number;
456
+
457
+ $low = 0;
458
+ $mid = 0;
459
+ $ip_from = 0;
460
+ $ip_to = 0;
461
+
462
+ while ($low <= $high) {
463
+ $mid = (int) (($low + $high) / 2);
464
+ $ip_from = $this->readByte($base_address + $mid * ($this->database['column'] * 4), 32);
465
+ $ip_to = $this->readByte($base_address + ($mid + 1) * ($this->database['column'] * 4), 32);
466
+
467
+ if ($ip_from < 0) {
468
+ $ip_from += pow(2, 32);
469
+ }
470
+
471
+ if ($ip_to < 0) {
472
+ $ip_to += pow(2, 32);
473
+ }
474
+
475
+ if (($ip_number >= $ip_from) && ($ip_number < $ip_to)) {
476
+ $return = '';
477
+ $pointer = $base_address + ($mid * $this->database['column'] * 4);
478
+
479
+ switch ($fields) {
480
+ case self::COUNTRY_CODE:
481
+ case self::REGION_NAME:
482
+ case self::CITY_NAME:
483
+ case self::ISP:
484
+ case self::DOMAIN_NAME:
485
+ case self::ZIP_CODE:
486
+ case self::TIME_ZONE:
487
+ case self::NET_SPEED:
488
+ case self::IDD_CODE:
489
+ case self::AREA_CODE:
490
+ case self::WEATHER_STATION_CODE:
491
+ case self::WEATHER_STATION_NAME:
492
+ case self::MCC:
493
+ case self::MNC:
494
+ case self::MOBILE_CARRIER_NAME:
495
+ case self::ELEVATION:
496
+ $return = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
497
+
498
+ break;
499
+
500
+ case self::COUNTRY_NAME:
501
+ $return = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']] - 1), '32') + 3, 'string', TRUE);
502
+
503
+ break;
504
+
505
+ case self::LATITUDE:
506
+ case self::LONGITUDE:
507
+ $return = $this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']] - 1), 'float', TRUE);
508
+
509
+ break;
510
+
511
+ case self::USAGE_TYPE:
512
+ $return = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
513
+
514
+ break;
515
+
516
+ default:
517
+ $this->result->regionName = $this->result->cityName = $this->result->latitude = $this->result->longitude = $this->result->isp = $this->result->domainName = $this->result->zipCode = $this->result->timeZone = $this->result->netSpeed = $this->result->iddCode = $this->result->areaCode = $this->result->weatherStationCode = $this->result->weatherStationName = $this->result->mcc = $this->result->mnc = $this->result->mobileCarrierName = $this->result->elevation = $this->result->usageType = self::FIELD_NOT_SUPPORTED;
518
+
519
+ $this->result->countryCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::COUNTRY_CODE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
520
+
521
+ $this->result->countryName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::COUNTRY_NAME - 1]][$this->database['type']] - 1), '32') + 3, 'string', TRUE);
522
+
523
+ if ($this->columns[$keys[self::REGION_NAME - 1]][$this->database['type']] != 0) {
524
+ $this->result->regionName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::REGION_NAME - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
525
+ }
526
+
527
+ if ($this->columns[$keys[self::CITY_NAME - 1]][$this->database['type']] != 0) {
528
+ $this->result->cityName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::CITY_NAME - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
529
+ }
530
+
531
+ if ($this->columns[$keys[self::LATITUDE - 1]][$this->database['type']] != 0) {
532
+ $this->result->latitude = $this->readByte($pointer + 4 * ($this->columns[$keys[self::LATITUDE - 1]][$this->database['type']] - 1), 'float', TRUE);
533
+ }
534
+
535
+ if ($this->columns[$keys[self::LONGITUDE - 1]][$this->database['type']] != 0) {
536
+ $this->result->longitude = $this->readByte($pointer + 4 * ($this->columns[$keys[self::LONGITUDE - 1]][$this->database['type']] - 1), 'float', TRUE);
537
+ }
538
+
539
+ if ($this->columns[$keys[self::ISP - 1]][$this->database['type']] != 0) {
540
+ $this->result->isp = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::ISP - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
541
+ }
542
+
543
+ if ($this->columns[$keys[self::DOMAIN_NAME - 1]][$this->database['type']] != 0) {
544
+ $this->result->domainName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::DOMAIN_NAME - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
545
+ }
546
+
547
+ if ($this->columns[$keys[self::ZIP_CODE - 1]][$this->database['type']] != 0) {
548
+ $this->result->zipCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::ZIP_CODE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
549
+ }
550
+
551
+ if ($this->columns[$keys[self::TIME_ZONE - 1]][$this->database['type']] != 0) {
552
+ $this->result->timeZone = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::TIME_ZONE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
553
+ }
554
+
555
+ if ($this->columns[$keys[self::NET_SPEED - 1]][$this->database['type']] != 0) {
556
+ $this->result->netSpeed = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::NET_SPEED - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
557
+ }
558
+
559
+ if ($this->columns[$keys[self::IDD_CODE - 1]][$this->database['type']] != 0) {
560
+ $this->result->iddCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::IDD_CODE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
561
+ }
562
+
563
+ if ($this->columns[$keys[self::AREA_CODE - 1]][$this->database['type']] != 0) {
564
+ $this->result->areaCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::AREA_CODE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
565
+ }
566
+
567
+ if ($this->columns[$keys[self::WEATHER_STATION_CODE - 1]][$this->database['type']] != 0) {
568
+ $this->result->weatherStationCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::WEATHER_STATION_CODE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
569
+ }
570
+
571
+ if ($this->columns[$keys[self::WEATHER_STATION_NAME - 1]][$this->database['type']] != 0) {
572
+ $this->result->weatherStationName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::WEATHER_STATION_NAME - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
573
+ }
574
+
575
+ if ($this->columns[$keys[self::MCC - 1]][$this->database['type']] != 0) {
576
+ $this->result->mcc = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::MCC - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
577
+ }
578
+
579
+ if ($this->columns[$keys[self::MNC - 1]][$this->database['type']] != 0) {
580
+ $this->result->mnc = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::MNC - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
581
+ }
582
+
583
+ if ($this->columns[$keys[self::MOBILE_CARRIER_NAME - 1]][$this->database['type']] != 0) {
584
+ $this->result->mobileCarrierName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::MOBILE_CARRIER_NAME - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
585
+ }
586
+
587
+ if ($this->columns[$keys[self::ELEVATION - 1]][$this->database['type']] != 0) {
588
+ $this->result->elevation = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::ELEVATION - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
589
+ }
590
+
591
+ if ($this->columns[$keys[self::USAGE_TYPE - 1]][$this->database['type']] != 0) {
592
+ $this->result->usageType = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::USAGE_TYPE - 1]][$this->database['type']] - 1), '32'), 'string', TRUE);
593
+ }
594
+
595
+ return $this->result;
596
+ }
597
+ return $return;
598
+ }
599
+ else {
600
+ if ($ip_number < $ip_from) {
601
+ $high = $mid - 1;
602
+ }
603
+ else {
604
+ $low = $mid + 1;
605
+ }
606
+ }
607
+ }
608
+ }
609
+
610
+ /**
611
+ * Lookup for IPv6 records.
612
+ */
613
+ private function ipv6Lookup($ip, $fields) {
614
+ $keys = array_keys($this->columns);
615
+
616
+ $base_address = $this->database['ipv6_base_address'];
617
+ $ip_number = $this->ipv6Numeric($ip);
618
+ $this->result->ipNumber = $ip_number;
619
+
620
+ $low = 0;
621
+ $mid = 0;
622
+ $high = $this->database['ipv6_count'];
623
+ $ip_from = 0;
624
+ $ip_to = 0;
625
+
626
+ while ($low <= $high) {
627
+ $mid = (int) (($low + $high) / 2);
628
+ $ip_from = $this->readByte($base_address + $mid * ($this->database['column'] * 4 + 12), 128);
629
+ $ip_to = $this->readByte($base_address + ($mid + 1) * ($this->database['column'] * 4 + 12), 128);
630
+
631
+ if ($ip_from < 0) {
632
+ $ip_from += pow(2, 32);
633
+ }
634
+
635
+ if ($ip_to < 0) {
636
+ $ip_to += pow(2, 32);
637
+ }
638
+
639
+ if (($ip_number >= $ip_from) && ($ip_number < $ip_to)) {
640
+ $return = '';
641
+ $pointer = $base_address + ($mid * ($this->database['column'] * 4 + 12)) + 8;
642
+
643
+ switch ($fields) {
644
+ case self::COUNTRY_CODE:
645
+ case self::REGION_NAME:
646
+ case self::CITY_NAME:
647
+ case self::ISP:
648
+ case self::DOMAIN_NAME:
649
+ case self::ZIP_CODE:
650
+ case self::TIME_ZONE:
651
+ case self::NET_SPEED:
652
+ case self::IDD_CODE:
653
+ case self::AREA_CODE:
654
+ case self::WEATHER_STATION_CODE:
655
+ case self::WEATHER_STATION_NAME:
656
+ case self::MCC:
657
+ case self::MNC:
658
+ case self::MOBILE_CARRIER_NAME:
659
+ case self::ELEVATION:
660
+ $return = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']]), '32'), 'string', TRUE);
661
+
662
+ break;
663
+
664
+ case self::COUNTRY_NAME:
665
+ $return = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']]), '32') + 3, 'string', TRUE);
666
+
667
+ break;
668
+
669
+ case self::LATITUDE:
670
+ case self::LONGITUDE:
671
+ $return = $this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']]), 'float', TRUE);
672
+
673
+ break;
674
+
675
+ case self::USAGE_TYPE:
676
+ $return = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[$fields - 1]][$this->database['type']]), '32'), 'string', TRUE);
677
+
678
+ break;
679
+
680
+ default:
681
+ $this->result->regionName = $this->result->cityName = $this->result->latitude = $this->result->longitude = $this->result->isp = $this->result->domainName = $this->result->zipCode = $this->result->timeZone = $this->result->netSpeed = $this->result->iddCode = $this->result->areaCode = $this->result->weatherStationCode = $this->result->weatherStationName = $this->result->mcc = $this->result->mnc = $this->result->mobileCarrierName = $this->result->elevation = $this->result->usageType = self::FIELD_NOT_SUPPORTED;
682
+
683
+ if ($this->columns[$keys[self::COUNTRY_CODE - 1]][$this->database['type']] != 0) {
684
+ $this->result->countryCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::COUNTRY_CODE - 1]][$this->database['type']]), '32'), 'string', TRUE);
685
+
686
+ $this->result->countryName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::COUNTRY_CODE - 1]][$this->database['type']]), '32') + 3, 'string', TRUE);
687
+ }
688
+
689
+ if ($this->columns[$keys[self::REGION_NAME - 1]][$this->database['type']] != 0) {
690
+ $this->result->regionName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::REGION_NAME - 1]][$this->database['type']]), '32'), 'string', TRUE);
691
+ }
692
+
693
+ if ($this->columns[$keys[self::CITY_NAME - 1]][$this->database['type']] != 0) {
694
+ $this->result->cityName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::CITY_NAME - 1]][$this->database['type']]), '32'), 'string', TRUE);
695
+ }
696
+
697
+ if ($this->columns[$keys[self::LATITUDE - 1]][$this->database['type']] != 0) {
698
+ $this->result->latitude = $this->readByte($pointer + 4 * ($this->columns[$keys[self::LATITUDE - 1]][$this->database['type']]), 'float', TRUE);
699
+ }
700
+
701
+ if ($this->columns[$keys[self::LONGITUDE - 1]][$this->database['type']] != 0) {
702
+ $this->result->longitude = $this->readByte($pointer + 4 * ($this->columns[$keys[self::LONGITUDE - 1]][$this->database['type']]), 'float', TRUE);
703
+ }
704
+
705
+ if ($this->columns[$keys[self::ISP - 1]][$this->database['type']] != 0) {
706
+ $this->result->isp = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::ISP - 1]][$this->database['type']]), '32'), 'string', TRUE);
707
+ }
708
+
709
+ if ($this->columns[$keys[self::DOMAIN_NAME - 1]][$this->database['type']] != 0) {
710
+ $this->result->domainName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::DOMAIN_NAME - 1]][$this->database['type']]), '32'), 'string', TRUE);
711
+ }
712
+
713
+ if ($this->columns[$keys[self::ZIP_CODE - 1]][$this->database['type']] != 0) {
714
+ $this->result->zipCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::ZIP_CODE - 1]][$this->database['type']]), '32'), 'string', TRUE);
715
+ }
716
+
717
+ if ($this->columns[$keys[self::TIME_ZONE - 1]][$this->database['type']] != 0) {
718
+ $this->result->timeZone = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::TIME_ZONE - 1]][$this->database['type']]), '32'), 'string', TRUE);
719
+ }
720
+
721
+ if ($this->columns[$keys[self::NET_SPEED - 1]][$this->database['type']] != 0) {
722
+ $this->result->netSpeed = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::NET_SPEED - 1]][$this->database['type']]), '32'), 'string', TRUE);
723
+ }
724
+
725
+ if ($this->columns[$keys[self::IDD_CODE - 1]][$this->database['type']] != 0) {
726
+ $this->result->iddCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::IDD_CODE - 1]][$this->database['type']]), '32'), 'string', TRUE);
727
+ }
728
+
729
+ if ($this->columns[$keys[self::AREA_CODE - 1]][$this->database['type']] != 0) {
730
+ $this->result->areaCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::AREA_CODE - 1]][$this->database['type']]), '32'), 'string', TRUE);
731
+ }
732
+
733
+ if ($this->columns[$keys[self::WEATHER_STATION_CODE - 1]][$this->database['type']] != 0) {
734
+ $this->result->weatherStationCode = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::WEATHER_STATION_CODE - 1]][$this->database['type']]), '32'), 'string', TRUE);
735
+ }
736
+
737
+ if ($this->columns[$keys[self::WEATHER_STATION_NAME - 1]][$this->database['type']] != 0) {
738
+ $this->result->weatherStationName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::WEATHER_STATION_NAME - 1]][$this->database['type']]), '32'), 'string', TRUE);
739
+ }
740
+
741
+ if ($this->columns[$keys[self::MCC - 1]][$this->database['type']] != 0) {
742
+ $this->result->mcc = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::MCC - 1]][$this->database['type']]), '32'), 'string', TRUE);
743
+ }
744
+
745
+ if ($this->columns[$keys[self::MNC - 1]][$this->database['type']] != 0) {
746
+ $this->result->mnc = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::MNC - 1]][$this->database['type']]), '32'), 'string', TRUE);
747
+ }
748
+
749
+ if ($this->columns[$keys[self::MOBILE_CARRIER_NAME - 1]][$this->database['type']] != 0) {
750
+ $this->result->mobileCarrierName = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::MOBILE_CARRIER_NAME - 1]][$this->database['type']]), '32'), 'string', TRUE);
751
+ }
752
+
753
+ if ($this->columns[$keys[self::ELEVATION - 1]][$this->database['type']] != 0) {
754
+ $this->result->elevation = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::ELEVATION - 1]][$this->database['type']]), '32'), 'string', TRUE);
755
+ }
756
+
757
+ if ($this->columns[$keys[self::USAGE_TYPE - 1]][$this->database['type']] != 0) {
758
+ $this->result->usageType = $this->readByte($this->readByte($pointer + 4 * ($this->columns[$keys[self::USAGE_TYPE - 1]][$this->database['type']]), '32'), 'string', TRUE);
759
+ }
760
+
761
+ return $this->result;
762
+ }
763
+ return $return;
764
+ }
765
+ else {
766
+ if ($ip_number < $ip_from) {
767
+ $high = $mid - 1;
768
+ }
769
+ else {
770
+ $low = $mid + 1;
771
+ }
772
+ }
773
+ }
774
+ }
775
+ }
776
+ ?>
app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-install-1.1.2.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $product_installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup ( 'core_setup' );
5
+ $order_installer = new Mage_Sales_Model_Mysql4_Setup ( 'core_setup' );
6
+ $installer->startSetup ();
7
+
8
+ if ($product_installer->getAttributeId ( 'catalog_product', 'bongo_domestic_cost' ) === false)
9
+ $product_installer->addAttribute ( 'catalog_product', 'bongo_domestic_cost', array ('group' => 'Bongo International', 'input' => 'price', 'type' => 'decimal', 'label' => 'Bongo Domestic Shipping Cost', 'note' => 'If you configure Bongo\'s Domestic Shipping Calculation to be "Per-Product", this value will be combined with the Calculated Shipping Cost returned from Bongo and the resulting total will be displayed in shipping estimates.', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE ) );
10
+
11
+ if ($order_installer->getAttributeId ( 'order', 'bongo_id' ) === false)
12
+ $order_installer->addAttribute ( 'order', 'bongo_id', array ('type' => 'int', 'input' => 'text', 'label' => 'Bongo Order ID', 'visible' => true, 'required' => false, 'position' => 1 ) );
13
+ if ($order_installer->getAttributeId ( 'order', 'bongo_tracking' ) === false)
14
+ $order_installer->addAttribute ( 'order', 'bongo_tracking', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo Tracking Link', 'visible' => true, 'required' => false, 'position' => 1 ) );
15
+ if ($order_installer->getAttributeId ( 'order', 'bongo_tracking_domestic' ) === false)
16
+ $order_installer->addAttribute ( 'order', 'bongo_tracking_domestic', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Domestic Tracking Number(s)', 'visible' => true, 'required' => false, 'position' => 1 ) );
17
+ if ($order_installer->getAttributeId ( 'order', 'bongo_status_code' ) === false)
18
+ $order_installer->addAttribute ( 'order', 'bongo_status_code', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo Latest Status Code', 'visible' => true, 'required' => false, 'position' => 1 ) );
19
+ if ($order_installer->getAttributeId ( 'order', 'bongo_status_date' ) === false)
20
+ $order_installer->addAttribute ( 'order', 'bongo_status_date', array ('type' => 'timestamp', 'input' => 'text', 'label' => 'Bongo Latest Status Date', 'visible' => true, 'required' => false, 'position' => 1 ) );
21
+ if ($order_installer->getAttributeId ( 'order', 'bongo_landedcosttransactionid' ) === false)
22
+ $order_installer->addAttribute ( 'order', 'bongo_landedcosttransactionid', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo LandedCostTransactionID', 'visible' => true, 'required' => false, 'position' => 1 ) );
23
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_subtotal' ) === false)
24
+ $order_installer->addAttribute ( 'order', 'bongo_totals_subtotal', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Order Subtotal', 'visible' => true, 'required' => false, 'position' => 1 ) );
25
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_duty' ) === false)
26
+ $order_installer->addAttribute ( 'order', 'bongo_totals_duty', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Shipping Duties', 'visible' => true, 'required' => false, 'position' => 1 ) );
27
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_tax' ) === false)
28
+ $order_installer->addAttribute ( 'order', 'bongo_totals_tax', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Shipping Tax', 'visible' => true, 'required' => false, 'position' => 1 ) );
29
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_shipping' ) === false)
30
+ $order_installer->addAttribute ( 'order', 'bongo_totals_shipping', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo International Shipping', 'visible' => true, 'required' => false, 'position' => 1 ) );
31
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_domestic' ) === false)
32
+ $order_installer->addAttribute ( 'order', 'bongo_totals_domestic', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Domestic Shipping', 'visible' => true, 'required' => false, 'position' => 1 ) );
33
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_insurance' ) === false)
34
+ $order_installer->addAttribute ( 'order', 'bongo_totals_insurance', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Insurance', 'visible' => true, 'required' => false, 'position' => 1 ) );
35
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_total' ) === false)
36
+ $order_installer->addAttribute ( 'order', 'bongo_totals_total', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Order Total', 'visible' => true, 'required' => false, 'position' => 1 ) );
37
+
38
+ $installer->endSetup ();
app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-install-1.2.0.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $product_installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup ( 'core_setup' );
5
+ $order_installer = new Mage_Sales_Model_Mysql4_Setup ( 'core_setup' );
6
+ $installer->startSetup ();
7
+
8
+ if ($product_installer->getAttributeId ( 'catalog_product', 'bongo_domestic_cost' ) === false)
9
+ $product_installer->addAttribute ( 'catalog_product', 'bongo_domestic_cost', array ('group' => 'Bongo International', 'input' => 'price', 'type' => 'decimal', 'label' => 'Bongo Domestic Shipping Cost', 'note' => 'If you configure Bongo\'s Domestic Shipping Calculation to be "Per-Product", this value will be combined with the Calculated Shipping Cost returned from Bongo and the resulting total will be displayed in shipping estimates.', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE ) );
10
+
11
+ if ($order_installer->getAttributeId ( 'order', 'bongo_id' ) === false)
12
+ $order_installer->addAttribute ( 'order', 'bongo_id', array ('type' => 'int', 'input' => 'text', 'label' => 'Bongo Order ID', 'visible' => true, 'required' => false, 'position' => 1 ) );
13
+ if ($order_installer->getAttributeId ( 'order', 'bongo_tracking' ) === false)
14
+ $order_installer->addAttribute ( 'order', 'bongo_tracking', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo Tracking Link', 'visible' => true, 'required' => false, 'position' => 1 ) );
15
+ if ($order_installer->getAttributeId ( 'order', 'bongo_tracking_domestic' ) === false)
16
+ $order_installer->addAttribute ( 'order', 'bongo_tracking_domestic', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Domestic Tracking Number(s)', 'visible' => true, 'required' => false, 'position' => 1 ) );
17
+ if ($order_installer->getAttributeId ( 'order', 'bongo_status_code' ) === false)
18
+ $order_installer->addAttribute ( 'order', 'bongo_status_code', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo Latest Status Code', 'visible' => true, 'required' => false, 'position' => 1 ) );
19
+ if ($order_installer->getAttributeId ( 'order', 'bongo_status_date' ) === false)
20
+ $order_installer->addAttribute ( 'order', 'bongo_status_date', array ('type' => 'timestamp', 'input' => 'text', 'label' => 'Bongo Latest Status Date', 'visible' => true, 'required' => false, 'position' => 1 ) );
21
+ if ($order_installer->getAttributeId ( 'order', 'bongo_landedcosttransactionid' ) === false)
22
+ $order_installer->addAttribute ( 'order', 'bongo_landedcosttransactionid', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo LandedCostTransactionID', 'visible' => true, 'required' => false, 'position' => 1 ) );
23
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_subtotal' ) === false)
24
+ $order_installer->addAttribute ( 'order', 'bongo_totals_subtotal', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Order Subtotal', 'visible' => true, 'required' => false, 'position' => 1 ) );
25
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_duty' ) === false)
26
+ $order_installer->addAttribute ( 'order', 'bongo_totals_duty', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Shipping Duties', 'visible' => true, 'required' => false, 'position' => 1 ) );
27
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_tax' ) === false)
28
+ $order_installer->addAttribute ( 'order', 'bongo_totals_tax', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Shipping Tax', 'visible' => true, 'required' => false, 'position' => 1 ) );
29
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_shipping' ) === false)
30
+ $order_installer->addAttribute ( 'order', 'bongo_totals_shipping', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo International Shipping', 'visible' => true, 'required' => false, 'position' => 1 ) );
31
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_domestic' ) === false)
32
+ $order_installer->addAttribute ( 'order', 'bongo_totals_domestic', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Domestic Shipping', 'visible' => true, 'required' => false, 'position' => 1 ) );
33
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_insurance' ) === false)
34
+ $order_installer->addAttribute ( 'order', 'bongo_totals_insurance', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Insurance', 'visible' => true, 'required' => false, 'position' => 1 ) );
35
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_total' ) === false)
36
+ $order_installer->addAttribute ( 'order', 'bongo_totals_total', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Order Total', 'visible' => true, 'required' => false, 'position' => 1 ) );
37
+
38
+ $table = $installer->getConnection ()->newTable ( $installer->getTable ( 'bongointernational/status' ) )->addColumn ( 'status_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array ('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true ), 'Status ID' )->addColumn ( 'order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array ('identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false ), 'Order ID' )->addColumn ( 'code', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array ('nullable' => false ), 'Code' )->addColumn ( 'description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array ('nullable' => false ), 'Description' )->addColumn ( 'notes', Varien_Db_Ddl_Table::TYPE_TEXT, null, array ('nullable' => false ), 'Notes' )->addColumn ( 'created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array ('nullable' => true, 'default' => null ), 'Created At' );
39
+ $installer->getConnection ()->createTable ( $table );
40
+
41
+ $installer->endSetup ();
app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-install-1.2.1.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $product_installer = new Mage_Catalog_Model_Resource_Eav_Mysql4_Setup ( 'core_setup' );
5
+ $order_installer = new Mage_Sales_Model_Mysql4_Setup ( 'core_setup' );
6
+ $installer->startSetup ();
7
+
8
+ if ($product_installer->getAttributeId ( 'catalog_product', 'bongo_domestic_cost' ) === false)
9
+ $product_installer->addAttribute ( 'catalog_product', 'bongo_domestic_cost', array ('group' => 'Bongo International', 'input' => 'price', 'type' => 'decimal', 'label' => 'Bongo Domestic Shipping Cost', 'note' => 'If you configure Bongo\'s Domestic Shipping Calculation to be "Per-Product", this value will be combined with the Calculated Shipping Cost returned from Bongo and the resulting total will be displayed in shipping estimates.', 'backend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 0, 'searchable' => 0, 'filterable' => 0, 'comparable' => 0, 'visible_on_front' => 0, 'visible_in_advanced_search' => 0, 'is_html_allowed_on_front' => 0, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE ) );
10
+
11
+ if ($order_installer->getAttributeId ( 'order', 'bongo_id' ) === false)
12
+ $order_installer->addAttribute ( 'order', 'bongo_id', array ('type' => 'int', 'input' => 'text', 'label' => 'Bongo Order ID', 'visible' => true, 'required' => false, 'position' => 1 ) );
13
+ if ($order_installer->getAttributeId ( 'order', 'bongo_tracking' ) === false)
14
+ $order_installer->addAttribute ( 'order', 'bongo_tracking', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo Tracking Link', 'visible' => true, 'required' => false, 'position' => 1 ) );
15
+ if ($order_installer->getAttributeId ( 'order', 'bongo_tracking_domestic' ) === false)
16
+ $order_installer->addAttribute ( 'order', 'bongo_tracking_domestic', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Domestic Tracking Number(s)', 'visible' => true, 'required' => false, 'position' => 1 ) );
17
+ if ($order_installer->getAttributeId ( 'order', 'bongo_status_code' ) === false)
18
+ $order_installer->addAttribute ( 'order', 'bongo_status_code', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo Latest Status Code', 'visible' => true, 'required' => false, 'position' => 1 ) );
19
+ if ($order_installer->getAttributeId ( 'order', 'bongo_status_date' ) === false)
20
+ $order_installer->addAttribute ( 'order', 'bongo_status_date', array ('type' => 'timestamp', 'input' => 'text', 'label' => 'Bongo Latest Status Date', 'visible' => true, 'required' => false, 'position' => 1 ) );
21
+ if ($order_installer->getAttributeId ( 'order', 'bongo_landedcosttransactionid' ) === false)
22
+ $order_installer->addAttribute ( 'order', 'bongo_landedcosttransactionid', array ('type' => 'varchar', 'input' => 'text', 'label' => 'Bongo LandedCostTransactionID', 'visible' => true, 'required' => false, 'position' => 1 ) );
23
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_subtotal' ) === false)
24
+ $order_installer->addAttribute ( 'order', 'bongo_totals_subtotal', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Order Subtotal', 'visible' => true, 'required' => false, 'position' => 1 ) );
25
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_duty' ) === false)
26
+ $order_installer->addAttribute ( 'order', 'bongo_totals_duty', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Shipping Duties', 'visible' => true, 'required' => false, 'position' => 1 ) );
27
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_tax' ) === false)
28
+ $order_installer->addAttribute ( 'order', 'bongo_totals_tax', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Shipping Tax', 'visible' => true, 'required' => false, 'position' => 1 ) );
29
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_shipping' ) === false)
30
+ $order_installer->addAttribute ( 'order', 'bongo_totals_shipping', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo International Shipping', 'visible' => true, 'required' => false, 'position' => 1 ) );
31
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_domestic' ) === false)
32
+ $order_installer->addAttribute ( 'order', 'bongo_totals_domestic', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Domestic Shipping', 'visible' => true, 'required' => false, 'position' => 1 ) );
33
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_insurance' ) === false)
34
+ $order_installer->addAttribute ( 'order', 'bongo_totals_insurance', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Insurance', 'visible' => true, 'required' => false, 'position' => 1 ) );
35
+ if ($order_installer->getAttributeId ( 'order', 'bongo_totals_total' ) === false)
36
+ $order_installer->addAttribute ( 'order', 'bongo_totals_total', array ('type' => 'decimal', 'input' => 'text', 'label' => 'Bongo Order Total', 'visible' => true, 'required' => false, 'position' => 1 ) );
37
+
38
+ $table = $installer->getConnection ()->newTable ( $installer->getTable ( 'bongointernational/status' ) )->addColumn ( 'status_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array ('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true ), 'Status ID' )->addColumn ( 'order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array ('identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false ), 'Order ID' )->addColumn ( 'code', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array ('nullable' => false ), 'Code' )->addColumn ( 'description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array ('nullable' => false ), 'Description' )->addColumn ( 'notes', Varien_Db_Ddl_Table::TYPE_TEXT, null, array ('nullable' => false ), 'Notes' )->addColumn ( 'created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array ('nullable' => true, 'default' => null ), 'Created At' );
39
+ $installer->getConnection ()->createTable ( $table );
40
+
41
+ $core_config = Mage::getModel ( 'core/config' );
42
+ $core_config->saveConfig ( 'currency/import/enabled', '1', 'default', 0 );
43
+ $core_config->saveConfig ( 'currency/import/service', 'bongo_currency_converter', 'default', 0 );
44
+ $core_config->saveConfig ( 'currency/import/frequency', 'D', 'default', 0 );
45
+
46
+ $installer->endSetup ();
app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-upgrade-1.1.2-1.2.0.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup ();
5
+
6
+ $table = $installer->getConnection ()->newTable ( $installer->getTable ( 'bongointernational/status' ) )->addColumn ( 'status_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array ('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true ), 'Status ID' )->addColumn ( 'order_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array ('identity' => false, 'unsigned' => true, 'nullable' => false, 'primary' => false ), 'Order ID' )->addColumn ( 'code', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array ('nullable' => false ), 'Code' )->addColumn ( 'description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array ('nullable' => false ), 'Description' )->addColumn ( 'notes', Varien_Db_Ddl_Table::TYPE_TEXT, null, array ('nullable' => false ), 'Notes' )->addColumn ( 'created_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array ('nullable' => true, 'default' => null ), 'Created At' );
7
+ $installer->getConnection ()->createTable ( $table );
8
+
9
+ $installer->endSetup ();
app/code/community/Bongo/International/sql/bongointernational_setup/mysql4-upgrade-1.2.0-1.2.1.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup ();
5
+
6
+ $core_config = Mage::getModel ( 'core/config' );
7
+ $core_config->saveConfig ( 'currency/import/enabled', '1', 'default', 0 );
8
+ $core_config->saveConfig ( 'currency/import/service', 'bongo_currency_converter', 'default', 0 );
9
+ $core_config->saveConfig ( 'currency/import/frequency', 'D', 'default', 0 );
10
+
11
+ $installer->endSetup ();
app/design/adminhtml/default/default/layout/bongointernational.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sales_order_view>
4
+ <reference name="content">
5
+ <block type="bongointernational/adminhtml_sales_order_view_bongointernational" before="-" name="bongointernational.order.info" template="bongointernational/sales/order/view/bongointernational.phtml" />
6
+ </reference>
7
+ <reference name="order_totals">
8
+ <block type="bongointernational/sales_order_totals" />
9
+ </reference>
10
+ </adminhtml_sales_order_view>
11
+ <adminhtml_sales_order_invoice_new>
12
+ <reference name="order_totals">
13
+ <block type="bongointernational/sales_order_totals" />
14
+ </reference>
15
+ </adminhtml_sales_order_invoice_new>
16
+ <adminhtml_sales_order_invoice_view>
17
+ <reference name="order_totals">
18
+ <block type="bongointernational/sales_order_totals" />
19
+ </reference>
20
+ </adminhtml_sales_order_invoice_view>
21
+ <adminhtml_sales_order_creditmemo_new>
22
+ <reference name="order_totals">
23
+ <block type="bongointernational/sales_order_totals" />
24
+ </reference>
25
+ </adminhtml_sales_order_creditmemo_new>
26
+ <adminhtml_sales_order_creditmemo_view>
27
+ <reference name="order_totals">
28
+ <block type="bongointernational/sales_order_totals" />
29
+ </reference>
30
+ </adminhtml_sales_order_creditmemo_view>
31
+ </layout>
app/design/adminhtml/default/default/template/bongointernational/sales/order/view/bongointernational.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <?php if ($this->getIsEnabled($_order->getStoreId()) && $_order->getBongoId()): ?>
3
+ <div id="bongo_international_order_info" style="display:none">
4
+ <div class="box-left">
5
+ <!--Order Information-->
6
+ <div class="entry-edit">
7
+ <div class="entry-edit-head">
8
+ <h4 class="icon-head head-account">Bongo Order Information</h4>
9
+ </div>
10
+ <div class="fieldset">
11
+ <table cellspacing="0" class="form-list">
12
+ <tr>
13
+ <td class="label"><label>Bongo Order ID</label></td>
14
+ <td class="value"><strong><?php echo $_order->getBongoId(); ?></strong></td>
15
+ </tr>
16
+ <tr>
17
+ <td class="label"><label>Unified Tracking Link</label></td>
18
+ <td class="value"><strong><a href="<?php echo $_order->getBongoTracking(); ?>" target="_blank"><?php echo $_order->getBongoTracking(); ?></a></strong></td>
19
+ </tr>
20
+ <?php $domestic_tracking = unserialize($_order->getBongoTrackingDomestic()); ?>
21
+ <?php if (is_array($domestic_tracking) && count($domestic_tracking)>0): ?>
22
+ <tr>
23
+ <td class="label"><label>Domestic Tracking Number(s)</label></td>
24
+ <td class="value"><strong><?php echo implode(", ", $domestic_tracking); ?></strong></td>
25
+ </tr>
26
+ <?php endif; ?>
27
+ <tr>
28
+ <td class="label"><label>Latest Status from Bongo</label></td>
29
+ <td class="value"><strong><?php echo $_order->getBongoStatusCode(); ?></strong></td>
30
+ </tr>
31
+ <tr>
32
+ <td class="label"><label>Latest Status Update</label></td>
33
+ <td class="value"><strong><?php echo $_order->getBongoStatusDate(); ?></strong></td>
34
+ </tr>
35
+ <tr>
36
+ <td colspan="2">&nbsp;</td>
37
+ </tr>
38
+ <tr>
39
+ <td class="label"><label>Order Subtotal</label></td>
40
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsSubtotal()); ?></strong></td>
41
+ </tr>
42
+ <tr>
43
+ <td class="label"><label>Domestic Shipping Cost</label></td>
44
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsDomestic()); ?></strong></td>
45
+ </tr>
46
+ <tr>
47
+ <td class="label"><label>International Shipping Cost</label></td>
48
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsShipping()); ?></strong></td>
49
+ </tr>
50
+ <tr>
51
+ <td class="label"><label>International Shipping Duties</label></td>
52
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsDuty()); ?></strong></td>
53
+ </tr>
54
+ <tr>
55
+ <td class="label"><label>International Shipping Tax</label></td>
56
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsTax()); ?></strong></td>
57
+ </tr>
58
+ <tr>
59
+ <td class="label"><label>International Insurance Cost</label></td>
60
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsInsurance()); ?></strong></td>
61
+ </tr>
62
+ <tr>
63
+ <td class="label"><label>Grand Total</label></td>
64
+ <td class="value"><strong><?php echo Mage::helper('core')->currency($_order->getBongoTotalsTotal()); ?></strong></td>
65
+ </tr>
66
+ </table>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <div class="box-right">
71
+ <!--History Information-->
72
+ <div class="entry-edit">
73
+ <div class="entry-edit-head">
74
+ <h4 class="icon-head head-account">Bongo Order Status History</h4>
75
+ </div>
76
+ <div class="fieldset">
77
+ <ul class="note-list">
78
+ <?php $i=0; ?>
79
+ <?php foreach ($this->getOrderStatusHistory($_order->getId()) as $history): ?>
80
+ <?php $i++; ?>
81
+ <li>
82
+ <strong><?php echo date('M j, Y', strtotime($history->getCreatedAt())) ?></strong>
83
+ <?php echo date('g:i:s A', strtotime($history->getCreatedAt())) ?><span class="separator">|</span><strong><?php echo $history->getCode() ?></strong>
84
+ <br/><?php echo $history->getNotes() ?>
85
+ </li>
86
+ <?php endforeach; ?>
87
+ </ul>
88
+ <?php if ($i<1): ?>
89
+ No order status history is available from Bongo yet.
90
+ <?php endif; ?>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ <div class="clear"></div>
95
+ </div>
96
+ <script type="text/javascript">
97
+ <!--
98
+ document.observe('dom:loaded', function(){
99
+ $('order-messages').insert({after: $('bongo_international_order_info').innerHTML});
100
+
101
+ /*$$('div.box-right').findAll(function(e){
102
+ if(e.innerHTML.indexOf('<!--Account Information-->') != -1){
103
+ e.removeClassName('box-right');
104
+ e.addClassName('box-left');
105
+ }
106
+ });*/
107
+ });
108
+ // -->
109
+ </script>
110
+ <?php endif; ?>
app/design/frontend/base/default/layout/bongointernational.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <!-- <block type="bongointernational/extend_code" name="default.bongointernational.extend.code" output="toHtml" template="bongointernational/extend/code.phtml" before="-" /> -->
6
+ <block type="bongointernational/currency_selector_lightbox" name="default.bongointernational.currency.selector.lightbox" output="toHtml" template="bongointernational/currency/selector/lightbox.phtml" before="-" />
7
+ </reference>
8
+ <reference name="header">
9
+ <!-- <block type="bongointernational/currency_selector_default" name="default.bongointernational.currency.selector.default" template="bongointernational/currency/selector/default.phtml" before="-" /> -->
10
+ <block type="core/text_list" name="store_language" as="store_language">
11
+ <block type="page/switch" name="store_language_standard" as="store_language_standard" template="page/switch/languages.phtml"/>
12
+ <block type="bongointernational/currency_selector_experimental" name="default.bongointernational.currency.selector.experimental" template="bongointernational/currency/selector/experimental.phtml" after="store_language_standard" />
13
+ </block>
14
+ </reference>
15
+ </default>
16
+
17
+ <checkout_cart_index>
18
+ <reference name="checkout.cart.top_methods">
19
+ <block type="bongointernational/checkout_link" name="checkout.cart.methods.bongointernational.checkout.top" template="bongointernational/checkout/link.phtml" before="-"/>
20
+ </reference>
21
+
22
+ <reference name="checkout.cart.methods">
23
+ <block type="bongointernational/checkout_link" after="checkout.cart.methods.onepage" name="checkout.cart.methods.bongointernational.checkout.bottom" template="bongointernational/checkout/link.phtml"/>
24
+ </reference>
25
+
26
+ <reference name="before_body_end">
27
+ <block type="bongointernational/checkout_form" name="checkout.cart.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
28
+ </reference>
29
+ </checkout_cart_index>
30
+
31
+ <checkout_onepage_shippingmethod>
32
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
33
+ <block type="bongointernational/checkout_redirect" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.redirect" output="toHtml" template="bongointernational/checkout/redirect.phtml" />
34
+ </checkout_onepage_shippingmethod>
35
+
36
+ <onestepcheckout_index_index>
37
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
38
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
39
+ <block type="bongointernational/compatibility_checkout_onestepcheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.onestepcheckout" output="toHtml" template="bongointernational/compatibility/checkout/onestepcheckout.phtml" />
40
+ </onestepcheckout_index_index>
41
+
42
+ <firecheckout_index_index>
43
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
44
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
45
+ <block type="bongointernational/compatibility_checkout_firecheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.firecheckout" output="toHtml" template="bongointernational/compatibility/checkout/firecheckout.phtml" />
46
+ </firecheckout_index_index>
47
+
48
+ <sales_order_view>
49
+ <reference name="order_totals">
50
+ <block type="bongointernational/sales_order_totals" />
51
+ </reference>
52
+ </sales_order_view>
53
+ <sales_order_invoice>
54
+ <reference name="order_totals">
55
+ <block type="bongointernational/sales_order_totals" />
56
+ </reference>
57
+ </sales_order_invoice>
58
+ <sales_order_creditmemo>
59
+ <reference name="order_totals">
60
+ <block type="bongointernational/sales_order_totals" />
61
+ </reference>
62
+ </sales_order_creditmemo>
63
+ <sales_order_print>
64
+ <reference name="order_totals">
65
+ <block type="bongointernational/sales_order_totals" />
66
+ </reference>
67
+ </sales_order_print>
68
+ <sales_order_printinvoice>
69
+ <reference name="order_totals">
70
+ <block type="bongointernational/sales_order_totals" />
71
+ </reference>
72
+ </sales_order_printinvoice>
73
+ <sales_order_printcreditmemo>
74
+ <reference name="order_totals">
75
+ <block type="bongointernational/sales_order_totals" />
76
+ </reference>
77
+ </sales_order_printcreditmemo>
78
+ <sales_email_order_items>
79
+ <reference name="order_totals">
80
+ <block type="bongointernational/sales_order_totals" />
81
+ </reference>
82
+ </sales_email_order_items>
83
+ <sales_email_order_invoice_items>
84
+ <reference name="order_totals">
85
+ <block type="bongointernational/sales_order_totals" />
86
+ </reference>
87
+ </sales_email_order_invoice_items>
88
+ <sales_email_order_creditmemo_items>
89
+ <reference name="order_totals">
90
+ <block type="bongointernational/sales_order_totals" />
91
+ </reference>
92
+ </sales_email_order_creditmemo_items>
93
+ </layout>
app/design/frontend/base/default/template/bongointernational/checkout/form.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ ?>
4
+ <div id="bongo_form_div">
5
+ <form id="bongo_form" action="<?php
6
+ echo $this->getCheckoutUrl ();
7
+ ?>" method="post">
8
+ <input type="hidden" name="TOTAL_DOMESTIC_SHIPPING_CHARGE"
9
+ value="<?php
10
+ echo $this->getDomesticShipping ();
11
+ ?>" />
12
+ <input type="hidden" name="PARTNER_KEY"
13
+ value="<?php
14
+ echo $this->getApiKey ();
15
+ ?>">
16
+ <input type="hidden" name="CUSTOM_ORDER_1"
17
+ value="<?php
18
+ echo $this->getQuoteId ();
19
+ ?>">
20
+ <input type="hidden" name="CUSTOM_ORDER_2" value="<?php echo $this->getCustomerId(); ?>" />
21
+ <input type="hidden" name="CUSTOM_ORDER_3" value="" />
22
+ <?php if ($this->getItems()): ?>
23
+ <?php $i=0; foreach ($this->getItems() as $item): $i++; ?>
24
+ <input type="hidden" name="PRODUCT_ID_<?php echo $i; ?>" value="<?php echo $item->getSku(); ?>" />
25
+ <input type="hidden" name="PRODUCT_NAME_<?php echo $i; ?>" value="<?php echo $item->getName(); ?>" />
26
+ <input type="hidden" name="PRODUCT_PRICE_<?php echo $i; ?>" value="<?php echo $item->getPrice (); ?>" />
27
+ <input type="hidden" name="PRODUCT_Q_<?php echo $i; ?>" value="<?php echo $item->getQty(); ?>" />
28
+ <input type="hidden" name="PRODUCT_SHIPPING_<?php echo $i; ?>" value="0.00" />
29
+ <?php $split_options = ''; $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()); ?>
30
+ <?php if (isset($options['options']) && count($options['options'])>0): ?>
31
+ <?php $o=0; foreach ($options['options'] as $option): ?>
32
+ <?php if (empty($option['label']) && empty($option['value'])) { continue; } ?>
33
+ <?php $split_options .= "{$option['label']}: {$option['value']}; "; ?>
34
+ <?php endforeach; ?>
35
+ <?php endif; ?>
36
+ <?php endforeach; ?>
37
+ <?php endif; ?>
38
+ <?php $split_options = !empty($split_options) ? str_split(strip_tags(substr($split_options, 0, -2)), 330) : array(); ?>
39
+ <?php if (!empty($split_options[0])): ?>
40
+ <input type="hidden" name="PRODUCT_CUSTOM_1_<?php echo $i; ?>" value="<?php echo $split_options[0]; ?>" />
41
+ <?php endif; ?>
42
+ <?php if (!empty($split_options[1])): ?>
43
+ <input type="hidden" name="PRODUCT_CUSTOM_2_<?php echo $i; ?>" value="<?php echo $split_options[1]; ?>" />
44
+ <?php endif; ?>
45
+ <input type="hidden" name="ORDER_CURRENCY" value="<?php echo $this->getCurrencyCode(); ?>" />
46
+ <input type="hidden" name="CUST_FIRST_NAME" value="<?php echo $this->getBillingAddress()->getFirstname(); ?>" />
47
+ <input type="hidden" name="CUST_LAST_NAME" value="<?php echo $this->getBillingAddress()->getLastname(); ?>" />
48
+ <input type="hidden" name="CUST_COMPANY" value="<?php echo $this->getBillingAddress()->getCompany(); ?>" />
49
+ <input type="hidden" name="CUST_ADDRESS_LINE_1" value="<?php echo $this->getBillingAddress()->getStreet(1); ?>" />
50
+ <input type="hidden" name="CUST_ADDRESS_LINE_2" value="<?php echo $this->getBillingAddress()->getStreet(2); ?>" />
51
+ <input type="hidden" name="CUST_CITY" value="<?php echo $this->getBillingAddress()->getCity(); ?>" />
52
+ <input type="hidden" name="CUST_STATE" value="<?php echo $this->getBillingRegion(); ?>" />
53
+ <input type="hidden" name="CUST_COUNTRY" value="<?php echo $this->getBillingAddress()->getCountryId(); ?>" />
54
+ <input type="hidden" name="CUST_ZIP" value="<?php echo $this->getBillingAddress()->getPostcode(); ?>" />
55
+ <input type="hidden" name="CUST_PHONE" value="<?php echo $this->getBillingAddress()->getTelephone(); ?>" />
56
+ <input type="hidden" name="CUST_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
57
+ <input type="hidden" name="SHIP_FIRST_NAME" value="<?php echo $this->getShippingAddress()->getFirstname(); ?>" />
58
+ <input type="hidden" name="SHIP_LAST_NAME" value="<?php echo $this->getShippingAddress()->getLastname(); ?>" />
59
+ <input type="hidden" name="SHIP_COMPANY" value="<?php echo $this->getShippingAddress()->getCompany(); ?>" />
60
+ <input type="hidden" name="SHIP_ADDRESS_LINE_1" value="<?php echo $this->getShippingAddress()->getStreet(1); ?>" />
61
+ <input type="hidden" name="SHIP_ADDRESS_LINE_2" value="<?php echo $this->getShippingAddress()->getStreet(2); ?>" />
62
+ <input type="hidden" name="SHIP_CITY" value="<?php echo $this->getShippingAddress()->getCity(); ?>" />
63
+ <input type="hidden" name="SHIP_STATE" value="<?php echo $this->getShippingRegion(); ?>" />
64
+ <input type="hidden" name="SHIP_COUNTRY" value="<?php echo $this->getShippingCountry(); ?>" />
65
+ <input type="hidden" name="SHIP_ZIP" value="<?php echo $this->getShippingAddress()->getPostcode(); ?>" />
66
+ <input type="hidden" name="SHIP_PHONE" value="<?php echo $this->getShippingAddress()->getTelephone(); ?>" />
67
+ <input type="hidden" name="SHIP_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
68
+ <input type="hidden" name="SUB" value="SUBMIT ORDER" />
69
+ </form>
70
+ </div>
71
+ <script type="text/javascript">
72
+ //<![CDATA[
73
+ function bongoRedirect () {
74
+ $('bongo_form').submit();
75
+ }
76
+ //]]>
77
+ </script>
78
+
79
+ <?php endif;
80
+ ?>
app/design/frontend/base/default/template/bongointernational/checkout/link.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <input type="image" src="https://bongous.com/partner/images/Bongo_Checkout_Button.png" onclick="bongoRedirect()" />
3
+ <?php endif; ?>
app/design/frontend/base/default/template/bongointernational/checkout/redirect.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var bongo_html = '<form id="bongo_form" action="<?php echo $this->getCheckoutUrl (); ?>" method="post">'+$('bongo_form_div').innerHTML+'</form>';
5
+ $('bongo_form_div').remove();
6
+ $('checkout-step-shipping_method').insert({'bottom':bongo_html});
7
+ $$('#shipping-method-buttons-container button').first().observe('click', function() {
8
+ $('bongo_form').submit();
9
+ });
10
+ //]]>
11
+ </script>
12
+ <?php endif; ?>
app/design/frontend/base/default/template/bongointernational/compatibility/checkout.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var __bongo_allowed_countries = <?php echo json_encode ( $this->getAllowedCountries () ); ?>
5
+
6
+ Element.prototype.triggerEvent = function(eventName)
7
+ {
8
+ if (document.createEvent)
9
+ {
10
+ var evt = document.createEvent('HTMLEvents');
11
+ evt.initEvent(eventName, true, true);
12
+
13
+ return this.dispatchEvent(evt);
14
+ }
15
+
16
+ if (this.fireEvent)
17
+ return this.fireEvent('on' + eventName);
18
+ }
19
+ //]]>
20
+ </script>
21
+ <?php endif; ?>
app/design/frontend/base/default/template/bongointernational/compatibility/checkout/firecheckout.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ padding:5px 10px;
6
+ font-weight:bold;
7
+ }
8
+ -->
9
+ </style>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ var __bongo_hide_checkout_review_int;
13
+
14
+ function bongoHideCheckoutReview(direct) {
15
+ if (direct != true && checkout.loadWaiting != undefined && checkout.loadWaiting == true) {
16
+ return false;
17
+ }
18
+
19
+ if ($('payment-method-review') != undefined) {
20
+ $('payment-method-review').hide();
21
+ }
22
+
23
+ var last_total = $$('#checkout-review-table tfoot tr').last();
24
+
25
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
26
+ last_total.hide();
27
+ }
28
+ }
29
+
30
+ function bongoUpdateCheckout() {
31
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
32
+
33
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
34
+ if ($('bongo_checkout_payment_method_load') != undefined) {
35
+ $('bongo_checkout_payment_method_load').show();
36
+ } else {
37
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
38
+ }
39
+
40
+ $('checkout-payment-method-load').hide();
41
+
42
+ if ($('checkout-coupon-discount-load') != undefined) {
43
+ $('checkout-coupon-discount-load').hide();
44
+ }
45
+
46
+ if ($('checkout-additional') != undefined) {
47
+ $('checkout-additional').hide();
48
+ $$('#checkout-review div.block-title span.num').first().update('4');
49
+ }
50
+
51
+ bongoHideCheckoutReview(true);
52
+
53
+ __bongo_hide_checkout_review_int = setInterval(bongoHideCheckoutReview, 500);
54
+
55
+ return false;
56
+ } else {
57
+ if ($('bongo_checkout_payment_method_load') != undefined) {
58
+ $('bongo_checkout_payment_method_load').hide();
59
+ }
60
+
61
+ $('checkout-payment-method-load').show();
62
+
63
+ if ($('checkout-coupon-discount-load') != undefined) {
64
+ $('checkout-coupon-discount-load').show();
65
+ }
66
+
67
+ if ($('checkout-additional') != undefined) {
68
+ $('checkout-additional').show();
69
+ $$('div#checkout-review div.block-title span.num').first().update('5');
70
+ }
71
+
72
+ if ($('payment-method-review') != undefined) {
73
+ $('payment-method-review').hide();
74
+ }
75
+
76
+ var last_total = $$('#checkout-review-table tfoot tr').last();
77
+
78
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
79
+ last_total.show();
80
+ }
81
+
82
+ clearInterval(__bongo_hide_checkout_review_int);
83
+ }
84
+ }
85
+
86
+ if ($('firecheckout-form') != undefined && $('bongo_form') != undefined) {
87
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
88
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
89
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
90
+
91
+ bongoUpdateCheckout();
92
+
93
+ $$('#review-buttons-container button').first().writeAttribute('onclick', null);
94
+ $$('#review-buttons-container button').first().observe('click', function() {
95
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
96
+
97
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
98
+ $('bongo_form').submit();
99
+
100
+ return false;
101
+ } else {
102
+ checkout.save();
103
+ }
104
+
105
+ return false;
106
+ });
107
+ }
108
+ //]]>
109
+ </script>
110
+ <?php endif; ?>
app/design/frontend/base/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ font-weight:bold;
6
+ }
7
+ -->
8
+ </style>
9
+ <script type="text/javascript">
10
+ //<![CDATA[
11
+ var __bongo_hide_checkout_review_int = setInterval(bongoUpdateCheckout, 500);
12
+
13
+ function bongoUpdateCheckout() {
14
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
15
+
16
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
17
+ if ($('bongo_checkout_payment_method_load') != undefined) {
18
+ $('bongo_checkout_payment_method_load').show();
19
+ } else if ($('checkout-payment-method-load') != undefined) {
20
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
21
+ }
22
+
23
+ if ($('checkout-payment-method-load') != undefined) {
24
+ $('checkout-payment-method-load').hide();
25
+ }
26
+
27
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
28
+ $$('div.onestepcheckout-coupons').first().hide();
29
+ }
30
+
31
+ if ($('onestepcheckout-giftmessages') != undefined) {
32
+ $('onestepcheckout-giftmessages').hide();
33
+ }
34
+
35
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
36
+ $$('div.onestepcheckout-feedback').first().hide();
37
+ }
38
+
39
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
40
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().hide();
41
+ }
42
+
43
+ return false;
44
+ } else {
45
+ if ($('bongo_checkout_payment_method_load') != undefined) {
46
+ $('bongo_checkout_payment_method_load').hide();
47
+ }
48
+
49
+ if ($('checkout-payment-method-load') != undefined) {
50
+ $('checkout-payment-method-load').show();
51
+ }
52
+
53
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
54
+ $$('div.onestepcheckout-coupons').first().show();
55
+ }
56
+
57
+ if ($('onestepcheckout-giftmessages') != undefined) {
58
+ $('onestepcheckout-giftmessages').show();
59
+ }
60
+
61
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
62
+ $$('div.onestepcheckout-feedback').first().show();
63
+ }
64
+
65
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
66
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().show();
67
+ }
68
+ }
69
+ }
70
+
71
+ if ($('onestepcheckout-form') != undefined && $('bongo_form') != undefined) {
72
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
73
+ $('billing:use_for_shipping_yes').observe('change', bongoUpdateCheckout);
74
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
75
+
76
+ if ($('shipping:same_as_billing') != undefined) {
77
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
78
+ }
79
+
80
+ bongoUpdateCheckout();
81
+
82
+ $$('div.onestepcheckout-place-order').first().update($$('div.onestepcheckout-place-order').first().innerHTML+$$('div.onestepcheckout-place-order').first().innerHTML);
83
+ $$('div.onestepcheckout-place-order button').first().setAttribute('id','bongo-onestepcheckout-place-order');
84
+ $('onestepcheckout-place-order').hide();
85
+ $('bongo-onestepcheckout-place-order').observe('click', function() {
86
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
87
+
88
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
89
+ $('bongo_form').submit();
90
+
91
+ return false;
92
+ } else {
93
+ $('onestepcheckout-place-order').triggerEvent('click');
94
+ }
95
+
96
+ return false;
97
+ });
98
+ }
99
+ //]]>
100
+ </script>
101
+ <?php endif; ?>
app/design/frontend/base/default/template/bongointernational/currency/selector/default.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-default"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-default"
18
+ id="bongo-country-selector-default">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/base/default/template/bongointernational/currency/selector/experimental.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-experimental"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-experimental"
18
+ id="bongo-country-selector-experimental">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/base/default/template/bongointernational/currency/selector/lightbox.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $current_country = $this->getCurrentCountry ();
4
+
5
+ if (empty ( $current_country )) :
6
+ $countries = $this->getCountries ();
7
+ $current_country = $this->getGeoCountry ();
8
+ $default_country = $this->getDefaultCountry ();
9
+
10
+ if (! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
11
+ ?>
12
+ <div id="bongo_welcome_lightbox" title="Welcome!">
13
+ <div id="bongo_welcome_lightbox_text"><?php
14
+ echo str_replace ( '{COUNTRY}', $countries [$current_country] ['name'], Mage::getStoreConfig ( 'bongointernational_config/currency/welcome_lightbox_contents' ) );
15
+ ?></div>
16
+ <div class="form-language"><select
17
+ onchange="window.location.href=this.value"
18
+ name="bongo-country-selector-lightbox" id="bongo-country-selector-lightbox">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?>
29
+ selected="SELECTED"
30
+ <?php endif;
31
+ ?>>
32
+ <?php
33
+ echo $_country ['name'];
34
+ ?>
35
+ </option>
36
+ <?php
37
+ endforeach
38
+ ;
39
+ ?>
40
+ </select></div>
41
+ </div>
42
+ <script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"><\/script><script>$.noConflict()<\/script>')</script>
43
+ <script type="text/javascript">window.jQuery.ui || document.write('<script type="text/javascript" src="//code.jquery.com/ui/1.11.1/jquery-ui.min.js"><\/script><link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/south-street/jquery-ui.css" />')</script>
44
+ <script type="text/javascript">
45
+ <!--
46
+ jQuery( document ).ready(function( $ ) {
47
+ function setCountry() {
48
+ window.location.href=$('#bongo-country-selector-lightbox').val();
49
+ $( "#bongo_welcome_lightbox" ).dialog( "close" )
50
+ }
51
+
52
+ $( "#bongo_welcome_lightbox" ).dialog({
53
+ modal: true,
54
+ buttons: {
55
+ Ok: setCountry
56
+ },
57
+ close: setCountry
58
+ });
59
+ });
60
+ // -->
61
+ </script>
62
+ <?php endif;
63
+ ?>
64
+ <?php endif;
65
+ ?>
66
+ <?php endif;
67
+ ?>
app/design/frontend/base/default/template/bongointernational/extend/code.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php /*if ($this->getIsEnabled()): ?>
2
+ <?php echo $this->getExtendCode(); ?>
3
+ <?php endif;*/ ?>
app/design/frontend/default/default/layout/bongointernational.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <!-- <block type="bongointernational/extend_code" name="default.bongointernational.extend.code" output="toHtml" template="bongointernational/extend/code.phtml" before="-" /> -->
6
+ <block type="bongointernational/currency_selector_lightbox" name="default.bongointernational.currency.selector.lightbox" output="toHtml" template="bongointernational/currency/selector/lightbox.phtml" before="-" />
7
+ </reference>
8
+ <reference name="header">
9
+ <!-- <block type="bongointernational/currency_selector_default" name="default.bongointernational.currency.selector.default" template="bongointernational/currency/selector/default.phtml" before="-" /> -->
10
+ <block type="core/text_list" name="store_language" as="store_language">
11
+ <block type="page/switch" name="store_language_standard" as="store_language_standard" template="page/switch/languages.phtml"/>
12
+ <block type="bongointernational/currency_selector_experimental" name="default.bongointernational.currency.selector.experimental" template="bongointernational/currency/selector/experimental.phtml" after="store_language_standard" />
13
+ </block>
14
+ </reference>
15
+ </default>
16
+
17
+ <checkout_cart_index>
18
+ <reference name="checkout.cart.top_methods">
19
+ <block type="bongointernational/checkout_link" name="checkout.cart.methods.bongointernational.checkout.top" template="bongointernational/checkout/link.phtml" before="-"/>
20
+ </reference>
21
+
22
+ <reference name="checkout.cart.methods">
23
+ <block type="bongointernational/checkout_link" after="checkout.cart.methods.onepage" name="checkout.cart.methods.bongointernational.checkout.bottom" template="bongointernational/checkout/link.phtml"/>
24
+ </reference>
25
+
26
+ <reference name="before_body_end">
27
+ <block type="bongointernational/checkout_form" name="checkout.cart.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
28
+ </reference>
29
+ </checkout_cart_index>
30
+
31
+ <checkout_onepage_shippingmethod>
32
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
33
+ <block type="bongointernational/checkout_redirect" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.redirect" output="toHtml" template="bongointernational/checkout/redirect.phtml" />
34
+ </checkout_onepage_shippingmethod>
35
+
36
+ <onestepcheckout_index_index>
37
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
38
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
39
+ <block type="bongointernational/compatibility_checkout_onestepcheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.onestepcheckout" output="toHtml" template="bongointernational/compatibility/checkout/onestepcheckout.phtml" />
40
+ </onestepcheckout_index_index>
41
+
42
+ <firecheckout_index_index>
43
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
44
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
45
+ <block type="bongointernational/compatibility_checkout_firecheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.firecheckout" output="toHtml" template="bongointernational/compatibility/checkout/firecheckout.phtml" />
46
+ </firecheckout_index_index>
47
+
48
+ <sales_order_view>
49
+ <reference name="order_totals">
50
+ <block type="bongointernational/sales_order_totals" />
51
+ </reference>
52
+ </sales_order_view>
53
+ <sales_order_invoice>
54
+ <reference name="order_totals">
55
+ <block type="bongointernational/sales_order_totals" />
56
+ </reference>
57
+ </sales_order_invoice>
58
+ <sales_order_creditmemo>
59
+ <reference name="order_totals">
60
+ <block type="bongointernational/sales_order_totals" />
61
+ </reference>
62
+ </sales_order_creditmemo>
63
+ <sales_order_print>
64
+ <reference name="order_totals">
65
+ <block type="bongointernational/sales_order_totals" />
66
+ </reference>
67
+ </sales_order_print>
68
+ <sales_order_printinvoice>
69
+ <reference name="order_totals">
70
+ <block type="bongointernational/sales_order_totals" />
71
+ </reference>
72
+ </sales_order_printinvoice>
73
+ <sales_order_printcreditmemo>
74
+ <reference name="order_totals">
75
+ <block type="bongointernational/sales_order_totals" />
76
+ </reference>
77
+ </sales_order_printcreditmemo>
78
+ <sales_email_order_items>
79
+ <reference name="order_totals">
80
+ <block type="bongointernational/sales_order_totals" />
81
+ </reference>
82
+ </sales_email_order_items>
83
+ <sales_email_order_invoice_items>
84
+ <reference name="order_totals">
85
+ <block type="bongointernational/sales_order_totals" />
86
+ </reference>
87
+ </sales_email_order_invoice_items>
88
+ <sales_email_order_creditmemo_items>
89
+ <reference name="order_totals">
90
+ <block type="bongointernational/sales_order_totals" />
91
+ </reference>
92
+ </sales_email_order_creditmemo_items>
93
+ </layout>
app/design/frontend/default/default/template/bongointernational/checkout/form.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ ?>
4
+ <div id="bongo_form_div">
5
+ <form id="bongo_form" action="<?php
6
+ echo $this->getCheckoutUrl ();
7
+ ?>" method="post">
8
+ <input type="hidden" name="TOTAL_DOMESTIC_SHIPPING_CHARGE"
9
+ value="<?php
10
+ echo $this->getDomesticShipping ();
11
+ ?>" />
12
+ <input type="hidden" name="PARTNER_KEY"
13
+ value="<?php
14
+ echo $this->getApiKey ();
15
+ ?>">
16
+ <input type="hidden" name="CUSTOM_ORDER_1"
17
+ value="<?php
18
+ echo $this->getQuoteId ();
19
+ ?>">
20
+ <input type="hidden" name="CUSTOM_ORDER_2" value="<?php echo $this->getCustomerId(); ?>" />
21
+ <input type="hidden" name="CUSTOM_ORDER_3" value="" />
22
+ <?php if ($this->getItems()): ?>
23
+ <?php $i=0; foreach ($this->getItems() as $item): $i++; ?>
24
+ <input type="hidden" name="PRODUCT_ID_<?php echo $i; ?>" value="<?php echo $item->getSku(); ?>" />
25
+ <input type="hidden" name="PRODUCT_NAME_<?php echo $i; ?>" value="<?php echo $item->getName(); ?>" />
26
+ <input type="hidden" name="PRODUCT_PRICE_<?php echo $i; ?>" value="<?php echo $item->getPrice (); ?>" />
27
+ <input type="hidden" name="PRODUCT_Q_<?php echo $i; ?>" value="<?php echo $item->getQty(); ?>" />
28
+ <input type="hidden" name="PRODUCT_SHIPPING_<?php echo $i; ?>" value="0.00" />
29
+ <?php $split_options = ''; $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()); ?>
30
+ <?php if (isset($options['options']) && count($options['options'])>0): ?>
31
+ <?php $o=0; foreach ($options['options'] as $option): ?>
32
+ <?php if (empty($option['label']) && empty($option['value'])) { continue; } ?>
33
+ <?php $split_options .= "{$option['label']}: {$option['value']}; "; ?>
34
+ <?php endforeach; ?>
35
+ <?php endif; ?>
36
+ <?php endforeach; ?>
37
+ <?php endif; ?>
38
+ <?php $split_options = !empty($split_options) ? str_split(strip_tags(substr($split_options, 0, -2)), 330) : array(); ?>
39
+ <?php if (!empty($split_options[0])): ?>
40
+ <input type="hidden" name="PRODUCT_CUSTOM_1_<?php echo $i; ?>" value="<?php echo $split_options[0]; ?>" />
41
+ <?php endif; ?>
42
+ <?php if (!empty($split_options[1])): ?>
43
+ <input type="hidden" name="PRODUCT_CUSTOM_2_<?php echo $i; ?>" value="<?php echo $split_options[1]; ?>" />
44
+ <?php endif; ?>
45
+ <input type="hidden" name="ORDER_CURRENCY" value="<?php echo $this->getCurrencyCode(); ?>" />
46
+ <input type="hidden" name="CUST_FIRST_NAME" value="<?php echo $this->getBillingAddress()->getFirstname(); ?>" />
47
+ <input type="hidden" name="CUST_LAST_NAME" value="<?php echo $this->getBillingAddress()->getLastname(); ?>" />
48
+ <input type="hidden" name="CUST_COMPANY" value="<?php echo $this->getBillingAddress()->getCompany(); ?>" />
49
+ <input type="hidden" name="CUST_ADDRESS_LINE_1" value="<?php echo $this->getBillingAddress()->getStreet(1); ?>" />
50
+ <input type="hidden" name="CUST_ADDRESS_LINE_2" value="<?php echo $this->getBillingAddress()->getStreet(2); ?>" />
51
+ <input type="hidden" name="CUST_CITY" value="<?php echo $this->getBillingAddress()->getCity(); ?>" />
52
+ <input type="hidden" name="CUST_STATE" value="<?php echo $this->getBillingRegion(); ?>" />
53
+ <input type="hidden" name="CUST_COUNTRY" value="<?php echo $this->getBillingAddress()->getCountryId(); ?>" />
54
+ <input type="hidden" name="CUST_ZIP" value="<?php echo $this->getBillingAddress()->getPostcode(); ?>" />
55
+ <input type="hidden" name="CUST_PHONE" value="<?php echo $this->getBillingAddress()->getTelephone(); ?>" />
56
+ <input type="hidden" name="CUST_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
57
+ <input type="hidden" name="SHIP_FIRST_NAME" value="<?php echo $this->getShippingAddress()->getFirstname(); ?>" />
58
+ <input type="hidden" name="SHIP_LAST_NAME" value="<?php echo $this->getShippingAddress()->getLastname(); ?>" />
59
+ <input type="hidden" name="SHIP_COMPANY" value="<?php echo $this->getShippingAddress()->getCompany(); ?>" />
60
+ <input type="hidden" name="SHIP_ADDRESS_LINE_1" value="<?php echo $this->getShippingAddress()->getStreet(1); ?>" />
61
+ <input type="hidden" name="SHIP_ADDRESS_LINE_2" value="<?php echo $this->getShippingAddress()->getStreet(2); ?>" />
62
+ <input type="hidden" name="SHIP_CITY" value="<?php echo $this->getShippingAddress()->getCity(); ?>" />
63
+ <input type="hidden" name="SHIP_STATE" value="<?php echo $this->getShippingRegion(); ?>" />
64
+ <input type="hidden" name="SHIP_COUNTRY" value="<?php echo $this->getShippingCountry(); ?>" />
65
+ <input type="hidden" name="SHIP_ZIP" value="<?php echo $this->getShippingAddress()->getPostcode(); ?>" />
66
+ <input type="hidden" name="SHIP_PHONE" value="<?php echo $this->getShippingAddress()->getTelephone(); ?>" />
67
+ <input type="hidden" name="SHIP_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
68
+ <input type="hidden" name="SUB" value="SUBMIT ORDER" />
69
+ </form>
70
+ </div>
71
+ <script type="text/javascript">
72
+ //<![CDATA[
73
+ function bongoRedirect () {
74
+ $('bongo_form').submit();
75
+ }
76
+ //]]>
77
+ </script>
78
+
79
+ <?php endif;
80
+ ?>
app/design/frontend/default/default/template/bongointernational/checkout/link.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <input type="image" src="https://bongous.com/partner/images/Bongo_Checkout_Button.png" onclick="bongoRedirect()" />
3
+ <?php endif; ?>
app/design/frontend/default/default/template/bongointernational/checkout/redirect.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var bongo_html = '<form id="bongo_form" action="<?php echo $this->getCheckoutUrl (); ?>" method="post">'+$('bongo_form_div').innerHTML+'</form>';
5
+ $('bongo_form_div').remove();
6
+ $('checkout-step-shipping_method').insert({'bottom':bongo_html});
7
+ $$('#shipping-method-buttons-container button').first().observe('click', function() {
8
+ $('bongo_form').submit();
9
+ });
10
+ //]]>
11
+ </script>
12
+ <?php endif; ?>
app/design/frontend/default/default/template/bongointernational/compatibility/checkout.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var __bongo_allowed_countries = <?php echo json_encode ( $this->getAllowedCountries () ); ?>
5
+
6
+ Element.prototype.triggerEvent = function(eventName)
7
+ {
8
+ if (document.createEvent)
9
+ {
10
+ var evt = document.createEvent('HTMLEvents');
11
+ evt.initEvent(eventName, true, true);
12
+
13
+ return this.dispatchEvent(evt);
14
+ }
15
+
16
+ if (this.fireEvent)
17
+ return this.fireEvent('on' + eventName);
18
+ }
19
+ //]]>
20
+ </script>
21
+ <?php endif; ?>
app/design/frontend/default/default/template/bongointernational/compatibility/checkout/firecheckout.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ padding:5px 10px;
6
+ font-weight:bold;
7
+ }
8
+ -->
9
+ </style>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ var __bongo_hide_checkout_review_int;
13
+
14
+ function bongoHideCheckoutReview(direct) {
15
+ if (direct != true && checkout.loadWaiting != undefined && checkout.loadWaiting == true) {
16
+ return false;
17
+ }
18
+
19
+ if ($('payment-method-review') != undefined) {
20
+ $('payment-method-review').hide();
21
+ }
22
+
23
+ var last_total = $$('#checkout-review-table tfoot tr').last();
24
+
25
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
26
+ last_total.hide();
27
+ }
28
+ }
29
+
30
+ function bongoUpdateCheckout() {
31
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
32
+
33
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
34
+ if ($('bongo_checkout_payment_method_load') != undefined) {
35
+ $('bongo_checkout_payment_method_load').show();
36
+ } else {
37
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
38
+ }
39
+
40
+ $('checkout-payment-method-load').hide();
41
+
42
+ if ($('checkout-coupon-discount-load') != undefined) {
43
+ $('checkout-coupon-discount-load').hide();
44
+ }
45
+
46
+ if ($('checkout-additional') != undefined) {
47
+ $('checkout-additional').hide();
48
+ $$('#checkout-review div.block-title span.num').first().update('4');
49
+ }
50
+
51
+ bongoHideCheckoutReview(true);
52
+
53
+ __bongo_hide_checkout_review_int = setInterval(bongoHideCheckoutReview, 500);
54
+
55
+ return false;
56
+ } else {
57
+ if ($('bongo_checkout_payment_method_load') != undefined) {
58
+ $('bongo_checkout_payment_method_load').hide();
59
+ }
60
+
61
+ $('checkout-payment-method-load').show();
62
+
63
+ if ($('checkout-coupon-discount-load') != undefined) {
64
+ $('checkout-coupon-discount-load').show();
65
+ }
66
+
67
+ if ($('checkout-additional') != undefined) {
68
+ $('checkout-additional').show();
69
+ $$('div#checkout-review div.block-title span.num').first().update('5');
70
+ }
71
+
72
+ if ($('payment-method-review') != undefined) {
73
+ $('payment-method-review').hide();
74
+ }
75
+
76
+ var last_total = $$('#checkout-review-table tfoot tr').last();
77
+
78
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
79
+ last_total.show();
80
+ }
81
+
82
+ clearInterval(__bongo_hide_checkout_review_int);
83
+ }
84
+ }
85
+
86
+ if ($('firecheckout-form') != undefined && $('bongo_form') != undefined) {
87
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
88
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
89
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
90
+
91
+ bongoUpdateCheckout();
92
+
93
+ $$('#review-buttons-container button').first().writeAttribute('onclick', null);
94
+ $$('#review-buttons-container button').first().observe('click', function() {
95
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
96
+
97
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
98
+ $('bongo_form').submit();
99
+
100
+ return false;
101
+ } else {
102
+ checkout.save();
103
+ }
104
+
105
+ return false;
106
+ });
107
+ }
108
+ //]]>
109
+ </script>
110
+ <?php endif; ?>
app/design/frontend/default/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ font-weight:bold;
6
+ }
7
+ -->
8
+ </style>
9
+ <script type="text/javascript">
10
+ //<![CDATA[
11
+ var __bongo_hide_checkout_review_int = setInterval(bongoUpdateCheckout, 500);
12
+
13
+ function bongoUpdateCheckout() {
14
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
15
+
16
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
17
+ if ($('bongo_checkout_payment_method_load') != undefined) {
18
+ $('bongo_checkout_payment_method_load').show();
19
+ } else if ($('checkout-payment-method-load') != undefined) {
20
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
21
+ }
22
+
23
+ if ($('checkout-payment-method-load') != undefined) {
24
+ $('checkout-payment-method-load').hide();
25
+ }
26
+
27
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
28
+ $$('div.onestepcheckout-coupons').first().hide();
29
+ }
30
+
31
+ if ($('onestepcheckout-giftmessages') != undefined) {
32
+ $('onestepcheckout-giftmessages').hide();
33
+ }
34
+
35
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
36
+ $$('div.onestepcheckout-feedback').first().hide();
37
+ }
38
+
39
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
40
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().hide();
41
+ }
42
+
43
+ return false;
44
+ } else {
45
+ if ($('bongo_checkout_payment_method_load') != undefined) {
46
+ $('bongo_checkout_payment_method_load').hide();
47
+ }
48
+
49
+ if ($('checkout-payment-method-load') != undefined) {
50
+ $('checkout-payment-method-load').show();
51
+ }
52
+
53
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
54
+ $$('div.onestepcheckout-coupons').first().show();
55
+ }
56
+
57
+ if ($('onestepcheckout-giftmessages') != undefined) {
58
+ $('onestepcheckout-giftmessages').show();
59
+ }
60
+
61
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
62
+ $$('div.onestepcheckout-feedback').first().show();
63
+ }
64
+
65
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
66
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().show();
67
+ }
68
+ }
69
+ }
70
+
71
+ if ($('onestepcheckout-form') != undefined && $('bongo_form') != undefined) {
72
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
73
+ $('billing:use_for_shipping_yes').observe('change', bongoUpdateCheckout);
74
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
75
+
76
+ if ($('shipping:same_as_billing') != undefined) {
77
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
78
+ }
79
+
80
+ bongoUpdateCheckout();
81
+
82
+ $$('div.onestepcheckout-place-order').first().update($$('div.onestepcheckout-place-order').first().innerHTML+$$('div.onestepcheckout-place-order').first().innerHTML);
83
+ $$('div.onestepcheckout-place-order button').first().setAttribute('id','bongo-onestepcheckout-place-order');
84
+ $('onestepcheckout-place-order').hide();
85
+ $('bongo-onestepcheckout-place-order').observe('click', function() {
86
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
87
+
88
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
89
+ $('bongo_form').submit();
90
+
91
+ return false;
92
+ } else {
93
+ $('onestepcheckout-place-order').triggerEvent('click');
94
+ }
95
+
96
+ return false;
97
+ });
98
+ }
99
+ //]]>
100
+ </script>
101
+ <?php endif; ?>
app/design/frontend/default/default/template/bongointernational/currency/selector/default.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-default"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-default"
18
+ id="bongo-country-selector-default">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/default/default/template/bongointernational/currency/selector/experimental.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-experimental"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-experimental"
18
+ id="bongo-country-selector-experimental">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/default/default/template/bongointernational/currency/selector/lightbox.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $current_country = $this->getCurrentCountry ();
4
+
5
+ if (empty ( $current_country )) :
6
+ $countries = $this->getCountries ();
7
+ $current_country = $this->getGeoCountry ();
8
+ $default_country = $this->getDefaultCountry ();
9
+
10
+ if (! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
11
+ ?>
12
+ <div id="bongo_welcome_lightbox" title="Welcome!">
13
+ <div id="bongo_welcome_lightbox_text"><?php
14
+ echo str_replace ( '{COUNTRY}', $countries [$current_country] ['name'], Mage::getStoreConfig ( 'bongointernational_config/currency/welcome_lightbox_contents' ) );
15
+ ?></div>
16
+ <div class="form-language"><select
17
+ onchange="window.location.href=this.value"
18
+ name="bongo-country-selector-lightbox" id="bongo-country-selector-lightbox">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?>
29
+ selected="SELECTED"
30
+ <?php endif;
31
+ ?>>
32
+ <?php
33
+ echo $_country ['name'];
34
+ ?>
35
+ </option>
36
+ <?php
37
+ endforeach
38
+ ;
39
+ ?>
40
+ </select></div>
41
+ </div>
42
+ <script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"><\/script><script>$.noConflict()<\/script>')</script>
43
+ <script type="text/javascript">window.jQuery.ui || document.write('<script type="text/javascript" src="//code.jquery.com/ui/1.11.1/jquery-ui.min.js"><\/script><link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/south-street/jquery-ui.css" />')</script>
44
+ <script type="text/javascript">
45
+ <!--
46
+ jQuery( document ).ready(function( $ ) {
47
+ function setCountry() {
48
+ window.location.href=$('#bongo-country-selector-lightbox').val();
49
+ $( "#bongo_welcome_lightbox" ).dialog( "close" )
50
+ }
51
+
52
+ $( "#bongo_welcome_lightbox" ).dialog({
53
+ modal: true,
54
+ buttons: {
55
+ Ok: setCountry
56
+ },
57
+ close: setCountry
58
+ });
59
+ });
60
+ // -->
61
+ </script>
62
+ <?php endif;
63
+ ?>
64
+ <?php endif;
65
+ ?>
66
+ <?php endif;
67
+ ?>
app/design/frontend/default/default/template/bongointernational/extend/code.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php /*if ($this->getIsEnabled()): ?>
2
+ <?php echo $this->getExtendCode(); ?>
3
+ <?php endif;*/ ?>
app/design/frontend/enterprise/default/layout/bongointernational.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <!-- <block type="bongointernational/extend_code" name="default.bongointernational.extend.code" output="toHtml" template="bongointernational/extend/code.phtml" before="-" /> -->
6
+ <block type="bongointernational/currency_selector_lightbox" name="default.bongointernational.currency.selector.lightbox" output="toHtml" template="bongointernational/currency/selector/lightbox.phtml" before="-" />
7
+ </reference>
8
+ <reference name="header">
9
+ <!-- <block type="bongointernational/currency_selector_default" name="default.bongointernational.currency.selector.default" template="bongointernational/currency/selector/default.phtml" before="-" /> -->
10
+ <block type="core/text_list" name="store_language" as="store_language">
11
+ <block type="page/switch" name="store_language_standard" as="store_language_standard" template="page/switch/languages.phtml"/>
12
+ <block type="bongointernational/currency_selector_experimental" name="default.bongointernational.currency.selector.experimental" template="bongointernational/currency/selector/experimental.phtml" after="store_language_standard" />
13
+ </block>
14
+ </reference>
15
+ </default>
16
+
17
+ <checkout_cart_index>
18
+ <reference name="checkout.cart.top_methods">
19
+ <block type="bongointernational/checkout_link" name="checkout.cart.methods.bongointernational.checkout.top" template="bongointernational/checkout/link.phtml" before="-"/>
20
+ </reference>
21
+
22
+ <reference name="checkout.cart.methods">
23
+ <block type="bongointernational/checkout_link" after="checkout.cart.methods.onepage" name="checkout.cart.methods.bongointernational.checkout.bottom" template="bongointernational/checkout/link.phtml"/>
24
+ </reference>
25
+
26
+ <reference name="before_body_end">
27
+ <block type="bongointernational/checkout_form" name="checkout.cart.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
28
+ </reference>
29
+ </checkout_cart_index>
30
+
31
+ <checkout_onepage_shippingmethod>
32
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
33
+ <block type="bongointernational/checkout_redirect" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.redirect" output="toHtml" template="bongointernational/checkout/redirect.phtml" />
34
+ </checkout_onepage_shippingmethod>
35
+
36
+ <onestepcheckout_index_index>
37
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
38
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
39
+ <block type="bongointernational/compatibility_checkout_onestepcheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.onestepcheckout" output="toHtml" template="bongointernational/compatibility/checkout/onestepcheckout.phtml" />
40
+ </onestepcheckout_index_index>
41
+
42
+ <firecheckout_index_index>
43
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
44
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
45
+ <block type="bongointernational/compatibility_checkout_firecheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.firecheckout" output="toHtml" template="bongointernational/compatibility/checkout/firecheckout.phtml" />
46
+ </firecheckout_index_index>
47
+
48
+ <sales_order_view>
49
+ <reference name="order_totals">
50
+ <block type="bongointernational/sales_order_totals" />
51
+ </reference>
52
+ </sales_order_view>
53
+ <sales_order_invoice>
54
+ <reference name="order_totals">
55
+ <block type="bongointernational/sales_order_totals" />
56
+ </reference>
57
+ </sales_order_invoice>
58
+ <sales_order_creditmemo>
59
+ <reference name="order_totals">
60
+ <block type="bongointernational/sales_order_totals" />
61
+ </reference>
62
+ </sales_order_creditmemo>
63
+ <sales_order_print>
64
+ <reference name="order_totals">
65
+ <block type="bongointernational/sales_order_totals" />
66
+ </reference>
67
+ </sales_order_print>
68
+ <sales_order_printinvoice>
69
+ <reference name="order_totals">
70
+ <block type="bongointernational/sales_order_totals" />
71
+ </reference>
72
+ </sales_order_printinvoice>
73
+ <sales_order_printcreditmemo>
74
+ <reference name="order_totals">
75
+ <block type="bongointernational/sales_order_totals" />
76
+ </reference>
77
+ </sales_order_printcreditmemo>
78
+ <sales_email_order_items>
79
+ <reference name="order_totals">
80
+ <block type="bongointernational/sales_order_totals" />
81
+ </reference>
82
+ </sales_email_order_items>
83
+ <sales_email_order_invoice_items>
84
+ <reference name="order_totals">
85
+ <block type="bongointernational/sales_order_totals" />
86
+ </reference>
87
+ </sales_email_order_invoice_items>
88
+ <sales_email_order_creditmemo_items>
89
+ <reference name="order_totals">
90
+ <block type="bongointernational/sales_order_totals" />
91
+ </reference>
92
+ </sales_email_order_creditmemo_items>
93
+ </layout>
app/design/frontend/enterprise/default/template/bongointernational/checkout/form.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ ?>
4
+ <div id="bongo_form_div">
5
+ <form id="bongo_form" action="<?php
6
+ echo $this->getCheckoutUrl ();
7
+ ?>" method="post">
8
+ <input type="hidden" name="TOTAL_DOMESTIC_SHIPPING_CHARGE"
9
+ value="<?php
10
+ echo $this->getDomesticShipping ();
11
+ ?>" />
12
+ <input type="hidden" name="PARTNER_KEY"
13
+ value="<?php
14
+ echo $this->getApiKey ();
15
+ ?>">
16
+ <input type="hidden" name="CUSTOM_ORDER_1"
17
+ value="<?php
18
+ echo $this->getQuoteId ();
19
+ ?>">
20
+ <input type="hidden" name="CUSTOM_ORDER_2" value="<?php echo $this->getCustomerId(); ?>" />
21
+ <input type="hidden" name="CUSTOM_ORDER_3" value="" />
22
+ <?php if ($this->getItems()): ?>
23
+ <?php $i=0; foreach ($this->getItems() as $item): $i++; ?>
24
+ <input type="hidden" name="PRODUCT_ID_<?php echo $i; ?>" value="<?php echo $item->getSku(); ?>" />
25
+ <input type="hidden" name="PRODUCT_NAME_<?php echo $i; ?>" value="<?php echo $item->getName(); ?>" />
26
+ <input type="hidden" name="PRODUCT_PRICE_<?php echo $i; ?>" value="<?php echo $item->getPrice (); ?>" />
27
+ <input type="hidden" name="PRODUCT_Q_<?php echo $i; ?>" value="<?php echo $item->getQty(); ?>" />
28
+ <input type="hidden" name="PRODUCT_SHIPPING_<?php echo $i; ?>" value="0.00" />
29
+ <?php $split_options = ''; $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()); ?>
30
+ <?php if (isset($options['options']) && count($options['options'])>0): ?>
31
+ <?php $o=0; foreach ($options['options'] as $option): ?>
32
+ <?php if (empty($option['label']) && empty($option['value'])) { continue; } ?>
33
+ <?php $split_options .= "{$option['label']}: {$option['value']}; "; ?>
34
+ <?php endforeach; ?>
35
+ <?php endif; ?>
36
+ <?php endforeach; ?>
37
+ <?php endif; ?>
38
+ <?php $split_options = !empty($split_options) ? str_split(strip_tags(substr($split_options, 0, -2)), 330) : array(); ?>
39
+ <?php if (!empty($split_options[0])): ?>
40
+ <input type="hidden" name="PRODUCT_CUSTOM_1_<?php echo $i; ?>" value="<?php echo $split_options[0]; ?>" />
41
+ <?php endif; ?>
42
+ <?php if (!empty($split_options[1])): ?>
43
+ <input type="hidden" name="PRODUCT_CUSTOM_2_<?php echo $i; ?>" value="<?php echo $split_options[1]; ?>" />
44
+ <?php endif; ?>
45
+ <input type="hidden" name="ORDER_CURRENCY" value="<?php echo $this->getCurrencyCode(); ?>" />
46
+ <input type="hidden" name="CUST_FIRST_NAME" value="<?php echo $this->getBillingAddress()->getFirstname(); ?>" />
47
+ <input type="hidden" name="CUST_LAST_NAME" value="<?php echo $this->getBillingAddress()->getLastname(); ?>" />
48
+ <input type="hidden" name="CUST_COMPANY" value="<?php echo $this->getBillingAddress()->getCompany(); ?>" />
49
+ <input type="hidden" name="CUST_ADDRESS_LINE_1" value="<?php echo $this->getBillingAddress()->getStreet(1); ?>" />
50
+ <input type="hidden" name="CUST_ADDRESS_LINE_2" value="<?php echo $this->getBillingAddress()->getStreet(2); ?>" />
51
+ <input type="hidden" name="CUST_CITY" value="<?php echo $this->getBillingAddress()->getCity(); ?>" />
52
+ <input type="hidden" name="CUST_STATE" value="<?php echo $this->getBillingRegion(); ?>" />
53
+ <input type="hidden" name="CUST_COUNTRY" value="<?php echo $this->getBillingAddress()->getCountryId(); ?>" />
54
+ <input type="hidden" name="CUST_ZIP" value="<?php echo $this->getBillingAddress()->getPostcode(); ?>" />
55
+ <input type="hidden" name="CUST_PHONE" value="<?php echo $this->getBillingAddress()->getTelephone(); ?>" />
56
+ <input type="hidden" name="CUST_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
57
+ <input type="hidden" name="SHIP_FIRST_NAME" value="<?php echo $this->getShippingAddress()->getFirstname(); ?>" />
58
+ <input type="hidden" name="SHIP_LAST_NAME" value="<?php echo $this->getShippingAddress()->getLastname(); ?>" />
59
+ <input type="hidden" name="SHIP_COMPANY" value="<?php echo $this->getShippingAddress()->getCompany(); ?>" />
60
+ <input type="hidden" name="SHIP_ADDRESS_LINE_1" value="<?php echo $this->getShippingAddress()->getStreet(1); ?>" />
61
+ <input type="hidden" name="SHIP_ADDRESS_LINE_2" value="<?php echo $this->getShippingAddress()->getStreet(2); ?>" />
62
+ <input type="hidden" name="SHIP_CITY" value="<?php echo $this->getShippingAddress()->getCity(); ?>" />
63
+ <input type="hidden" name="SHIP_STATE" value="<?php echo $this->getShippingRegion(); ?>" />
64
+ <input type="hidden" name="SHIP_COUNTRY" value="<?php echo $this->getShippingCountry(); ?>" />
65
+ <input type="hidden" name="SHIP_ZIP" value="<?php echo $this->getShippingAddress()->getPostcode(); ?>" />
66
+ <input type="hidden" name="SHIP_PHONE" value="<?php echo $this->getShippingAddress()->getTelephone(); ?>" />
67
+ <input type="hidden" name="SHIP_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
68
+ <input type="hidden" name="SUB" value="SUBMIT ORDER" />
69
+ </form>
70
+ </div>
71
+ <script type="text/javascript">
72
+ //<![CDATA[
73
+ function bongoRedirect () {
74
+ $('bongo_form').submit();
75
+ }
76
+ //]]>
77
+ </script>
78
+
79
+ <?php endif;
80
+ ?>
app/design/frontend/enterprise/default/template/bongointernational/checkout/link.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <input type="image" src="https://bongous.com/partner/images/Bongo_Checkout_Button.png" onclick="bongoRedirect()" />
3
+ <?php endif; ?>
app/design/frontend/enterprise/default/template/bongointernational/checkout/redirect.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var bongo_html = '<form id="bongo_form" action="<?php echo $this->getCheckoutUrl (); ?>" method="post">'+$('bongo_form_div').innerHTML+'</form>';
5
+ $('bongo_form_div').remove();
6
+ $('checkout-step-shipping_method').insert({'bottom':bongo_html});
7
+ $$('#shipping-method-buttons-container button').first().observe('click', function() {
8
+ $('bongo_form').submit();
9
+ });
10
+ //]]>
11
+ </script>
12
+ <?php endif; ?>
app/design/frontend/enterprise/default/template/bongointernational/compatibility/checkout.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var __bongo_allowed_countries = <?php echo json_encode ( $this->getAllowedCountries () ); ?>
5
+
6
+ Element.prototype.triggerEvent = function(eventName)
7
+ {
8
+ if (document.createEvent)
9
+ {
10
+ var evt = document.createEvent('HTMLEvents');
11
+ evt.initEvent(eventName, true, true);
12
+
13
+ return this.dispatchEvent(evt);
14
+ }
15
+
16
+ if (this.fireEvent)
17
+ return this.fireEvent('on' + eventName);
18
+ }
19
+ //]]>
20
+ </script>
21
+ <?php endif; ?>
app/design/frontend/enterprise/default/template/bongointernational/compatibility/checkout/firecheckout.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ padding:5px 10px;
6
+ font-weight:bold;
7
+ }
8
+ -->
9
+ </style>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ var __bongo_hide_checkout_review_int;
13
+
14
+ function bongoHideCheckoutReview(direct) {
15
+ if (direct != true && checkout.loadWaiting != undefined && checkout.loadWaiting == true) {
16
+ return false;
17
+ }
18
+
19
+ if ($('payment-method-review') != undefined) {
20
+ $('payment-method-review').hide();
21
+ }
22
+
23
+ var last_total = $$('#checkout-review-table tfoot tr').last();
24
+
25
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
26
+ last_total.hide();
27
+ }
28
+ }
29
+
30
+ function bongoUpdateCheckout() {
31
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
32
+
33
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
34
+ if ($('bongo_checkout_payment_method_load') != undefined) {
35
+ $('bongo_checkout_payment_method_load').show();
36
+ } else {
37
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
38
+ }
39
+
40
+ $('checkout-payment-method-load').hide();
41
+
42
+ if ($('checkout-coupon-discount-load') != undefined) {
43
+ $('checkout-coupon-discount-load').hide();
44
+ }
45
+
46
+ if ($('checkout-additional') != undefined) {
47
+ $('checkout-additional').hide();
48
+ $$('#checkout-review div.block-title span.num').first().update('4');
49
+ }
50
+
51
+ bongoHideCheckoutReview(true);
52
+
53
+ __bongo_hide_checkout_review_int = setInterval(bongoHideCheckoutReview, 500);
54
+
55
+ return false;
56
+ } else {
57
+ if ($('bongo_checkout_payment_method_load') != undefined) {
58
+ $('bongo_checkout_payment_method_load').hide();
59
+ }
60
+
61
+ $('checkout-payment-method-load').show();
62
+
63
+ if ($('checkout-coupon-discount-load') != undefined) {
64
+ $('checkout-coupon-discount-load').show();
65
+ }
66
+
67
+ if ($('checkout-additional') != undefined) {
68
+ $('checkout-additional').show();
69
+ $$('div#checkout-review div.block-title span.num').first().update('5');
70
+ }
71
+
72
+ if ($('payment-method-review') != undefined) {
73
+ $('payment-method-review').hide();
74
+ }
75
+
76
+ var last_total = $$('#checkout-review-table tfoot tr').last();
77
+
78
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
79
+ last_total.show();
80
+ }
81
+
82
+ clearInterval(__bongo_hide_checkout_review_int);
83
+ }
84
+ }
85
+
86
+ if ($('firecheckout-form') != undefined && $('bongo_form') != undefined) {
87
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
88
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
89
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
90
+
91
+ bongoUpdateCheckout();
92
+
93
+ $$('#review-buttons-container button').first().writeAttribute('onclick', null);
94
+ $$('#review-buttons-container button').first().observe('click', function() {
95
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
96
+
97
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
98
+ $('bongo_form').submit();
99
+
100
+ return false;
101
+ } else {
102
+ checkout.save();
103
+ }
104
+
105
+ return false;
106
+ });
107
+ }
108
+ //]]>
109
+ </script>
110
+ <?php endif; ?>
app/design/frontend/enterprise/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ font-weight:bold;
6
+ }
7
+ -->
8
+ </style>
9
+ <script type="text/javascript">
10
+ //<![CDATA[
11
+ var __bongo_hide_checkout_review_int = setInterval(bongoUpdateCheckout, 500);
12
+
13
+ function bongoUpdateCheckout() {
14
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
15
+
16
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
17
+ if ($('bongo_checkout_payment_method_load') != undefined) {
18
+ $('bongo_checkout_payment_method_load').show();
19
+ } else if ($('checkout-payment-method-load') != undefined) {
20
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
21
+ }
22
+
23
+ if ($('checkout-payment-method-load') != undefined) {
24
+ $('checkout-payment-method-load').hide();
25
+ }
26
+
27
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
28
+ $$('div.onestepcheckout-coupons').first().hide();
29
+ }
30
+
31
+ if ($('onestepcheckout-giftmessages') != undefined) {
32
+ $('onestepcheckout-giftmessages').hide();
33
+ }
34
+
35
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
36
+ $$('div.onestepcheckout-feedback').first().hide();
37
+ }
38
+
39
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
40
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().hide();
41
+ }
42
+
43
+ return false;
44
+ } else {
45
+ if ($('bongo_checkout_payment_method_load') != undefined) {
46
+ $('bongo_checkout_payment_method_load').hide();
47
+ }
48
+
49
+ if ($('checkout-payment-method-load') != undefined) {
50
+ $('checkout-payment-method-load').show();
51
+ }
52
+
53
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
54
+ $$('div.onestepcheckout-coupons').first().show();
55
+ }
56
+
57
+ if ($('onestepcheckout-giftmessages') != undefined) {
58
+ $('onestepcheckout-giftmessages').show();
59
+ }
60
+
61
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
62
+ $$('div.onestepcheckout-feedback').first().show();
63
+ }
64
+
65
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
66
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().show();
67
+ }
68
+ }
69
+ }
70
+
71
+ if ($('onestepcheckout-form') != undefined && $('bongo_form') != undefined) {
72
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
73
+ $('billing:use_for_shipping_yes').observe('change', bongoUpdateCheckout);
74
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
75
+
76
+ if ($('shipping:same_as_billing') != undefined) {
77
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
78
+ }
79
+
80
+ bongoUpdateCheckout();
81
+
82
+ $$('div.onestepcheckout-place-order').first().update($$('div.onestepcheckout-place-order').first().innerHTML+$$('div.onestepcheckout-place-order').first().innerHTML);
83
+ $$('div.onestepcheckout-place-order button').first().setAttribute('id','bongo-onestepcheckout-place-order');
84
+ $('onestepcheckout-place-order').hide();
85
+ $('bongo-onestepcheckout-place-order').observe('click', function() {
86
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
87
+
88
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
89
+ $('bongo_form').submit();
90
+
91
+ return false;
92
+ } else {
93
+ $('onestepcheckout-place-order').triggerEvent('click');
94
+ }
95
+
96
+ return false;
97
+ });
98
+ }
99
+ //]]>
100
+ </script>
101
+ <?php endif; ?>
app/design/frontend/enterprise/default/template/bongointernational/currency/selector/default.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-default"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-default"
18
+ id="bongo-country-selector-default">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/enterprise/default/template/bongointernational/currency/selector/experimental.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-experimental"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-experimental"
18
+ id="bongo-country-selector-experimental">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/enterprise/default/template/bongointernational/currency/selector/lightbox.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $current_country = $this->getCurrentCountry ();
4
+
5
+ if (empty ( $current_country )) :
6
+ $countries = $this->getCountries ();
7
+ $current_country = $this->getGeoCountry ();
8
+ $default_country = $this->getDefaultCountry ();
9
+
10
+ if (! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
11
+ ?>
12
+ <div id="bongo_welcome_lightbox" title="Welcome!">
13
+ <div id="bongo_welcome_lightbox_text"><?php
14
+ echo str_replace ( '{COUNTRY}', $countries [$current_country] ['name'], Mage::getStoreConfig ( 'bongointernational_config/currency/welcome_lightbox_contents' ) );
15
+ ?></div>
16
+ <div class="form-language"><select
17
+ onchange="window.location.href=this.value"
18
+ name="bongo-country-selector-lightbox" id="bongo-country-selector-lightbox">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?>
29
+ selected="SELECTED"
30
+ <?php endif;
31
+ ?>>
32
+ <?php
33
+ echo $_country ['name'];
34
+ ?>
35
+ </option>
36
+ <?php
37
+ endforeach
38
+ ;
39
+ ?>
40
+ </select></div>
41
+ </div>
42
+ <script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"><\/script><script>$.noConflict()<\/script>')</script>
43
+ <script type="text/javascript">window.jQuery.ui || document.write('<script type="text/javascript" src="//code.jquery.com/ui/1.11.1/jquery-ui.min.js"><\/script><link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/south-street/jquery-ui.css" />')</script>
44
+ <script type="text/javascript">
45
+ <!--
46
+ jQuery( document ).ready(function( $ ) {
47
+ function setCountry() {
48
+ window.location.href=$('#bongo-country-selector-lightbox').val();
49
+ $( "#bongo_welcome_lightbox" ).dialog( "close" )
50
+ }
51
+
52
+ $( "#bongo_welcome_lightbox" ).dialog({
53
+ modal: true,
54
+ buttons: {
55
+ Ok: setCountry
56
+ },
57
+ close: setCountry
58
+ });
59
+ });
60
+ // -->
61
+ </script>
62
+ <?php endif;
63
+ ?>
64
+ <?php endif;
65
+ ?>
66
+ <?php endif;
67
+ ?>
app/design/frontend/enterprise/default/template/bongointernational/extend/code.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php /*if ($this->getIsEnabled()): ?>
2
+ <?php echo $this->getExtendCode(); ?>
3
+ <?php endif;*/ ?>
app/design/frontend/rwd/default/layout/bongointernational.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <!-- <block type="bongointernational/extend_code" name="default.bongointernational.extend.code" output="toHtml" template="bongointernational/extend/code.phtml" before="-" /> -->
6
+ <block type="bongointernational/currency_selector_lightbox" name="default.bongointernational.currency.selector.lightbox" output="toHtml" template="bongointernational/currency/selector/lightbox.phtml" before="-" />
7
+ </reference>
8
+ <reference name="header">
9
+ <!-- <block type="bongointernational/currency_selector_default" name="default.bongointernational.currency.selector.default" template="bongointernational/currency/selector/default.phtml" before="-" /> -->
10
+ <block type="core/text_list" name="store_language" as="store_language">
11
+ <block type="page/switch" name="store_language_standard" as="store_language_standard" template="page/switch/languages.phtml"/>
12
+ <block type="bongointernational/currency_selector_experimental" name="default.bongointernational.currency.selector.experimental" template="bongointernational/currency/selector/experimental.phtml" after="store_language_standard" />
13
+ </block>
14
+ </reference>
15
+ </default>
16
+
17
+ <checkout_cart_index>
18
+ <reference name="checkout.cart.top_methods">
19
+ <block type="bongointernational/checkout_link" name="checkout.cart.methods.bongointernational.checkout.top" template="bongointernational/checkout/link.phtml" before="-"/>
20
+ </reference>
21
+
22
+ <reference name="checkout.cart.methods">
23
+ <block type="bongointernational/checkout_link" after="checkout.cart.methods.onepage" name="checkout.cart.methods.bongointernational.checkout.bottom" template="bongointernational/checkout/link.phtml"/>
24
+ </reference>
25
+
26
+ <reference name="before_body_end">
27
+ <block type="bongointernational/checkout_form" name="checkout.cart.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
28
+ </reference>
29
+ </checkout_cart_index>
30
+
31
+ <checkout_onepage_shippingmethod>
32
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
33
+ <block type="bongointernational/checkout_redirect" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.redirect" output="toHtml" template="bongointernational/checkout/redirect.phtml" />
34
+ </checkout_onepage_shippingmethod>
35
+
36
+ <onestepcheckout_index_index>
37
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
38
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
39
+ <block type="bongointernational/compatibility_checkout_onestepcheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.onestepcheckout" output="toHtml" template="bongointernational/compatibility/checkout/onestepcheckout.phtml" />
40
+ </onestepcheckout_index_index>
41
+
42
+ <firecheckout_index_index>
43
+ <block type="bongointernational/checkout_form" name="checkout.onepage.shipping_method.bongointernational.checkout.form" output="toHtml" template="bongointernational/checkout/form.phtml" before="-" />
44
+ <block type="bongointernational/compatibility_checkout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility" output="toHtml" template="bongointernational/compatibility/checkout.phtml" />
45
+ <block type="bongointernational/compatibility_checkout_firecheckout" after="checkout.onepage.shipping_method.bongointernational.checkout.form" name="checkout.onepage.shipping_method.bongointernational.compatibility.firecheckout" output="toHtml" template="bongointernational/compatibility/checkout/firecheckout.phtml" />
46
+ </firecheckout_index_index>
47
+
48
+ <sales_order_view>
49
+ <reference name="order_totals">
50
+ <block type="bongointernational/sales_order_totals" />
51
+ </reference>
52
+ </sales_order_view>
53
+ <sales_order_invoice>
54
+ <reference name="order_totals">
55
+ <block type="bongointernational/sales_order_totals" />
56
+ </reference>
57
+ </sales_order_invoice>
58
+ <sales_order_creditmemo>
59
+ <reference name="order_totals">
60
+ <block type="bongointernational/sales_order_totals" />
61
+ </reference>
62
+ </sales_order_creditmemo>
63
+ <sales_order_print>
64
+ <reference name="order_totals">
65
+ <block type="bongointernational/sales_order_totals" />
66
+ </reference>
67
+ </sales_order_print>
68
+ <sales_order_printinvoice>
69
+ <reference name="order_totals">
70
+ <block type="bongointernational/sales_order_totals" />
71
+ </reference>
72
+ </sales_order_printinvoice>
73
+ <sales_order_printcreditmemo>
74
+ <reference name="order_totals">
75
+ <block type="bongointernational/sales_order_totals" />
76
+ </reference>
77
+ </sales_order_printcreditmemo>
78
+ <sales_email_order_items>
79
+ <reference name="order_totals">
80
+ <block type="bongointernational/sales_order_totals" />
81
+ </reference>
82
+ </sales_email_order_items>
83
+ <sales_email_order_invoice_items>
84
+ <reference name="order_totals">
85
+ <block type="bongointernational/sales_order_totals" />
86
+ </reference>
87
+ </sales_email_order_invoice_items>
88
+ <sales_email_order_creditmemo_items>
89
+ <reference name="order_totals">
90
+ <block type="bongointernational/sales_order_totals" />
91
+ </reference>
92
+ </sales_email_order_creditmemo_items>
93
+ </layout>
app/design/frontend/rwd/default/template/bongointernational/checkout/form.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ ?>
4
+ <div id="bongo_form_div">
5
+ <form id="bongo_form" action="<?php
6
+ echo $this->getCheckoutUrl ();
7
+ ?>" method="post">
8
+ <input type="hidden" name="TOTAL_DOMESTIC_SHIPPING_CHARGE"
9
+ value="<?php
10
+ echo $this->getDomesticShipping ();
11
+ ?>" />
12
+ <input type="hidden" name="PARTNER_KEY"
13
+ value="<?php
14
+ echo $this->getApiKey ();
15
+ ?>">
16
+ <input type="hidden" name="CUSTOM_ORDER_1"
17
+ value="<?php
18
+ echo $this->getQuoteId ();
19
+ ?>">
20
+ <input type="hidden" name="CUSTOM_ORDER_2" value="<?php echo $this->getCustomerId(); ?>" />
21
+ <input type="hidden" name="CUSTOM_ORDER_3" value="" />
22
+ <?php if ($this->getItems()): ?>
23
+ <?php $i=0; foreach ($this->getItems() as $item): $i++; ?>
24
+ <input type="hidden" name="PRODUCT_ID_<?php echo $i; ?>" value="<?php echo $item->getSku(); ?>" />
25
+ <input type="hidden" name="PRODUCT_NAME_<?php echo $i; ?>" value="<?php echo $item->getName(); ?>" />
26
+ <input type="hidden" name="PRODUCT_PRICE_<?php echo $i; ?>" value="<?php echo $item->getPrice (); ?>" />
27
+ <input type="hidden" name="PRODUCT_Q_<?php echo $i; ?>" value="<?php echo $item->getQty(); ?>" />
28
+ <input type="hidden" name="PRODUCT_SHIPPING_<?php echo $i; ?>" value="0.00" />
29
+ <?php $split_options = ''; $options = $item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()); ?>
30
+ <?php if (isset($options['options']) && count($options['options'])>0): ?>
31
+ <?php $o=0; foreach ($options['options'] as $option): ?>
32
+ <?php if (empty($option['label']) && empty($option['value'])) { continue; } ?>
33
+ <?php $split_options .= "{$option['label']}: {$option['value']}; "; ?>
34
+ <?php endforeach; ?>
35
+ <?php endif; ?>
36
+ <?php endforeach; ?>
37
+ <?php endif; ?>
38
+ <?php $split_options = !empty($split_options) ? str_split(strip_tags(substr($split_options, 0, -2)), 330) : array(); ?>
39
+ <?php if (!empty($split_options[0])): ?>
40
+ <input type="hidden" name="PRODUCT_CUSTOM_1_<?php echo $i; ?>" value="<?php echo $split_options[0]; ?>" />
41
+ <?php endif; ?>
42
+ <?php if (!empty($split_options[1])): ?>
43
+ <input type="hidden" name="PRODUCT_CUSTOM_2_<?php echo $i; ?>" value="<?php echo $split_options[1]; ?>" />
44
+ <?php endif; ?>
45
+ <input type="hidden" name="ORDER_CURRENCY" value="<?php echo $this->getCurrencyCode(); ?>" />
46
+ <input type="hidden" name="CUST_FIRST_NAME" value="<?php echo $this->getBillingAddress()->getFirstname(); ?>" />
47
+ <input type="hidden" name="CUST_LAST_NAME" value="<?php echo $this->getBillingAddress()->getLastname(); ?>" />
48
+ <input type="hidden" name="CUST_COMPANY" value="<?php echo $this->getBillingAddress()->getCompany(); ?>" />
49
+ <input type="hidden" name="CUST_ADDRESS_LINE_1" value="<?php echo $this->getBillingAddress()->getStreet(1); ?>" />
50
+ <input type="hidden" name="CUST_ADDRESS_LINE_2" value="<?php echo $this->getBillingAddress()->getStreet(2); ?>" />
51
+ <input type="hidden" name="CUST_CITY" value="<?php echo $this->getBillingAddress()->getCity(); ?>" />
52
+ <input type="hidden" name="CUST_STATE" value="<?php echo $this->getBillingRegion(); ?>" />
53
+ <input type="hidden" name="CUST_COUNTRY" value="<?php echo $this->getBillingAddress()->getCountryId(); ?>" />
54
+ <input type="hidden" name="CUST_ZIP" value="<?php echo $this->getBillingAddress()->getPostcode(); ?>" />
55
+ <input type="hidden" name="CUST_PHONE" value="<?php echo $this->getBillingAddress()->getTelephone(); ?>" />
56
+ <input type="hidden" name="CUST_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
57
+ <input type="hidden" name="SHIP_FIRST_NAME" value="<?php echo $this->getShippingAddress()->getFirstname(); ?>" />
58
+ <input type="hidden" name="SHIP_LAST_NAME" value="<?php echo $this->getShippingAddress()->getLastname(); ?>" />
59
+ <input type="hidden" name="SHIP_COMPANY" value="<?php echo $this->getShippingAddress()->getCompany(); ?>" />
60
+ <input type="hidden" name="SHIP_ADDRESS_LINE_1" value="<?php echo $this->getShippingAddress()->getStreet(1); ?>" />
61
+ <input type="hidden" name="SHIP_ADDRESS_LINE_2" value="<?php echo $this->getShippingAddress()->getStreet(2); ?>" />
62
+ <input type="hidden" name="SHIP_CITY" value="<?php echo $this->getShippingAddress()->getCity(); ?>" />
63
+ <input type="hidden" name="SHIP_STATE" value="<?php echo $this->getShippingRegion(); ?>" />
64
+ <input type="hidden" name="SHIP_COUNTRY" value="<?php echo $this->getShippingCountry(); ?>" />
65
+ <input type="hidden" name="SHIP_ZIP" value="<?php echo $this->getShippingAddress()->getPostcode(); ?>" />
66
+ <input type="hidden" name="SHIP_PHONE" value="<?php echo $this->getShippingAddress()->getTelephone(); ?>" />
67
+ <input type="hidden" name="SHIP_EMAIL" value="<?php echo $this->getCustomerEmail(); ?>" />
68
+ <input type="hidden" name="SUB" value="SUBMIT ORDER" />
69
+ </form>
70
+ </div>
71
+ <script type="text/javascript">
72
+ //<![CDATA[
73
+ function bongoRedirect () {
74
+ $('bongo_form').submit();
75
+ }
76
+ //]]>
77
+ </script>
78
+
79
+ <?php endif;
80
+ ?>
app/design/frontend/rwd/default/template/bongointernational/checkout/link.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <input type="image" src="https://bongous.com/partner/images/Bongo_Checkout_Button.png" onclick="bongoRedirect()" />
3
+ <?php endif; ?>
app/design/frontend/rwd/default/template/bongointernational/checkout/redirect.phtml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled()): ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var bongo_html = '<form id="bongo_form" action="<?php echo $this->getCheckoutUrl (); ?>" method="post">'+$('bongo_form_div').innerHTML+'</form>';
5
+ $('bongo_form_div').remove();
6
+ $('checkout-step-shipping_method').insert({'bottom':bongo_html});
7
+ $$('#shipping-method-buttons-container button').first().observe('click', function() {
8
+ $('bongo_form').submit();
9
+ });
10
+ //]]>
11
+ </script>
12
+ <?php endif; ?>
app/design/frontend/rwd/default/template/bongointernational/compatibility/checkout.phtml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var __bongo_allowed_countries = <?php echo json_encode ( $this->getAllowedCountries () ); ?>
5
+
6
+ Element.prototype.triggerEvent = function(eventName)
7
+ {
8
+ if (document.createEvent)
9
+ {
10
+ var evt = document.createEvent('HTMLEvents');
11
+ evt.initEvent(eventName, true, true);
12
+
13
+ return this.dispatchEvent(evt);
14
+ }
15
+
16
+ if (this.fireEvent)
17
+ return this.fireEvent('on' + eventName);
18
+ }
19
+ //]]>
20
+ </script>
21
+ <?php endif; ?>
app/design/frontend/rwd/default/template/bongointernational/compatibility/checkout/firecheckout.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ padding:5px 10px;
6
+ font-weight:bold;
7
+ }
8
+ -->
9
+ </style>
10
+ <script type="text/javascript">
11
+ //<![CDATA[
12
+ var __bongo_hide_checkout_review_int;
13
+
14
+ function bongoHideCheckoutReview(direct) {
15
+ if (direct != true && checkout.loadWaiting != undefined && checkout.loadWaiting == true) {
16
+ return false;
17
+ }
18
+
19
+ if ($('payment-method-review') != undefined) {
20
+ $('payment-method-review').hide();
21
+ }
22
+
23
+ var last_total = $$('#checkout-review-table tfoot tr').last();
24
+
25
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
26
+ last_total.hide();
27
+ }
28
+ }
29
+
30
+ function bongoUpdateCheckout() {
31
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
32
+
33
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
34
+ if ($('bongo_checkout_payment_method_load') != undefined) {
35
+ $('bongo_checkout_payment_method_load').show();
36
+ } else {
37
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
38
+ }
39
+
40
+ $('checkout-payment-method-load').hide();
41
+
42
+ if ($('checkout-coupon-discount-load') != undefined) {
43
+ $('checkout-coupon-discount-load').hide();
44
+ }
45
+
46
+ if ($('checkout-additional') != undefined) {
47
+ $('checkout-additional').hide();
48
+ $$('#checkout-review div.block-title span.num').first().update('4');
49
+ }
50
+
51
+ bongoHideCheckoutReview(true);
52
+
53
+ __bongo_hide_checkout_review_int = setInterval(bongoHideCheckoutReview, 500);
54
+
55
+ return false;
56
+ } else {
57
+ if ($('bongo_checkout_payment_method_load') != undefined) {
58
+ $('bongo_checkout_payment_method_load').hide();
59
+ }
60
+
61
+ $('checkout-payment-method-load').show();
62
+
63
+ if ($('checkout-coupon-discount-load') != undefined) {
64
+ $('checkout-coupon-discount-load').show();
65
+ }
66
+
67
+ if ($('checkout-additional') != undefined) {
68
+ $('checkout-additional').show();
69
+ $$('div#checkout-review div.block-title span.num').first().update('5');
70
+ }
71
+
72
+ if ($('payment-method-review') != undefined) {
73
+ $('payment-method-review').hide();
74
+ }
75
+
76
+ var last_total = $$('#checkout-review-table tfoot tr').last();
77
+
78
+ if (last_total.down('td').innerHTML.search(/total incl/i) != -1) {
79
+ last_total.show();
80
+ }
81
+
82
+ clearInterval(__bongo_hide_checkout_review_int);
83
+ }
84
+ }
85
+
86
+ if ($('firecheckout-form') != undefined && $('bongo_form') != undefined) {
87
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
88
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
89
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
90
+
91
+ bongoUpdateCheckout();
92
+
93
+ $$('#review-buttons-container button').first().writeAttribute('onclick', null);
94
+ $$('#review-buttons-container button').first().observe('click', function() {
95
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && $('shipping:same_as_billing').checked != true ? $('shipping:country_id').value : $('billing:country_id').value;
96
+
97
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
98
+ $('bongo_form').submit();
99
+
100
+ return false;
101
+ } else {
102
+ checkout.save();
103
+ }
104
+
105
+ return false;
106
+ });
107
+ }
108
+ //]]>
109
+ </script>
110
+ <?php endif; ?>
app/design/frontend/rwd/default/template/bongointernational/compatibility/checkout/onestepcheckout.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ($this->getIsEnabled ()) : ?>
2
+ <style type="text/css">
3
+ <!--
4
+ #bongo_checkout_payment_method_load {
5
+ font-weight:bold;
6
+ }
7
+ -->
8
+ </style>
9
+ <script type="text/javascript">
10
+ //<![CDATA[
11
+ var __bongo_hide_checkout_review_int = setInterval(bongoUpdateCheckout, 500);
12
+
13
+ function bongoUpdateCheckout() {
14
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
15
+
16
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
17
+ if ($('bongo_checkout_payment_method_load') != undefined) {
18
+ $('bongo_checkout_payment_method_load').show();
19
+ } else if ($('checkout-payment-method-load') != undefined) {
20
+ $('checkout-payment-method-load').insert({ before: '<div id="bongo_checkout_payment_method_load"><span>Bongo International</span></div>' });
21
+ }
22
+
23
+ if ($('checkout-payment-method-load') != undefined) {
24
+ $('checkout-payment-method-load').hide();
25
+ }
26
+
27
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
28
+ $$('div.onestepcheckout-coupons').first().hide();
29
+ }
30
+
31
+ if ($('onestepcheckout-giftmessages') != undefined) {
32
+ $('onestepcheckout-giftmessages').hide();
33
+ }
34
+
35
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
36
+ $$('div.onestepcheckout-feedback').first().hide();
37
+ }
38
+
39
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
40
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().hide();
41
+ }
42
+
43
+ return false;
44
+ } else {
45
+ if ($('bongo_checkout_payment_method_load') != undefined) {
46
+ $('bongo_checkout_payment_method_load').hide();
47
+ }
48
+
49
+ if ($('checkout-payment-method-load') != undefined) {
50
+ $('checkout-payment-method-load').show();
51
+ }
52
+
53
+ if ($$('div.onestepcheckout-coupons').first() != undefined) {
54
+ $$('div.onestepcheckout-coupons').first().show();
55
+ }
56
+
57
+ if ($('onestepcheckout-giftmessages') != undefined) {
58
+ $('onestepcheckout-giftmessages').show();
59
+ }
60
+
61
+ if ($$('div.onestepcheckout-feedback').first() != undefined) {
62
+ $$('div.onestepcheckout-feedback').first().show();
63
+ }
64
+
65
+ if ($$('div.onestepcheckout-enable-newsletter-bottom').first() != undefined) {
66
+ $$('div.onestepcheckout-enable-newsletter-bottom').first().show();
67
+ }
68
+ }
69
+ }
70
+
71
+ if ($('onestepcheckout-form') != undefined && $('bongo_form') != undefined) {
72
+ $('billing:country_id').observe('change', bongoUpdateCheckout);
73
+ $('billing:use_for_shipping_yes').observe('change', bongoUpdateCheckout);
74
+ $('shipping:country_id').observe('change', bongoUpdateCheckout);
75
+
76
+ if ($('shipping:same_as_billing') != undefined) {
77
+ $('shipping:same_as_billing').observe('change', bongoUpdateCheckout);
78
+ }
79
+
80
+ bongoUpdateCheckout();
81
+
82
+ $$('div.onestepcheckout-place-order').first().update($$('div.onestepcheckout-place-order').first().innerHTML+$$('div.onestepcheckout-place-order').first().innerHTML);
83
+ $$('div.onestepcheckout-place-order button').first().setAttribute('id','bongo-onestepcheckout-place-order');
84
+ $('onestepcheckout-place-order').hide();
85
+ $('bongo-onestepcheckout-place-order').observe('click', function() {
86
+ var country_id = $('shipping:country_id') != undefined && $('shipping:country_id').value != null && (($('shipping:same_as_billing') && $('shipping:same_as_billing').checked != true) || ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked != true)) ? $('shipping:country_id').value : $('billing:country_id').value;
87
+
88
+ if (__bongo_allowed_countries.indexOf(country_id) !== -1) {
89
+ $('bongo_form').submit();
90
+
91
+ return false;
92
+ } else {
93
+ $('onestepcheckout-place-order').triggerEvent('click');
94
+ }
95
+
96
+ return false;
97
+ });
98
+ }
99
+ //]]>
100
+ </script>
101
+ <?php endif; ?>
app/design/frontend/rwd/default/template/bongointernational/currency/selector/default.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-default"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-default"
18
+ id="bongo-country-selector-default">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/rwd/default/template/bongointernational/currency/selector/experimental.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $country_set = true;
4
+ $countries = $this->getCountries ();
5
+ $current_country = $this->getCurrentCountry ();
6
+
7
+ if (empty ( $current_country )) {
8
+ $country_set = false;
9
+ $current_country = $this->getGeoCountry ();
10
+ $default_country = $this->getDefaultCountry ();
11
+ }
12
+ ?>
13
+ <div class="form-language"><label
14
+ for="bongo-country-selector-experimental"><?php
15
+ echo $this->__ ( 'Ship To:' )?></label> <select
16
+ onchange="window.location.href=this.value"
17
+ name="bongo-country-selector-experimental"
18
+ id="bongo-country-selector-experimental">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?> selected="SELECTED"
29
+ <?php endif;
30
+ ?>>
31
+ <?php
32
+ echo $_country ['name'];
33
+ ?>
34
+ </option>
35
+ <?php
36
+ endforeach
37
+ ;
38
+ ?>
39
+ </select></div>
40
+ <?php
41
+ if (! $country_set && $this->getIsGeoEnabled () && ! $this->getIsLightboxEnabled () && ! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
42
+ ?>
43
+ <script type="text/javascript">
44
+ <!--
45
+ window.location.href="<?php
46
+ echo $this->getCountrySwitchUrl ( $current_country, $countries [$current_country] );
47
+ ?>";
48
+ // -->
49
+ </script>
50
+ <?php
51
+ endif;
52
+ endif;
53
+ ?>
app/design/frontend/rwd/default/template/bongointernational/currency/selector/lightbox.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($this->getIsEnabled ()) :
3
+ $current_country = $this->getCurrentCountry ();
4
+
5
+ if (empty ( $current_country )) :
6
+ $countries = $this->getCountries ();
7
+ $current_country = $this->getGeoCountry ();
8
+ $default_country = $this->getDefaultCountry ();
9
+
10
+ if (! empty ( $current_country ) && $current_country !== $default_country && array_key_exists ( $current_country, $countries )) :
11
+ ?>
12
+ <div id="bongo_welcome_lightbox" title="Welcome!">
13
+ <div id="bongo_welcome_lightbox_text"><?php
14
+ echo str_replace ( '{COUNTRY}', $countries [$current_country] ['name'], Mage::getStoreConfig ( 'bongointernational_config/currency/welcome_lightbox_contents' ) );
15
+ ?></div>
16
+ <div class="form-language"><select
17
+ onchange="window.location.href=this.value"
18
+ name="bongo-country-selector-lightbox" id="bongo-country-selector-lightbox">
19
+ <?php
20
+ foreach ( $countries as $_code => $_country ) :
21
+ ?>
22
+ <option
23
+ value="<?php
24
+ echo $this->getCountrySwitchUrl ( $_code, $_country );
25
+ ?>"
26
+ <?php
27
+ if ($_code == $current_country) :
28
+ ?>
29
+ selected="SELECTED"
30
+ <?php endif;
31
+ ?>>
32
+ <?php
33
+ echo $_country ['name'];
34
+ ?>
35
+ </option>
36
+ <?php
37
+ endforeach
38
+ ;
39
+ ?>
40
+ </select></div>
41
+ </div>
42
+ <script type="text/javascript">window.jQuery || document.write('<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"><\/script><script>$.noConflict()<\/script>')</script>
43
+ <script type="text/javascript">window.jQuery.ui || document.write('<script type="text/javascript" src="//code.jquery.com/ui/1.11.1/jquery-ui.min.js"><\/script><link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/south-street/jquery-ui.css" />')</script>
44
+ <script type="text/javascript">
45
+ <!--
46
+ jQuery( document ).ready(function( $ ) {
47
+ function setCountry() {
48
+ window.location.href=$('#bongo-country-selector-lightbox').val();
49
+ $( "#bongo_welcome_lightbox" ).dialog( "close" )
50
+ }
51
+
52
+ $( "#bongo_welcome_lightbox" ).dialog({
53
+ modal: true,
54
+ buttons: {
55
+ Ok: setCountry
56
+ },
57
+ close: setCountry
58
+ });
59
+ });
60
+ // -->
61
+ </script>
62
+ <?php endif;
63
+ ?>
64
+ <?php endif;
65
+ ?>
66
+ <?php endif;
67
+ ?>
app/design/frontend/rwd/default/template/bongointernational/extend/code.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php /*if ($this->getIsEnabled()): ?>
2
+ <?php echo $this->getExtendCode(); ?>
3
+ <?php endif;*/ ?>
app/etc/modules/Bongo_International.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Bongo_International>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Payment />
9
+ </depends>
10
+ </Bongo_International>
11
+ </modules>
12
+ </config>
app/locale/en_US/Bongo_International.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ "Never","Never"
2
+ "Nightly","Nightly"
3
+ "Weekly","Weekly"
4
+ "Monthly","Monthly"
5
+ "Export Now!","Export Now!"
6
+ "Run Now!","Run Now!"
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>WhiteSunrise_Bongo_International</name>
4
+ <version>1.2.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/GPL-3.0">GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Bongo International is a new international checkout process in which all orders enter Magento as a domestic shipment. This means that all merchants have to do is fulfill more domestic orders. No need for additional paperwork, compliance checks, or hassle.</summary>
10
+ <description>Bongo International is a new international checkout process in which all orders enter Magento as a domestic shipment. This means that all merchants have to do is fulfill more domestic orders. No need for additional paperwork, compliance checks, or hassle.&#xD;
11
+ &#xD;
12
+ Through Magento you can easily integrate Bongo International and enable your business to reach international consumers through your existing e-commerce infrastructure.&#xD;
13
+ &#xD;
14
+ Bongo International is compliant with the mandatory Export Administration Regulations (EAR) screens individual products against the Commerce Control List (CCL) and the required Denied Party Lists. Bongo International can also ensure you maintain compliance with any licensing agreements that prohibit sales in specific markets while allowing the consumer to complete the purchase of approved items.</description>
15
+ <notes>New and improved module with full International support for Bongo Checkout and Bongo Export</notes>
16
+ <authors><author><name>Brent Wierson</name><user>WhiteSunriseLLC</user><email>brent@whitesunrise.com</email></author></authors>
17
+ <date>2015-04-10</date>
18
+ <time>02:05:31</time>
19
+ <contents><target name="magecommunity"><dir name="Bongo"><dir name="International"><dir name="Block"><dir name="Adminhtml"><file name="CallbackUrl.php" hash="5290936e66e3846f4fc2f5a7ca40aa38"/><file name="ContinueUrl.php" hash="ee226525448857d9d40da8bfb5dfcb91"/><file name="ExportButton.php" hash="666ff2acdc819665ad8de0d48913b75d"/><dir name="Sales"><dir name="Order"><dir name="View"><file name="Bongointernational.php" hash="11040a99ae4ee3914304e0baf0e305df"/></dir></dir></dir><file name="SyncButton.php" hash="e172b0b96e4a4f61d5f2d3e99b0fe76d"/></dir><dir name="Checkout"><file name="Form.php" hash="94fd059fe3407926bcab9ded49f981d6"/><file name="Link.php" hash="9a02ce1f353ebcd2480bf0b397719d37"/><file name="Redirect.php" hash="218db381a90ffc7e1dae375d4ecbb1ec"/></dir><dir name="Compatibility"><dir name="Checkout"><file name="Firecheckout.php" hash="d3450c39bf6235d15c61807ce116ec08"/><file name="Onestepcheckout.php" hash="173e2b270fa3a1e945700d7a62179748"/></dir><file name="Checkout.php" hash="2486cf4eeb4a3c4bc6183995aa45bdb6"/></dir><dir name="Currency"><dir name="Selector"><file name="Default.php" hash="f6b19b846423a018fe07ee5a3fde5984"/><file name="Experimental.php" hash="3252dc5c41b3d9dd890bf33a8c48ea6d"/><file name="Lightbox.php" hash="ca80c10dbcd3f8bd7ddf12eb8de4140b"/></dir><file name="Selector.php" hash="d94ac459bf1c510b17bac8e64a75e4af"/></dir><dir name="Extend"><file name="Code.php" hash="84d209da366b40651fbfa79280262b32"/></dir><dir name="Sales"><dir name="Order"><file name="Totals.php" hash="73f1e20ae16af82130a113b608ef1b6b"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="92f9465b1f68c6e2f52ec0d1f7b4c716"/></dir><dir name="Model"><dir name="Adminhtml"><file name="DefaultCountry.php" hash="9dcb9b1dd7eab94f30a1b35b4aec1a37"/><file name="IntegrationType.php" hash="c047c929783ec4296cda0665c6d2efe4"/><file name="ShippingMethods.php" hash="9ab5e69f0941d8805a1e49205019ea2a"/><file name="ShippingType.php" hash="443ad5f9384cde422a649ca0f8adeccf"/><file name="SyncFrequency.php" hash="1ca27fb9781b5c5047b5e6ef7140ba49"/><file name="TransferType.php" hash="6ff66070f8805cb3722d7c9e30c457e1"/></dir><dir name="Currency"><file name="Cache.php" hash="e6096dde030b37743ba5d990f328ef11"/><file name="Converter.php" hash="8e9d7cbc6ed05e1eac85f07cd83f32b6"/></dir><dir name="Order"><file name="Observer.php" hash="87487f4a643a1f86bdd37afe518812b9"/></dir><dir name="Payment"><file name="Standard.php" hash="3552b4b3cd0aa364d0b963ded947df5a"/></dir><dir name="Products"><file name="Status.php" hash="be6cfa2d92b2764836ea069c82bfd209"/><file name="Sync.php" hash="9a9957b266262b769a4553961426fe06"/></dir><dir name="Resource"><dir name="Status"><file name="Collection.php" hash="e8d4a6e751e684b4cc9a45a35a3f5c52"/></dir><file name="Status.php" hash="7353c336eb441aa7fab9c7b344767002"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Bongo.php" hash="07f2d31507b5078bcfbef0e6082e7668"/></dir><file name="Observer.php" hash="4f1349b995294414a641bc363176eb0c"/></dir><file name="Status.php" hash="1c1331a9db62758ececfaa9edaec3beb"/><dir name="Total"><dir name="Duty"><file name="Creditmemo.php" hash="6b8a267274df0cbe724a6a21ad2b861f"/><file name="Invoice.php" hash="6889ab8a0057396a38ca05de96d013a2"/><file name="Quote.php" hash="8d85ee6fb6914572e54844e1ee0c36ca"/></dir><dir name="Insurance"><file name="Creditmemo.php" hash="e919ac523d9ada44b94e41c0f6e776f3"/><file name="Invoice.php" hash="2fb37d3659ff234192ca22140bd1e022"/><file name="Quote.php" hash="70b636b4c0803b3f284c7ab524daf320"/></dir><dir name="Tax"><file name="Creditmemo.php" hash="f1fa4da1f5e4ac47dbcfaf8eb8d2260b"/><file name="Invoice.php" hash="d5cd8f8b6711fc6638296f87d2f572ee"/><file name="Quote.php" hash="670ef9ae51af0c2f95441883ef5f68ee"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="BongointernationalController.php" hash="fb4e6489602f6f70a4b6918a663c32c7"/></dir><file name="CallbackController.php" hash="d6ccc4fe498221884a267ddb0ef39631"/><file name="ContinueController.php" hash="0b40837383a135b8d2f66b657845c11f"/></dir><dir name="etc"><file name="config.xml" hash="a06a7f7eeb76a2728b6b16a7a9b666e8"/><file name="system.xml" hash="d18c0d7d11b8b196eccdd3a1d6799f47"/></dir><dir name="lib"><file name="IP2Location.php" hash="2b8784f65983552cda19e735f0ef04b0"/></dir><dir name="sql"><dir name="bongointernational_setup"><file name="mysql4-install-1.1.2.php" hash="2d1cbcd177693bc561666cffa4b87d1d"/><file name="mysql4-install-1.2.0.php" hash="52c96442a4009f361317cc008646d41f"/><file name="mysql4-install-1.2.1.php" hash="6c65e0c8c7f6920816e8bcfaa2020f5a"/><file name="mysql4-upgrade-1.1.2-1.2.0.php" hash="4380eefc4dd31fa6cd61346a7305a5f9"/><file name="mysql4-upgrade-1.2.0-1.2.1.php" hash="00f57868500ff2e938a21f73c1725dc9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="bongointernational.xml" hash="aad9f9d702def856d335644274562ced"/></dir><dir name="template"><dir name="bongointernational"><dir name="sales"><dir name="order"><dir name="view"><file name="bongointernational.phtml" hash="1e321619509ed1638a183c037b1dfe9f"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bongointernational.xml" hash="45bd8181e872fe7ea7acc1016a16a181"/></dir><dir name="template"><dir name="bongointernational"><dir name="checkout"><file name="form.phtml" hash="2d6d6ffe60341e83be63d1ddc9650681"/><file name="link.phtml" hash="81fb5a1149cb06f615aab3a634b23b97"/><file name="redirect.phtml" hash="ef97d5bbfbccfb487c75f0ab85dff5da"/></dir><dir name="compatibility"><dir name="checkout"><file name="firecheckout.phtml" hash="3138e1fec28ec8a18137fec64431facd"/><file name="onestepcheckout.phtml" hash="3dc3a08095ac35279f589955a0ebcce8"/></dir><file name="checkout.phtml" hash="6e4b256505b2d84bfd555192e647bb23"/></dir><dir name="currency"><dir name="selector"><file name="default.phtml" hash="2417ed43105b87da8b01f9d6379e8a19"/><file name="experimental.phtml" hash="8dc21505a6e5e72c303f7c977f1ac2ae"/><file name="lightbox.phtml" hash="8df4b0087890a7944a0ea27d7c149625"/></dir></dir><dir name="extend"><file name="code.phtml" hash="e936bc61210d0e100065a2e6ff667699"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="bongointernational.xml" hash="45bd8181e872fe7ea7acc1016a16a181"/></dir><dir name="template"><dir name="bongointernational"><dir name="checkout"><file name="form.phtml" hash="2d6d6ffe60341e83be63d1ddc9650681"/><file name="link.phtml" hash="81fb5a1149cb06f615aab3a634b23b97"/><file name="redirect.phtml" hash="ef97d5bbfbccfb487c75f0ab85dff5da"/></dir><dir name="compatibility"><dir name="checkout"><file name="firecheckout.phtml" hash="3138e1fec28ec8a18137fec64431facd"/><file name="onestepcheckout.phtml" hash="3dc3a08095ac35279f589955a0ebcce8"/></dir><file name="checkout.phtml" hash="6e4b256505b2d84bfd555192e647bb23"/></dir><dir name="currency"><dir name="selector"><file name="default.phtml" hash="2417ed43105b87da8b01f9d6379e8a19"/><file name="experimental.phtml" hash="8dc21505a6e5e72c303f7c977f1ac2ae"/><file name="lightbox.phtml" hash="8df4b0087890a7944a0ea27d7c149625"/></dir></dir><dir name="extend"><file name="code.phtml" hash="e936bc61210d0e100065a2e6ff667699"/></dir></dir></dir></dir></dir><dir name="enterprise"><dir name="default"><dir name="layout"><file name="bongointernational.xml" hash="45bd8181e872fe7ea7acc1016a16a181"/></dir><dir name="template"><dir name="bongointernational"><dir name="checkout"><file name="form.phtml" hash="2d6d6ffe60341e83be63d1ddc9650681"/><file name="link.phtml" hash="81fb5a1149cb06f615aab3a634b23b97"/><file name="redirect.phtml" hash="ef97d5bbfbccfb487c75f0ab85dff5da"/></dir><dir name="compatibility"><dir name="checkout"><file name="firecheckout.phtml" hash="3138e1fec28ec8a18137fec64431facd"/><file name="onestepcheckout.phtml" hash="3dc3a08095ac35279f589955a0ebcce8"/></dir><file name="checkout.phtml" hash="6e4b256505b2d84bfd555192e647bb23"/></dir><dir name="currency"><dir name="selector"><file name="default.phtml" hash="2417ed43105b87da8b01f9d6379e8a19"/><file name="experimental.phtml" hash="8dc21505a6e5e72c303f7c977f1ac2ae"/><file name="lightbox.phtml" hash="8df4b0087890a7944a0ea27d7c149625"/></dir></dir><dir name="extend"><file name="code.phtml" hash="e936bc61210d0e100065a2e6ff667699"/></dir></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="layout"><file name="bongointernational.xml" hash="45bd8181e872fe7ea7acc1016a16a181"/></dir><dir name="template"><dir name="bongointernational"><dir name="checkout"><file name="form.phtml" hash="2d6d6ffe60341e83be63d1ddc9650681"/><file name="link.phtml" hash="81fb5a1149cb06f615aab3a634b23b97"/><file name="redirect.phtml" hash="ef97d5bbfbccfb487c75f0ab85dff5da"/></dir><dir name="compatibility"><dir name="checkout"><file name="firecheckout.phtml" hash="3138e1fec28ec8a18137fec64431facd"/><file name="onestepcheckout.phtml" hash="3dc3a08095ac35279f589955a0ebcce8"/></dir><file name="checkout.phtml" hash="6e4b256505b2d84bfd555192e647bb23"/></dir><dir name="currency"><dir name="selector"><file name="default.phtml" hash="2417ed43105b87da8b01f9d6379e8a19"/><file name="experimental.phtml" hash="8dc21505a6e5e72c303f7c977f1ac2ae"/><file name="lightbox.phtml" hash="8df4b0087890a7944a0ea27d7c149625"/></dir></dir><dir name="extend"><file name="code.phtml" hash="e936bc61210d0e100065a2e6ff667699"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bongo_International.xml" hash="937cffa1fcf11335588e6dfcb6d56599"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Bongo_International.csv" hash="e16501179306e2eb378b967e7a1571f4"/></dir></dir></target><target name="mage"><dir name="var"><dir name="bongointernational"><file name="IP2LOCATION-LITE-DB1.BIN" hash="bf12941352fbb1e6139f6203bed41166"/></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>libxml</name><min></min><max></max></extension><extension><name>soap</name><min></min><max></max></extension></required></dependencies>
22
+ </package>
var/bongointernational/IP2LOCATION-LITE-DB1.BIN ADDED
Binary file