Iglobal_Main - Version 1.5.6

Version Notes

New Features:

Save off payment transaction details to the order transaction.

Download this release

Release Info

Developer Brian Olsen
Extension Iglobal_Main
Version 1.5.6
Comparing to
See all releases


Code changes from version 1.5.5 to 1.5.6

Files changed (43) hide show
  1. app/code/community/Iglobal/Stores.full/Block/Ajax.php +8 -0
  2. app/code/community/Iglobal/Stores.full/Block/Cart.php +45 -0
  3. app/code/community/Iglobal/Stores.full/Block/Includes.php +8 -0
  4. app/code/community/Iglobal/Stores.full/Block/Link.php +20 -0
  5. app/code/community/Iglobal/Stores.full/Helper/Configoptions.php +6 -0
  6. app/code/community/Iglobal/Stores.full/Helper/Data.php +232 -0
  7. app/code/community/Iglobal/Stores.full/Helper/Url.php +17 -0
  8. app/code/community/Iglobal/Stores.full/Model/Carrier.php +78 -0
  9. app/code/community/Iglobal/Stores.full/Model/Configoptions.php +17 -0
  10. app/code/community/Iglobal/Stores.full/Model/International/International.php +35 -0
  11. app/code/community/Iglobal/Stores.full/Model/Observer.php +105 -0
  12. app/code/community/Iglobal/Stores.full/Model/Order.php +391 -0
  13. app/code/community/Iglobal/Stores.full/Model/Payment/Iglobal.php +45 -0
  14. app/code/community/Iglobal/Stores.full/Model/Payment/Iglobalcreditcard.php +7 -0
  15. app/code/community/Iglobal/Stores.full/Model/Payment/Iglobalpaypal.php +7 -0
  16. app/code/community/Iglobal/Stores.full/Model/Resource/Setup.php +160 -0
  17. app/code/community/Iglobal/Stores.full/Model/Rest.php +75 -0
  18. app/code/community/Iglobal/Stores.full/Model/Service/Quote.php +9 -0
  19. app/code/community/Iglobal/Stores.full/Model/Tax.php +25 -0
  20. app/code/community/Iglobal/Stores.full/controllers/AjaxController.php +38 -0
  21. app/code/community/Iglobal/Stores.full/controllers/CheckoutController.php +52 -0
  22. app/code/community/Iglobal/Stores.full/controllers/SuccessController.php +47 -0
  23. app/code/community/Iglobal/Stores.full/etc/adminhtml.xml +35 -0
  24. app/code/community/Iglobal/Stores.full/etc/config.xml +371 -0
  25. app/code/community/Iglobal/Stores.full/etc/system.xml +653 -0
  26. app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-install-0.1.0.php +36 -0
  27. app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.0-0.1.1.php +4 -0
  28. app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.1-0.1.2.php +15 -0
  29. app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.2-0.1.3.php +4 -0
  30. app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.3-1.0.0.php +4 -0
  31. app/code/community/Iglobal/Stores/.DS_Store +0 -0
  32. app/code/community/Iglobal/Stores/Helper/Data.php +2 -1
  33. app/code/community/Iglobal/Stores/Model/International/International.php +3 -1
  34. app/code/community/Iglobal/Stores/Model/Observer.php +105 -102
  35. app/code/community/Iglobal/Stores/Model/Order.php +59 -21
  36. app/code/community/Iglobal/Stores/Model/Payment/Iglobal.php +45 -20
  37. app/code/community/Iglobal/Stores/Model/Payment/Iglobalcreditcard.php +7 -21
  38. app/code/community/Iglobal/Stores/Model/Payment/Iglobalpaypal.php +7 -21
  39. app/code/community/Iglobal/Stores/Model/Rest.php +2 -0
  40. app/code/community/Iglobal/Stores/controllers/SuccessController.php +5 -4
  41. js/iGlobal/ig_welcome_mat_default.css +4 -19
  42. js/iGlobal/ig_welcome_mat_default.js +1 -1
  43. package.xml +5 -6
app/code/community/Iglobal/Stores.full/Block/Ajax.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iglobal_Stores_Block_Ajax extends Mage_Core_Block_Template
3
+ {
4
+ public function includeFiles()
5
+ {
6
+
7
+ }
8
+ }
app/code/community/Iglobal/Stores.full/Block/Cart.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iglobal_Stores_Block_Cart extends Mage_Core_Block_Template
3
+ {
4
+
5
+ protected function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->setTemplate('iglobal/stores/cart.phtml');
9
+ }
10
+
11
+ public function igAttrBlock()
12
+ {
13
+ $items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
14
+ Zend_Debug::dump($items);
15
+ echo '<div class="igItemAttr" style="display: none;">';
16
+ foreach($items as $item) {
17
+
18
+ $image = Mage::helper('catalog/image')->init($item->getProduct(), 'thumbnail');
19
+ $my_product = Mage::getModel('catalog/product')->load($item->getProductId());
20
+ $my_product_url = $my_product->getProductUrl();
21
+
22
+ echo '<div class="igItemDetails">';
23
+ echo '<p class="igID">'.$item->getProductId().'</p><br />';
24
+ echo '<p class="igName">'.$item->getName().'</p><br />';
25
+ echo '<p class="igSku">'.$item->getSku().'</p><br />';
26
+ echo '<p class="igQty">'.$item->getQty().'</p><br />';
27
+ echo '<p class="igPrice">'.$item->getPrice().'</p><br />';
28
+
29
+ echo '<p class="igUrl">'.$my_product_url.'</p><br />';
30
+ echo '<p class="igImage">I'. $image.'</p><br />';
31
+ echo '<p class="igDescription">'. $item->getdescription.'</p><br />';
32
+ echo '<p class="igWeight">'.$item->getWeight().'</p><br />';
33
+ echo '<p class="igLength">'. $item->getLength.'</p><br />';
34
+ echo '<p class="igHeight">'. $item->getHeight.'</p><br />';
35
+ echo '</div><!-- end igItemDetails-->';
36
+
37
+ echo "<br />";
38
+ }
39
+ echo '</div><!--end igItemAttr-->';
40
+
41
+ //return $items;
42
+ }
43
+
44
+
45
+ }
app/code/community/Iglobal/Stores.full/Block/Includes.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iglobal_Stores_Block_Includes extends Mage_Core_Block_Template
3
+ {
4
+ public function includeFiles()
5
+ {
6
+
7
+ }
8
+ }
app/code/community/Iglobal/Stores.full/Block/Link.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //this block override returns the url to be used on the primary checkout buttons on the cart page.
4
+ //If you are using a custom checkout then this may or may not still work.
5
+ //If not, you will need to find how the checkout determines the url, and apply a similar method.
6
+ // also refer to ../Helper/Url.php
7
+
8
+ class Iglobal_Stores_Block_Link extends Mage_Checkout_Block_Onepage_Link
9
+ {
10
+ function getCheckoutUrl()
11
+ {
12
+ //return the url
13
+ if (Mage::getStoreConfig('iglobal_integration/igmat/welcome_mat_active')
14
+ && Mage::getStoreConfig('iglobal_integration/apireqs/ice_toggle')){
15
+ return $this->getUrl('iglobal/checkout', array('_secure'=>true));
16
+ } else {
17
+ return $this->getUrl('checkout/onepage', array('_secure'=>true));
18
+ }
19
+ }
20
+ }
app/code/community/Iglobal/Stores.full/Helper/Configoptions.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Helper_Configoptions extends Mage_Core_Helper_Abstract{
4
+
5
+
6
+ }
app/code/community/Iglobal/Stores.full/Helper/Data.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ /**
6
+ * Path for config.
7
+ */
8
+ const XML_CONFIG_PATH = 'iglobal_integration/igjq/';
9
+
10
+ /**
11
+ * Name library directory.
12
+ */
13
+ const NAME_DIR_JS = 'iGlobal/jquery/';
14
+
15
+ /**
16
+ * List files for include.
17
+ *
18
+ * @var array
19
+ */
20
+ protected $_files = array(
21
+ 'jquery.js',
22
+ 'jquery.noconflict.js',
23
+ );
24
+
25
+ public function units2lbs($value, $unit='lbs')
26
+ {
27
+ $unit = ($unit ? $unit : "lbs");
28
+ $convert = array('kg' => 0.453592, 'oz' => 16, 'g' => 453.592, 'lbs' => 1);
29
+ $value = round(floatval($value) / $convert[$unit], 2);
30
+ if($value){
31
+ return $value;
32
+ }
33
+ return null;
34
+ }
35
+
36
+ public function dim2inch($value, $dim='in')
37
+ {
38
+ $dim = ($dim ? $dim : "in");
39
+ $convert = array('cm' => 2.54, 'in' => 1);
40
+ $value = ceil(floatval($value) / $convert[$dim]);
41
+ if($value){
42
+ return $value;
43
+ }
44
+ return null;
45
+ }
46
+
47
+ public function getDimensions($product, $item)
48
+ {
49
+ $dim = $product->getAttributeText('ig_dimension_units');
50
+ $weight = $product->getIgWeight();
51
+ if (empty($weight))
52
+ {
53
+ $weight = $item->getWeight();
54
+ }
55
+ $dimensions = array(
56
+ 'weight' => $this->units2lbs($this->getProductAttribute($product, 'weight'), $product->getAttributeText('ig_weight_units')),
57
+ 'length' => $this->dim2inch($this->getProductAttribute($product, 'length'), $dim),
58
+ 'width' => $this->dim2inch($this->getProductAttribute($product, 'width'), $dim),
59
+ 'height' => $this->dim2inch($this->getProductAttribute($product, 'height'), $dim),
60
+ );
61
+ return $dimensions;
62
+ }
63
+
64
+ public function getItemDetails($item)
65
+ {
66
+ $product = $item->getProduct();
67
+ // reload the product to get all attributes
68
+ $product = $product->load($product->getId());
69
+ //get options on the items
70
+ $options = $product->getTypeInstance(true)->getOrderOptions($product);
71
+ $optionList = "";
72
+ if ($options && isset($options["options"])) {
73
+ $optionList = "|";
74
+ foreach ($options["options"] as $option) { //todo: add loops for $options[additional_options] and $options[attributes_info] to get all possible options
75
+ $optionList = $optionList . $option["label"] . ':"' . $option["value"] . '"|';
76
+ }
77
+ }
78
+
79
+ $details = array(
80
+ 'productId' => $product->getId(),
81
+ 'sku' => $product->getSku(),
82
+ 'description' => $product->getName(),
83
+ 'unitPrice' => $item->getPrice(),
84
+ 'quantity' => $item->getQty(),
85
+ 'itemURL' => $product->getProductUrl(),
86
+ 'imageURL' => str_replace("http:", "https:", Mage::helper('catalog/image')->init($product, 'thumbnail')),
87
+ 'itemDescriptionLong' => $optionList,
88
+ 'countryOfOrigin' => $this->getProductAttribute($product, 'country_of_origin'),
89
+ 'itemBrand' => $this->getProductAttribute($product, 'brand'),
90
+ 'itemCategory' => $this->getProductAttribute($product, 'category'),
91
+ 'itemHSCode' => $this->getProductAttribute($product, 'hs_code'),
92
+ 'itemCustomization' => $this->getProductAttribute($product, 'customization'),
93
+ 'itemColor' => $this->getProductAttribute($product, 'color'),
94
+ 'itemMaterial' => $this->getProductAttribute($product, 'material'),
95
+ 'status' => $this->getProductAttribute($product, 'status'),
96
+ 'nonShippable' => (bool)$this->getProductAttribute($product, 'non_shippable'),
97
+ ) + $this->getDimensions($product, $item);
98
+ return $details;
99
+ }
100
+
101
+ /**
102
+ * Check enabled.
103
+ *
104
+ * @return bool
105
+ */
106
+ public function isEnabled()
107
+ {
108
+ return (bool) $this->_getConfigValue('enabled', $store = '');
109
+ }
110
+
111
+ /**
112
+ * Check if the country is domestic
113
+ * @return bool
114
+ */
115
+ public function isDomestic(){
116
+ $countryCode = (isset($_COOKIE['igCountry']) ? $_COOKIE['igCountry'] : "");
117
+ $domesticCountries = explode(",", Mage::getStoreConfig('general/country/ig_domestic_countries'));
118
+ return in_array($countryCode, $domesticCountries);
119
+ }
120
+
121
+ /**
122
+ * Create the iGlobal checkout url
123
+ * @param $tempCart
124
+ * @return string
125
+ */
126
+ public function getCheckoutUrl($tempCart){
127
+ $subdomain = (Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain') ? Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain') : "checkout");
128
+ $storeNumber = (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid') ? Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid') : "3");
129
+ $countryCode = (isset($_COOKIE['igCountry']) ? $_COOKIE['igCountry'] : "");
130
+ $url = 'https://' . $subdomain . '.iglobalstores.com/?store=' . $storeNumber . '&tempCartUUID=' . $tempCart . '&country=' . $countryCode;
131
+
132
+
133
+ //grab customer info if logged in and carry over to iglobal checkout
134
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
135
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
136
+ $shipping_id = $customer->getDefaultShipping();
137
+
138
+ if($shipping_id){
139
+ $shipping_address = Mage::getModel('customer/address')->load($shipping_id);
140
+ }
141
+
142
+ $customer_params = '';
143
+
144
+ if(!$shipping_address){
145
+ $customer_params .= '&customerName=' . $customer['firstname'] . ' ' . $customer['lastname'];
146
+ $customer_params .= '&customerCompany=' . $customer['company'];
147
+ $customer_params .= '&customerEmail=' . $customer['email'];
148
+ $customer_params .= '&customerPhone=' . $customer['telephone'];
149
+ }else{
150
+ $customer_params .= '&customerName=' . $shipping_address['firstname'] . ' ' . $shipping_address['lastname'];
151
+ $customer_params .= '&customerCompany=' . $shipping_address['company'];
152
+ $customer_params .= '&customerEmail=' . $customer['email'];
153
+ $customer_params .= '&customerPhone=' . $shipping_address['telephone'];
154
+ $customer_params .= '&customerAddress1=' . $shipping_address->getStreet(1);
155
+ $customer_params .= '&customerAddress2=' . $shipping_address->getStreet(2);
156
+ $customer_params .= '&customerCity=' . $shipping_address['city'];
157
+ $customer_params .= '&customerState=' . $shipping_address['region'];
158
+ $customer_params .= '&customerCountry=' . $shipping_address['country_id'];
159
+ $customer_params .= '&customerZip=' . $shipping_address['postcode'];
160
+ }
161
+ $url .= $customer_params;
162
+ }
163
+ return $url;
164
+ }
165
+
166
+ /**
167
+ * Return path file.
168
+ *
169
+ * @param $file
170
+ *
171
+ * @return string
172
+ */
173
+ public function getJQueryPath($file)
174
+ {
175
+ return self::NAME_DIR_JS . $file;
176
+ }
177
+
178
+ /**
179
+ * Create a json string of the confg settings for the welcome mat.
180
+ * @return string
181
+ */
182
+ public function getJavascriptVars()
183
+ {
184
+ $data = array (
185
+ 'storeId' =>Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid'),
186
+ 'subdomain' => Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain'),
187
+ 'flag_parent' => Mage::getStoreConfig('iglobal_integration/igmat/flag_parent'),
188
+ 'flag_method' => Mage::getStoreConfig('iglobal_integration/igmat/flag_method'),
189
+ 'flag_code' => Mage::getStoreConfig('iglobal_integration/igmat/flag_code'),
190
+ 'domesticCountries' => Mage::getStoreConfig('general/country/ig_domestic_countries'),
191
+ 'storeLogo' => Mage::getStoreConfig('iglobal_integration/igmat/store_logo'),
192
+ 'cartUrl' => Mage::getUrl('checkout/cart'),
193
+ );
194
+ //figure out what countries are serviced
195
+ if (Mage::getStoreConfig('general/country/allow')) {
196
+ //define iGlobal serviced countries
197
+ $allCountries = array("AP"=>"APO/FPO","AF"=>"Afghanistan","AL"=>"Albania","DZ"=>"Algeria","AS"=>"American Samoa","AD"=>"Andorra","AO"=>"Angola","AI"=>"Anguilla","AG"=>"Antigua","AR"=>"Argentina","AM"=>"Armenia","AW"=>"Aruba","AU"=>"Australia","AT"=>"Austria","AZ"=>"Azerbaijan","BS"=>"Bahamas","BH"=>"Bahrain","BD"=>"Bangladesh","BB"=>"Barbados","BY"=>"Belarus","BE"=>"Belgium","BZ"=>"Belize","BJ"=>"Benin","BM"=>"Bermuda","BT"=>"Bhutan","BO"=>"Bolivia","BQ"=>"Bonaire","BA"=>"Bosnia & Herzegovina","BW"=>"Botswana","BR"=>"Brazil","VG"=>"Virgin Islands (British)","BN"=>"Brunei","BG"=>"Bulgaria","BF"=>"Burkina Faso","BI"=>"Burundi","KH"=>"Cambodia","CM"=>"Cameroon","CA"=>"Canada","IC"=>"Canary Islands","CV"=>"Cape Verde","KY"=>"Cayman Islands","CF"=>"Central African Republic","TD"=>"Chad","CL"=>"Chile","CN"=>"China - People's Republic of","CO"=>"Colombia","KM"=>"Comoros","CG"=>"Congo","CK"=>"Cook Islands","CR"=>"Costa Rica","HR"=>"Croatia","CW"=>"Curaçao","CY"=>"Cyprus","CZ"=>"Czech Republic","DK"=>"Denmark","DJ"=>"Djibouti","DM"=>"Dominica","DO"=>"Dominican Republic","TL"=>"Timor-Leste","EC"=>"Ecuador","EG"=>"Egypt","SV"=>"El Salvador","GQ"=>"Equatorial Guinea","ER"=>"Eritrea","EE"=>"Estonia","ET"=>"Ethiopia","FK"=>"Falkland Islands","FO"=>"Faroe Islands (Denmark)","FJ"=>"Fiji","FI"=>"Finland","FR"=>"France","GF"=>"French Guiana","GA"=>"Gabon","GM"=>"Gambia","GE"=>"Georgia","DE"=>"Germany","GI"=>"Gibraltar","GR"=>"Greece","GL"=>"Greenland (Denmark)","GD"=>"Grenada","GP"=>"Guadeloupe","GU"=>"Guam","GH"=>"Ghana","GT"=>"Guatemala","GG"=>"Guernsey","GN"=>"Guinea","GW"=>"Guinea-Bissau","GY"=>"Guyana","HT"=>"Haiti","HN"=>"Honduras","HK"=>"Hong Kong","HU"=>"Hungary","IS"=>"Iceland","IN"=>"India","ID"=>"Indonesia","IQ"=>"Iraq","IE"=>"Ireland - Republic Of","IL"=>"Israel","IT"=>"Italy","CI"=>"Ivory Coast","JM"=>"Jamaica","JP"=>"Japan","JE"=>"Jersey","JO"=>"Jordan","KZ"=>"Kazakhstan","KE"=>"Kenya","KI"=>"Kiribati","KR"=>"Korea","KW"=>"Kuwait","KG"=>"Kyrgyzstan","LA"=>"Laos","LV"=>"Latvia","LB"=>"Lebanon","LS"=>"Lesotho","LR"=>"Liberia","LT"=>"Lithuania","LI"=>"Liechtenstein","LU"=>"Luxembourg","MO"=>"Macau","MK"=>"Macedonia","MG"=>"Madagascar","MW"=>"Malawi","MY"=>"Malaysia","MV"=>"Maldives","ML"=>"Mali","MT"=>"Malta","MH"=>"Marshall Islands","MQ"=>"Martinique","MR"=>"Mauritania","MU"=>"Mauritius","YT"=>"Mayotte","MX"=>"Mexico","MD"=>"Moldova","FM"=>"Micronesia - Federated States of","MC"=>"Monaco","MN"=>"Mongolia","ME"=>"Montenegro","MS"=>"Montserrat","MA"=>"Morocco","MZ"=>"Mozambique","MM"=>"Myanmar","NA"=>"Namibia","NR"=>"Nauru","NP"=>"Nepal","NL"=>"Netherlands (Holland)","NV"=>"Nevis","NC"=>"New Caledonia","NZ"=>"New Zealand","NI"=>"Nicaragua","NE"=>"Niger","NG"=>"Nigeria","NU"=>"Niue Island","NF"=>"Norfolk Island","MP"=>"Northern Mariana Islands","NO"=>"Norway","OM"=>"Oman","PK"=>"Pakistan","PA"=>"Panama","PG"=>"Papua New Guinea","PY"=>"Paraguay","PW"=>"Palau","PE"=>"Peru","PH"=>"Philippines","PL"=>"Poland","PT"=>"Portugal","PR"=>"Puerto Rico","QA"=>"Qatar","RE"=>"Reunion","RO"=>"Romania","RU"=>"Russia","RW"=>"Rwanda","SM"=>"San Marino","ST"=>"Sao Tome & Principe","SA"=>"Saudi Arabia","SN"=>"Senegal","RS"=>"Serbia & Montenegro","SC"=>"Seychelles","SL"=>"Sierra Leone","SG"=>"Singapore","SK"=>"Slovakia","SI"=>"Slovenia","SB"=>"Solomon Islands","ZA"=>"South Africa","SS"=>"South Sudan","ES"=>"Spain","LK"=>"Sri Lanka","BL"=>"St. Barthelemy","EU"=>"St. Eustatius","KN"=>"St. Kitts and Nevis","LC"=>"St. Lucia","MF"=>"St. Maarten","VC"=>"St. Vincent","SD"=>"Sudan","SR"=>"Suriname","SZ"=>"Swaziland","SE"=>"Sweden","CH"=>"Switzerland","PF"=>"Tahiti","TW"=>"Taiwan","TJ"=>"Tajikistan","TZ"=>"Tanzania","TH"=>"Thailand","TG"=>"Togo","TO"=>"Tonga","TT"=>"Trinidad and Tobago","TN"=>"Tunisia","TR"=>"Turkey","TM"=>"Turkmenistan","TC"=>"Turks and Caicos Islands","TV"=>"Tuvalu","VI"=>"Virgin Islands (U.S.)","UG"=>"Uganda","UA"=>"Ukraine","AE"=>"United Arab Emirates","GB"=>"United Kingdom","US"=>"United States","UY"=>"Uruguay","UZ"=>"Uzbekistan","VU"=>"Vanuatu","VE"=>"Venezuela","VN"=>"Vietnam","VA"=>"Vatican City","WS"=>"Western Samoa","YE"=>"Yemen","ZM"=>"Zambia","ZW"=>"Zimbabwe");
198
+
199
+ //allowed country list
200
+ $allowedCountries = Mage::getStoreConfig('general/country/allow');
201
+ $allowedCountries = array_flip(explode("," , $allowedCountries));
202
+
203
+ //countries that are both allowed and iGlobal available
204
+ $servicedCountries = array_intersect_key ($allCountries, $allowedCountries);
205
+ $data['servicedCountries'] = $servicedCountries;
206
+ }
207
+ return Mage::helper('core')->jsonEncode($data);
208
+ }
209
+
210
+ /**
211
+ * Return list files.
212
+ *
213
+ * @return array
214
+ */
215
+ public function getFiles()
216
+ {
217
+ return $this->_files;
218
+ }
219
+
220
+ protected function getProductAttribute($product, $attributeName) {
221
+ $value = Mage::getStoreconfig('iglobal_integration/ig_item_attribute/' . $attributeName);
222
+ if($value) {
223
+ return $product->getData($value);
224
+ }
225
+ return null;
226
+ }
227
+ protected function _getConfigValue($key, $store)
228
+ {
229
+ return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key, $store = '');
230
+ }
231
+
232
+ }
app/code/community/Iglobal/Stores.full/Helper/Url.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iglobal_Stores_Helper_Url extends Mage_Checkout_Helper_Url
3
+ {
4
+
5
+ function getCheckoutUrl()
6
+ {
7
+ // return the url
8
+ if (Mage::getStoreConfig('iglobal_integration/igmat/welcome_mat_active')
9
+ && Mage::getStoreConfig('iglobal_integration/apireqs/ice_toggle')) {
10
+ // send them to the iglobal checkout
11
+ return $this->_getUrl('iglobal/checkout');
12
+ } else {
13
+ return $this->_getUrl('checkout/onepage');
14
+ }
15
+ }
16
+
17
+ }
app/code/community/Iglobal/Stores.full/Model/Carrier.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iglobal_Stores_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract
3
+ implements Mage_Shipping_Model_Carrier_Interface {
4
+ protected $_code = 'ig';
5
+
6
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
+ {
8
+ if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
9
+ return false;
10
+ }
11
+
12
+ $price = $this->getConfigData('price'); // set a default shipping price maybe 0
13
+
14
+ $result = Mage::getModel('shipping/rate_result');
15
+ $show = Mage::registry('shipping_cost');
16
+ if($show){
17
+
18
+ $method = Mage::getModel('shipping/rate_result_method');
19
+ $method->setCarrier($this->_code);
20
+ $method->setMethod(Mage::registry('shipping_carriertitle'));
21
+ $method->setCarrierTitle($this->_code);
22
+ $method->setMethodTitle(Mage::registry('shipping_methodtitle'));
23
+ if(Mage::registry('shipping_cost')){
24
+ $method->setPrice(Mage::registry('shipping_cost'));
25
+ $method->setCost(Mage::registry('shipping_cost'));
26
+ } else {
27
+ $method->setPrice($price);
28
+ $method->setCost($price);
29
+ }
30
+ $result->append($method);
31
+
32
+ }else{
33
+ $error = Mage::getModel('shipping/rate_result_error');
34
+ $error->setCarrier($this->_code);
35
+ $error->setCarrierTitle($this->getConfigData('name'));
36
+ $error->setErrorMessage($this->getConfigData('specificerrmsg'));
37
+ $result->append($error);
38
+ }
39
+ return $result;
40
+ }
41
+ public function getAllowedMethods()
42
+ {
43
+ return array($this->_code =>$this->getConfigData('name'),
44
+ 'DHL_EXPRESS' => 'Express',
45
+ 'DHL_GLOBAL_MAIL' => 'Global Mail',
46
+ 'FEDEX_ECONOMY' => 'Economy',
47
+ 'FEDEX_GROUND' => 'Ground',
48
+ 'FEDEX_IPD' => 'FedEx IPD',
49
+ 'FEDEX_PRIORITY' => 'Priority',
50
+ 'UPS_2ND_DAY_AIR' => 'UPS 2 Day Air',
51
+ 'UPS_3_DAY_AIR' => 'UPS 3 Day Air',
52
+ 'UPS_3_DAY_SELECT' => 'UPS_3_DAY_SELECT',
53
+ 'UPS_EXPEDITED' => 'Expedited',
54
+ 'UPS_EXPRESS' => 'Express',
55
+ 'UPS_EXPRESS_SAVER' => 'Express Saver',
56
+ 'UPS_FREIGHT' => 'UPS Freight',
57
+ 'UPS_GROUND' => 'Canada Ground',
58
+ 'UPS_NEXT_DAY_AIR_SAVER' =>'UPS Next Day Air Saver',
59
+ 'UPS_SAVER' => 'UPS_SAVER',
60
+ 'UPS_STANDARD' => 'Canada Standard',
61
+ 'UPS_WORLDEASE' => 'UPS WorldEase',
62
+ 'UPS_WORLDWIDE_EXPEDITED' => 'Expedited',
63
+ 'UPS_WORLDWIDE_EXPRESS' => 'Express',
64
+ 'USPS_EXPRESS_1' => 'Express 1 Mail',
65
+ 'USPS_FIRST_CLASS' => 'First Class Mail',
66
+ 'USPS_FIRST_CLASS_MAIL_INTERNATIONAL' => 'First Class Mail, International',
67
+ 'USPS_FIRST_CLASS_PACKAGE_INTL_SERVICE' => 'First Class Mail, International',
68
+ 'USPS_PRIORITY' => 'USPS Priority',
69
+ 'USPS_PRIORITY_DOMESTIC' =>'USPS Priority Domestic',
70
+ 'USPS_PRIORITY_EXPRESS' => 'USPS Priority Express',
71
+ 'USPS_PRIORITY_EXPRESS_INTL' => 'USPS Priority Express',
72
+ 'USPS_PRIORITY_INTL' => 'USPS Priority',
73
+ 'USPS_PRIORITY_MAIL_EXPRESS_INTERNATIONAL' => 'Priority Mail Express, International',
74
+ 'USPS_PRIORITY_MAIL_INTERNATIONAL' => 'Priority Mail, International',
75
+ );
76
+
77
+ }
78
+ }
app/code/community/Iglobal/Stores.full/Model/Configoptions.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_ConfigOptions extends Mage_Eav_Model_Entity_Attribute_Source_Store
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ $collection = Mage::getResourceModel('catalog/product_attribute_collection')->load();
8
+ $options = array(array('value'=> null, 'label'=> '- Not mapped -' ));
9
+ foreach($collection as $attr) {
10
+ if($attr->getIsVisible()) {
11
+ $options[] = array('value' => $attr->getAttributeCode(), 'label' => $attr->getFrontendLabel());
12
+ }
13
+ }
14
+ return $options;
15
+ }
16
+
17
+ }
app/code/community/Iglobal/Stores.full/Model/International/International.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Iglobal_Stores_Model_International_International extends Mage_Core_Model_Abstract
5
+ {
6
+ public function getTempCartId ()
7
+ {
8
+
9
+ //get all the items in the cart
10
+ $cart = Mage::getModel('checkout/cart')->getQuote();
11
+ $items = array();
12
+ $helper = Mage::helper('stores');
13
+ foreach ($cart->getAllVisibleItems() as $item) {
14
+ $items[] = $helper->getItemDetails($item);
15
+ }
16
+ // Check for discounts to add as a negative line item
17
+ $totals = $cart->getTotals();
18
+ if (isset($totals['discount']))
19
+ {
20
+ $items[] = array(
21
+ 'description' => $totals['discount']->getTitle(),
22
+ 'quantity' => 1,
23
+ 'unitPrice' => $totals['discount']->getValue()
24
+ );
25
+ }
26
+ $rest = Mage::getModel('stores/rest');
27
+ $response = $rest->createTempCart(array(
28
+ "storeId" => Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid'),
29
+ "referenceId" => $cart->getId(),
30
+ "externalConfirmationPageURL" => MAge::getUrl('iglobal/success', array('_secure'=> true)),
31
+ "misc6" => "iGlobal v".Mage::getConfig()->getModuleConfig("Iglobal_Stores")->version. ", Magento v".Mage::getVersion(),
32
+ "items" => $items,));
33
+ return $response->tempCartUUID;
34
+ }
35
+ }
app/code/community/Iglobal/Stores.full/Model/Observer.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: david
5
+ * Date: 5/9/13
6
+ * Time: 3:24 PM
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Iglobal_Stores_Model_Observer
11
+ {
12
+ public function __construct()
13
+ {
14
+ //Just constructor for fun
15
+ }
16
+
17
+
18
+ public function orderCreated($observer)
19
+ {
20
+ //$observer contains the object returns in the event.
21
+ $event = $observer->getEvent();
22
+ $order = $event->getOrder();
23
+ if($order->getRelationParentId()){
24
+ $parentOrder = Mage::getModel('sales/order')->load($order->getRelationParentId());
25
+ if($parentOrder->getIgOrderNumber()){
26
+ $order->setIglobalTestOrder($parentOrder->getIglobalTestOrder());
27
+ $order->setIgOrderNumber($parentOrder->getIgOrderNumber());
28
+ $order->setInternationalOrder(1);
29
+ $order->save();
30
+ }
31
+ }
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * Added jQuery library.
37
+ *
38
+ * @param Varien_Event_Observer $observer
39
+ *
40
+ * @return string
41
+ */
42
+ public function prepareLayoutBefore(Varien_Event_Observer $observer)
43
+ {
44
+ if (!Mage::helper('stores')->isEnabled()) {
45
+ return $this;
46
+ }
47
+
48
+ /* @var $block Mage_Page_Block_Html_Head */
49
+ $block = $observer->getEvent()->getBlock();
50
+
51
+ if ("head" == $block->getNameInLayout()) {
52
+ foreach (Mage::helper('stores')->getFiles() as $file) {
53
+ $block->addJs(Mage::helper('stores')->getJQueryPath($file));
54
+ }
55
+ }
56
+
57
+ return $this;
58
+ }
59
+
60
+ public function orderRec () {
61
+
62
+ //build array of orders currently in magento
63
+ $magentoOrders = array();
64
+ $orders = Mage::getModel('sales/order')->getCollection()
65
+ ->addFilter('international_order', 1)
66
+ ->addFieldToFilter('ig_order_number', array('notnull'=> true))
67
+ ->getItems();
68
+
69
+ foreach ($orders as $order) {
70
+ $magentoOrders[$order->getIgOrderNumber()] = $order;
71
+ }
72
+ $date = date("Ymd", strtotime("-1 week"));
73
+ //get array with all orders in past
74
+ $data = Mage::getModel('stores/rest')->getAllOrdersSinceDate($date);
75
+ if(!isset($data) || !isset($data->orders)) {
76
+ return;
77
+ }
78
+ foreach ($data->orders as $igOrder)
79
+ {
80
+
81
+ if ($igOrder->testOrder)
82
+ {
83
+ continue;
84
+ }
85
+ if(array_key_exists($igOrder->id, $magentoOrders)) {
86
+ // check status
87
+ Mage::getModel('stores/order')->checkStatus($magentoOrders[$igOrder->id]);
88
+
89
+ } else {
90
+ try {
91
+ // re-import the order
92
+ // Mage::getModel('stores/order')->processOrder($igOrder->id);
93
+ }
94
+ catch(Exception $e)
95
+ {
96
+ mail('monitoring@iglobalstores.com, magentomissedorders@iglobalstores.com',
97
+ 'Magento Integration Error - International order failed to import',
98
+ 'International order# '. $igOrder->id .'.'. ' Exception Message: '.$e->getMessage());
99
+ Mage::log("International order #{$igOrder->id} failed to import!" .$e, Zend_Log::ERR, 'iglobal.log', true);
100
+ }
101
+
102
+ }
103
+ }
104
+ }
105
+ }
app/code/community/Iglobal/Stores.full/Model/Order.php ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ const STATUS_FRAUD = 'IGLOBAL_FRAUD_REVIEW';
7
+ const STATUS_IN_PROCESS = 'IGLOBAL_ORDER_IN_PROCESS';
8
+ const STATUS_HOLD = 'IGLOBAL_ORDER_ON_HOLD';
9
+ const STATUS_CANCELED = 'IGLOBAL_ORDER_CANCELED';
10
+
11
+ protected $quote = null;
12
+ protected $iglobal_order_id = null;
13
+ protected $iglobal_order = null;
14
+ protected $rest = null;
15
+
16
+ public function setQuote($quote)
17
+ {
18
+ $this->quote = $quote;
19
+ }
20
+
21
+ public function checkStatus($order)
22
+ {
23
+ if (!$this->iglobal_order)
24
+ {
25
+ $this->setIglobalOrder($order->getIgOrderNumber());
26
+ }
27
+ $status = $this->iglobal_order->orderStatus;
28
+ if (($status == self::STATUS_FRAUD || $status == self::STATUS_HOLD || $status == self::STATUS_CANCELED) && $order->canHold()) {
29
+ $order->hold();
30
+ $order->addStatusHistoryComment("Order Set to {$status} by iGlobal", false);
31
+ $order->save();
32
+ } elseif ($status == self::STATUS_IN_PROCESS && $order->canUnhold()) {
33
+ $order->unhold();
34
+ $order->addStatusHistoryComment("Order Set to {$status} by iGlobal", false);
35
+ $order->save();
36
+ }
37
+ }
38
+ public function setIglobalOrder($orderid)
39
+ {
40
+ $this->iglobal_order_id = $orderid;
41
+ if (!$this->iglobal_order)
42
+ {
43
+ $this->rest = Mage::getModel('stores/rest');
44
+ $this->iglobal_order = $this->rest->getOrder($this->iglobal_order_id)->order;
45
+ }
46
+ }
47
+
48
+ public function processOrder($orderid, $quote=NULL)
49
+ {
50
+ $this->setIglobalOrder($orderid);
51
+ if ($this->iglobal_order->merchantOrderId)
52
+ {
53
+ //return false;
54
+ }
55
+ // check the if this is the same quote that was sent.
56
+ if ($quote)
57
+ {
58
+ $this->quote = $quote;
59
+ } elseif (!$this->quote) {
60
+ $this->quote = Mage::getSingleton('checkout/session')->getQuote();
61
+ }
62
+
63
+ if ($this->iglobal_order->referenceId && $this->iglobal_order->referenceId != $this->quote->getId())
64
+ {
65
+ $this->quote->load($this->iglobal_order->referenceId);
66
+ }
67
+
68
+ // Set the duty_tax for the address total collection to use
69
+ Mage::register('duty_tax', $this->iglobal_order->dutyTaxesTotal);
70
+ $shippingAddress = $this->setContactInfo();
71
+ $this->setItems();
72
+ $shippingAddress = $this->setShipping($shippingAddress);
73
+ $this->setPayment($shippingAddress);
74
+ $order = $this->createOrder();
75
+ Mage::unregister('duty_tax');
76
+ Mage::unregister('shipping_cost');
77
+ Mage::unregister('shipping_carriertitle');
78
+ Mage::unregister('shipping_methodtitle');
79
+ return $order;
80
+ }
81
+ protected function regionId($state, $countryCode){
82
+ $region = Mage::getModel('directory/region')->loadbyName($state, $countryCode);
83
+ if (!$region->getId())
84
+ {
85
+ // Lookup region from iGlobalstores
86
+ $regionId = $this->rest->getRegionId($countryCode, $state, $this->iglobal_order_id);
87
+ $region->load($regionId->magentoRegionId);
88
+ if (!$region->getId())
89
+ {
90
+ try {
91
+ // Create a new region
92
+ $region->setData(array('country_id' => $countryCode, 'code'=> $regionId->isoCode,'default_name' => $state))->save();
93
+ } catch (Exception $e) {
94
+ return null;
95
+ }
96
+ }
97
+ }
98
+ return $region->getId();
99
+ }
100
+ protected function setContactInfo()
101
+ {
102
+ //set customer info
103
+ $this->quote->setCustomerEmail($this->iglobal_order->email);
104
+
105
+ $_name = explode(' ', $this->iglobal_order->name, 2);
106
+ if ($this->iglobal_order->testOrder) {
107
+ $name_first = "TEST ORDER! DO NOT SHIP! - " . array_shift($_name);
108
+ $name_last = array_pop($_name);
109
+ } else {
110
+ $name_first = array_shift($_name);
111
+ $name_last = array_pop($_name);
112
+ }
113
+
114
+ $this->quote->setCustomerFirstname($name_first);
115
+ $this->quote->setCustomerLastname($name_last);
116
+
117
+ $street = $this->iglobal_order->address1;
118
+ if ($this->iglobal_order->address2)
119
+ {
120
+ $street = array($street, $this->iglobal_order->address2);
121
+ }
122
+
123
+ $addressData = array(
124
+ 'firstname' => $name_first,
125
+ 'lastname' => $name_last,
126
+ 'street' => $street,
127
+ 'city' => $this->iglobal_order->city,
128
+ 'postcode' => $this->iglobal_order->zip,
129
+ 'telephone' => $this->iglobal_order->phone,
130
+ 'region' => $this->iglobal_order->state,
131
+ 'region_id' => $this->regionId($this->iglobal_order->state, $this->iglobal_order->countryCode),
132
+ 'country_id' => $this->iglobal_order->countryCode,
133
+ 'company' => $this->iglobal_order->company,
134
+ );
135
+
136
+ if (!empty($this->iglobal_order->billingAddress1)) {
137
+ $_nameBilling = explode(' ', $this->iglobal_order->billingName, 2);
138
+ if ($this->iglobal_order->testOrder) {
139
+ $name_first_billing = "TEST ORDER! DO NOT SHIP! - " . array_shift($_nameBilling);
140
+ $name_last_billing = array_pop($_nameBilling);
141
+ } else {
142
+ $name_first_billing = array_shift($_nameBilling);
143
+ $name_last_billing = array_pop($_nameBilling);
144
+ }
145
+
146
+ $streetBilling = $this->iglobal_order->billingAddress1;
147
+ if ($this->iglobal_order->billingAddress2) {
148
+ $streetBilling = array($streetBilling, $this->iglobal_order->billingAddress2);
149
+ }
150
+
151
+ $billingAddressData = array(
152
+ 'firstname' => $name_first_billing,
153
+ 'lastname' => $name_last_billing,
154
+ 'street' => $streetBilling,
155
+ 'city' => $this->iglobal_order->billingCity,
156
+ 'postcode' => $this->iglobal_order->billingZip,
157
+ 'telephone' => $this->iglobal_order->billingPhone,
158
+ 'region' => $this->iglobal_order->billingState,
159
+ 'region_id' => $this->regionId($this->iglobal_order->billingState, $this->iglobal_order->billingCountryCode),
160
+ 'country_id' => $this->iglobal_order->billingCountryCode,
161
+ 'company' => $this->iglobal_order->company,
162
+ );
163
+
164
+ } else {
165
+ $billingAddressData = $addressData;
166
+ }
167
+
168
+ if (Mage::getStoreConfig('iglobal_integration/igjq/iglogging'))
169
+ {
170
+ Mage::log('address data for order {$this->iglobal_order_id}: ' . print_r($addressData, true), null, 'iglobal.log', true);
171
+ Mage::log('billing address data for order {$this->iglobal_order_id}: ' . print_r($billingAddressData, true), null, 'iglobal.log', true);
172
+ }
173
+
174
+ $this->quote->getBillingAddress()->addData($billingAddressData);
175
+ $shippingAddress = $this->quote->getShippingAddress()->addData($addressData);
176
+ return $shippingAddress;
177
+ }
178
+
179
+ protected function setItems()
180
+ {
181
+ $quote_items = array();
182
+ $ig_items = array();
183
+ foreach($this->quote->getAllVisibleItems() as $item) {
184
+ $quote_items[$item->getProductId()] = $item;
185
+ }
186
+ foreach ($this->iglobal_order->items as $item) {
187
+ if ($item->productId) { // discounts do not have a productId set
188
+ $ig_items[$item->productId] = $item;
189
+ }
190
+ }
191
+
192
+ $missing = array_diff_key($ig_items, $quote_items);
193
+ $extra = array_diff_key($quote_items, $ig_items);
194
+ foreach ($missing as $pid => $item)
195
+ {
196
+ // Add the product to the quote
197
+ $product = Mage::getModel("catalog/product")->load($pid);
198
+ if ($product->getId())
199
+ {
200
+ $this->quote->addProduct($product, new Varien_Object(array('qty'=> $item->quantity)));
201
+ } else {
202
+ Mage::log("Missing sku `{$item->sku}' for {$this->iglobal_order_id}", null, 'iglobal.log', true);
203
+ }
204
+ }
205
+ foreach($extra as $item)
206
+ {
207
+ // $this->quote->removeItem($item->getId());
208
+ }
209
+ }
210
+
211
+ protected function setShipping($shippingAddress)
212
+ {
213
+ $shippers = Mage::getModel("stores/carrier")->getAllowedMethods();
214
+ $carrierMethod = $this->iglobal_order->shippingCarrierServiceLevel;
215
+ if (!$carrierMethod || !array_key_exists($carrierMethod, $shippers)) {
216
+ $carrierMethod = 'ig';
217
+ }
218
+ $shippingMethod = $this->iglobal_order->customerSelectedShippingName;
219
+ if(!$shippingMethod) {
220
+ $shippingMethod = "International shipping";
221
+ }
222
+
223
+ //Add things to the register so they can be used by the shipping method
224
+ Mage::register('shipping_cost', $this->iglobal_order->shippingTotal);
225
+ Mage::register('shipping_carriertitle', $carrierMethod);
226
+ Mage::register('shipping_methodtitle', $shippingMethod);
227
+ $shippingAddress->setCollectShippingRates(true)
228
+ ->collectShippingRates()
229
+ ->setShippingMethod('ig_'.$carrierMethod);
230
+ return $shippingAddress;
231
+ }
232
+
233
+ protected function setPayment($address)
234
+ {
235
+ $address->setPaymentMethod('iGlobalCreditCard');
236
+
237
+ //updates payment type in Magento Admin area
238
+ if (isset($this->iglobal_order->paymentProcessing)) {
239
+ $data = (array) $this->iglobal_order->paymentProcessing;
240
+ } else {
241
+ $data = array();
242
+ }
243
+ $data['ccType'] = 'AMEX';
244
+ if(isset( $this->iglobal_order->paymentProcessing->paymentGateway)) {
245
+ $paymentMethod = $this->iglobal_order->paymentProcessing->paymentGateway;
246
+ } else if (isset($this->iglobal_order->paymentProcessing->cardType)) {
247
+ $paymentMethod = $this->iglobal_order->paymentProcessing->cardType;
248
+ } else {
249
+ $paymentMethod = 'iGlobal';
250
+ }
251
+ switch($paymentMethod) {
252
+ case 'iGlobal_CC':
253
+ case 'AUTHORIZE_NET':
254
+ case 'BRAINTREE':
255
+ case 'CYBERSOURCE':
256
+ case 'INTERPAY':
257
+ case 'STRIPE':
258
+ case 'USA_EPAY':
259
+ $data['method'] = 'iGlobalCreditCard';
260
+ break;
261
+ case 'iGlobal PayPal':
262
+ case 'INTERPAY_PAYPAL':
263
+ case 'PAYPAL_EXPRESS':
264
+ $data['method'] = 'iGlobalPaypal';
265
+ break;
266
+ default:
267
+ $data['method'] = 'iGlobal';
268
+ }
269
+ $this->quote->getPayment()->importData($data);
270
+ }
271
+
272
+ protected function setTransactionInfo($order){
273
+ //add trans ID
274
+ try {
275
+ $transaction_id = $this->iglobal_order->paymentProcessing->transactionId;
276
+ } catch (Exception $e){
277
+ $transaction_id = '34234234234';
278
+ }
279
+ if(!$transaction_id) {
280
+ $transaction_id = '34234234234';
281
+ }
282
+ $transaction = Mage::getModel('sales/order_payment_transaction');
283
+ $transaction->setOrderPaymentObject($order->getPayment());
284
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
285
+ $transaction->setTxnId($transaction_id);
286
+ if(isset($this->iglobal_order->paymentProcessing)) {
287
+ $transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, (array)$this->iglobal_order->paymentProcessing);
288
+ if ($this->iglobal_order->paymentProcessing->transactionType == "AUTH_CAPTURE") {
289
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
290
+ }
291
+ }
292
+ $transaction->save();
293
+ }
294
+
295
+ protected function createOrder()
296
+ {
297
+
298
+ $this->quote->collectTotals()->save();
299
+ $this->quote->setIsActive(0)->save();
300
+
301
+ $service = Mage::getModel('stores/service_quote', $this->quote);
302
+ $service->submitAll();
303
+ $order = $service->getOrder();
304
+ if($order) {
305
+ // cleaning up
306
+ Mage::getSingleton('checkout/session')->clear();
307
+ } else {
308
+ $this->quote->setIsActive(1)->save();
309
+ return;
310
+ }
311
+
312
+
313
+ $id = $order->getEntityId();
314
+
315
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/send_order_email')) {
316
+ $order->sendNewOrderEmail();
317
+ }
318
+ Mage::getSingleton('checkout/session')->setLastOrderId($order->getId());
319
+ Mage::getSingleton('checkout/session')->setLastRealOrderId($order->getIncrementId());
320
+
321
+
322
+ $transId = Mage::getSingleton('checkout/session')->getLastRealOrderId($order->getIncrementId());
323
+ //Save Order Invoice as paid
324
+ $commentMessage = 'Order automatically imported from iGlobal order ID: '. $this->iglobal_order_id;
325
+ try {
326
+ $order = Mage::getModel("sales/order")->load($id);
327
+ $this->setTransactionInfo($order);
328
+
329
+ $invoices = Mage::getModel('sales/order_invoice')->getCollection()->addAttributeToFilter('order_id', array('eq'=>$order->getId()));
330
+ $invoices->getSelect()->limit(1);
331
+ if ((int)$invoices->count() == 0 && $order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
332
+ if(!$order->canInvoice()) {
333
+ $order->addStatusHistoryComment($commentMessage, false);
334
+ $order->addStatusHistoryComment('iGlobal: Order cannot be invoiced', false);
335
+ $order->save();
336
+ } else {
337
+ $order->addStatusHistoryComment($commentMessage, false);
338
+ $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
339
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
340
+ $invoice->register();
341
+ $invoice->getOrder()->setCustomerNoteNotify(false);
342
+ $invoice->getOrder()->setIsInProcess(true);
343
+ $order->addStatusHistoryComment('Automatically INVOICED by iGlobal', false);
344
+ $transactionSave = Mage::getModel('core/resource_transaction')
345
+ ->addObject($invoice)
346
+ ->addObject($invoice->getOrder());
347
+ $transactionSave->save();
348
+ }
349
+ }
350
+ $this->checkStatus($order);
351
+
352
+ // add customer notes
353
+ if($this->iglobal_order->notes){
354
+ foreach ($this->iglobal_order->notes as $note) {
355
+ if($note->customerNote) {
356
+ $order->addStatusHistoryComment($note->note, false);
357
+ }
358
+ }
359
+ }
360
+ $extraNote = "";
361
+ if($this->iglobal_order->birthDate) {
362
+ $extraNote .= "Birthdate: " . $this->iglobal_order->birthDate . "\n";
363
+ }
364
+ if($this->iglobal_order->nationalIdentifier) {
365
+ $extraNote .= "National Identifier: " . $this->iglobal_order->nationalIdentifier . "\n";
366
+ }
367
+ if($this->iglobal_order->boxCount) {
368
+ $extraNote .= "Boxes: " . $this->iglobal_order->boxCount . "\n";
369
+ }
370
+
371
+ if($extraNote) {
372
+ $order->addStatusHistoryComment($extraNote, false);
373
+ }
374
+ } catch (Exception $e) {
375
+ $order->addStatusHistoryComment('iGlobal Invoicer: Exception occurred during automatically invoicing. Exception message: '.$e->getMessage(), false);
376
+ $order->save();
377
+ }
378
+ if ($this->iglobal_order->testOrder) {
379
+ $order->setIglobalTestOrder(1);
380
+ }
381
+ $order->setIgOrderNumber($this->iglobal_order_id);
382
+ $order->setInternationalOrder(1);
383
+ $order->save();
384
+
385
+ //Send the magento id to iGlobal
386
+ $this->rest->sendMagentoOrderId($this->iglobal_order_id, $order->getIncrementId());
387
+ return $order;
388
+ }
389
+
390
+
391
+ }
app/code/community/Iglobal/Stores.full/Model/Payment/Iglobal.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Payment_Iglobal extends Mage_Payment_Model_Method_Abstract
4
+ {
5
+
6
+ protected $_code = 'iGlobal';
7
+ protected $_canUseInternal = true;
8
+ protected $_canUseCheckout = false;
9
+ protected $_canUseForMultishipping = false;
10
+
11
+ /**
12
+ * Assign data to info model instance
13
+ *
14
+ * @param mixed $data
15
+ * @return Mage_Payment_Model_Info
16
+ */
17
+ public function assignData($data)
18
+ {
19
+ $info = $this->getInfoInstance();
20
+ if ($data instanceof Varien_Object) {
21
+ $data = $data->getData();
22
+ }
23
+ if (is_array($data)) {
24
+ $info->addData($data);
25
+ if(array_key_exists('cardType', $data)) {
26
+ $info->setCcType($data['cardType']);
27
+ }
28
+ $monthMap = array(
29
+ 'JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6,
30
+ 'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12,
31
+ );
32
+ if(array_key_exists('cardExpMonth', $data) and array_key_exists($data['cardExpMonth'],$monthMap)) {
33
+ $info->setCcExpMonth($monthMap[$data['cardExpMonth']]);
34
+ }
35
+ if(array_key_exists('cardExpYear', $data)) {
36
+ $info->setCcExpYear($data['cardExpYear']);
37
+ }
38
+ if(array_key_exists('lastFour', $data)) {
39
+ $info->setCcLast4($data['lastFour']);
40
+ }
41
+ }
42
+ return $this;
43
+ }
44
+
45
+ }
app/code/community/Iglobal/Stores.full/Model/Payment/Iglobalcreditcard.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Payment_IglobalCreditCard extends Iglobal_Stores_Model_Payment_Iglobal
4
+ {
5
+ protected $_code = 'iGlobalCreditCard';
6
+ }
7
+
app/code/community/Iglobal/Stores.full/Model/Payment/Iglobalpaypal.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Payment_IglobalPaypal extends Iglobal_Stores_Model_Payment_Iglobal
4
+ {
5
+ protected $_code = 'iGlobalPaypal';
6
+ }
7
+
app/code/community/Iglobal/Stores.full/Model/Resource/Setup.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
4
+ {
5
+ /**
6
+ * Create an attribute.
7
+ *
8
+ * For reference, see Mage_Adminhtml_Catalog_Product_AttributeController::saveAction().
9
+ *
10
+ * @return int|false
11
+ */
12
+ function createAttribute($labelText, $attributeCode, $inputType, $option = -1, $values = -1, $productTypes = -1)
13
+ {
14
+ $setInfo = array('SetID'=>'4', 'GroupID'=>'7');
15
+ $labelText = trim($labelText);
16
+ $attributeCode = trim($attributeCode);
17
+
18
+ if($labelText == '' || $attributeCode == '')
19
+ {
20
+ //$this->logError("Can't import the attribute with an empty label or code. LABEL= [$labelText] CODE= [$attributeCode]");
21
+ return false;
22
+ }
23
+
24
+ if($values === -1)
25
+ $values = array();
26
+
27
+ if($productTypes === -1)
28
+ $productTypes = array();
29
+
30
+ if($setInfo !== -1 && (isset($setInfo['SetID']) == false || isset($setInfo['GroupID']) == false))
31
+ {
32
+ //$this->logError("Please provide both the set-ID and the group-ID of the attribute-set if you'd like to subscribe to one.");
33
+ return false;
34
+ }
35
+
36
+ //$this->logInfo("Creating attribute [$labelText] with code [$attributeCode].");
37
+
38
+ //>>>> Build the data structure that will define the attribute. See
39
+ // Mage_Adminhtml_Catalog_Product_AttributeController::saveAction().
40
+
41
+ if($inputType === 'text'){
42
+ $data = array(
43
+ 'is_global' => '1',
44
+ 'frontend_input' => 'text',
45
+ 'default_value_text' => '',
46
+ 'default_value_yesno' => '0',
47
+ 'default_value_date' => '',
48
+ 'default_value_textarea' => '',
49
+ 'is_unique' => '0',
50
+ 'is_required' => '0',
51
+ 'frontend_class' => 'validate-number',
52
+ 'is_searchable' => '0',
53
+ 'is_visible_in_advanced_search' => '0',
54
+ 'is_comparable' => '0',
55
+ 'is_used_for_promo_rules' => '0',
56
+ 'is_html_allowed_on_front' => '1',
57
+ 'is_visible_on_front' => '0',
58
+ 'used_in_product_listing' => '0',
59
+ 'used_for_sort_by' => '0',
60
+ 'is_configurable' => '0',
61
+ 'is_filterable' => '0',
62
+ 'is_filterable_in_search' => '0',
63
+ 'backend_type' => 'varchar',
64
+ 'default_value' => '',
65
+ );
66
+ }
67
+ elseif($inputType === 'select'){
68
+ $data = array(
69
+ 'is_global' => '1',
70
+ 'frontend_input' => 'select',
71
+ 'default_value_text' => '',
72
+ 'default_value_yesno' => '0',
73
+ 'default_value_date' => '',
74
+ 'default_value_textarea' => '',
75
+ 'is_unique' => '0',
76
+ 'is_required' => '1',
77
+ 'frontend_class' => '',
78
+ 'is_searchable' => '0',
79
+ 'is_visible_in_advanced_search' => '0',
80
+ 'is_comparable' => '0',
81
+ 'is_used_for_promo_rules' => '0',
82
+ 'is_html_allowed_on_front' => '1',
83
+ 'is_visible_on_front' => '0',
84
+ 'used_in_product_listing' => '0',
85
+ 'used_for_sort_by' => '0',
86
+ 'is_configurable' => '0',
87
+ 'is_filterable' => '0',
88
+ 'is_filterable_in_search' => '0',
89
+ 'backend_type' => 'int',
90
+ 'default_value' => '',
91
+ );
92
+ }
93
+ // Now, overlay the incoming values on to the defaults.
94
+ foreach($values as $key => $newValue)
95
+ if(isset($data[$key]) == false)
96
+ {
97
+ //$this->logError("Attribute feature [$key] is not valid.");
98
+ return false;
99
+ }
100
+
101
+ else
102
+ $data[$key] = $newValue;
103
+
104
+ // Valid product types: simple, grouped, configurable, virtual, bundle, downloadable, giftcard
105
+ $data['apply_to'] = $productTypes;
106
+ $data['attribute_code'] = $attributeCode;
107
+ $data['frontend_label'] = array(
108
+ 0 => $labelText,
109
+ 1 => '',
110
+ 3 => '',
111
+ 2 => '',
112
+ 4 => '',
113
+ );
114
+
115
+ //<<<<
116
+
117
+ //>>>> Build the model.
118
+
119
+ $model = Mage::getModel('catalog/resource_eav_attribute');
120
+
121
+ $model->addData($data);
122
+
123
+ if($setInfo !== -1)
124
+ {
125
+ $model->setAttributeSetId($setInfo['SetID']);
126
+ $model->setAttributeGroupId($setInfo['GroupID']);
127
+ }
128
+
129
+ $entityTypeID = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
130
+ $model->setEntityTypeId($entityTypeID);
131
+
132
+ $model->setIsUserDefined(1);
133
+
134
+ //<<<<
135
+
136
+ // Save.
137
+
138
+ try
139
+ {
140
+ $model->save();
141
+ }
142
+ catch(Exception $ex)
143
+ {
144
+ // $this->logError("Attribute [$labelText] could not be saved: " . $ex->getMessage());
145
+ return false;
146
+ }
147
+ $id = $model->getId();
148
+
149
+ if($inputType=='select' && $option !== -1){
150
+ $option['attribute_id'] = $id;
151
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
152
+ $setup->addAttributeOption($option);
153
+ }
154
+
155
+
156
+ //$this->logInfo("Attribute [$labelText] has been saved as ID ($id).");
157
+
158
+ return $id;
159
+ }
160
+ }
app/code/community/Iglobal/Stores.full/Model/Rest.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Rest extends Mage_Core_Model_Abstract
4
+ {
5
+ protected $_entryPoint = 'https://api.iglobalstores.com/';
6
+ protected $_store = 3; // default store ID
7
+ protected $_key = '';
8
+
9
+ protected function _construct()
10
+ {
11
+ //set store ID
12
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid')) {
13
+ $this->_store = Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid');
14
+ }
15
+ //Set API Key
16
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/secret')) {
17
+ $this->_key = Mage::getStoreConfig('iglobal_integration/apireqs/secret');
18
+ }
19
+ }
20
+
21
+ protected function callApi($path, $data, $headers=array())
22
+ {
23
+ $client = new Zend_Http_Client($this->_entryPoint . $path);
24
+ $data = json_encode(array_merge($data, array('store' => $this->_store, 'secret' => $this->_key)));
25
+ $response = $client
26
+ ->setRawData($data, 'application/json')
27
+ ->setHeaders($headers)
28
+ ->request('POST');
29
+
30
+ if ($response->isSuccessful())
31
+ {
32
+ return json_decode($response->getBody());
33
+ }
34
+ return false;
35
+
36
+ }
37
+
38
+ public function getAllOrders()
39
+ {
40
+ $data = array('sinceDate'=>'20100101');
41
+ return $this->callApi('v1/orderNumbers', $data);
42
+ }
43
+
44
+ public function getAllOrdersSinceDate($data)
45
+ {
46
+ $data = array('sinceDate'=>$data);
47
+ return $this->callApi('v1/orderNumbers', $data);
48
+ }
49
+
50
+ public function getOrder($order)
51
+ {
52
+ $data = array('orderId' => $order);
53
+ return $this->callApi('v2/orderDetail', $data);
54
+ }
55
+
56
+ public function sendMagentoOrderId($igc_order_id, $magento_order_id) {
57
+ $data = array('orderId' => $igc_order_id, 'merchantOrderId' => $magento_order_id);
58
+ return $this->callApi('v1/updateMerchantOrderId', $data);
59
+ }
60
+
61
+ public function createTempCart(array $data)
62
+ {
63
+ return $this->callApi('v1/createTempCart', $data);
64
+ }
65
+
66
+ public function getRegionId($countryId, $region, $orderid)
67
+ {
68
+ $data = array('countryCode'=> $countryId,'region'=> $region, 'orderId' => $orderid);
69
+ return $this->callApi(
70
+ 'v1/magento-region',
71
+ $data,
72
+ array("serviceToken" => "31ae7155-5b9e-461f-8353-9a8c3f8ae35974ffec3a-88dc-4acb-8420-270df7967338")
73
+ );
74
+ }
75
+ }
app/code/community/Iglobal/Stores.full/Model/Service/Quote.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Service_Quote extends Mage_Sales_Model_Service_Quote
4
+ {
5
+ protected function _validate()
6
+ {
7
+ return $this;
8
+ }
9
+ }
app/code/community/Iglobal/Stores.full/Model/Tax.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iglobal_Stores_Model_Tax extends Mage_Sales_Model_Quote_Address_Total_Abstract
3
+ {
4
+ protected $_code = 'tax';
5
+ public function setCode($code)
6
+ {
7
+ // store the international fee in the tax field.
8
+ return $this;
9
+ }
10
+ public function collect(Mage_Sales_Model_Quote_Address $address)
11
+ {
12
+ if(Mage::getStoreConfig('iglobal_integration/apireqs/ice_toggle'))
13
+ {
14
+ $fee = Mage::registry('duty_tax');
15
+ if ($fee)
16
+ {
17
+ $this->_setAddress($address);
18
+ $this->_setAmount($fee);
19
+ $this->_setBaseAmount($fee);
20
+ }
21
+ }
22
+ return $this;
23
+ }
24
+ }
25
+
app/code/community/Iglobal/Stores.full/controllers/AjaxController.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_AjaxController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+
8
+ echo Mage::getBaseUrl();
9
+ $this->loadLayout();
10
+ $this->renderLayout();
11
+ }
12
+
13
+ public function icedataAction () {
14
+
15
+ //storeID for ice
16
+ $iceData = array ();
17
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid')) {
18
+ $iceData['storeId'] = Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid');
19
+ }
20
+ //subdomain for iCE
21
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain')) {
22
+ $iceData['subdomain'] = Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain');
23
+ }
24
+
25
+ //Cart Url for redirects
26
+ $iceData['cartUrl'] = Mage::getUrl('checkout/cart');
27
+ //echo $iceData['cartUrl'];
28
+
29
+ //Zend_Debug::dump($iceData);
30
+
31
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($iceData));
32
+
33
+ }
34
+
35
+ public function matdataAction () {
36
+ $this->getResponse()->setBody(Mage::helper('stores')->getJavascriptVars());
37
+ }
38
+ }
app/code/community/Iglobal/Stores.full/controllers/CheckoutController.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //
3
+ // Load the iGlobal hosted checkout in an iframe, cause it's awesome
4
+ //
5
+ class Iglobal_Stores_CheckoutController extends Mage_Core_Controller_Front_Action
6
+ {
7
+ public function indexAction()
8
+ {
9
+ //check to see if they are domestic and then redirect to domestic checkout
10
+ $helper = Mage::helper('stores');
11
+ if($helper->isDomestic()){
12
+ $this->_redirect('checkout/onepage');
13
+ return;
14
+ }
15
+
16
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/force_login') && !Mage::getSingleton('customer/session')->isLoggedIn()) {
17
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('iglobal/checkout'));
18
+ Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'));
19
+ }
20
+
21
+ $cartQty = (int) Mage::getModel('checkout/cart')->getQuote()->getItemsQty();
22
+ if (!$cartQty) {
23
+ $this->_redirect('checkout/cart');
24
+ return;
25
+ }
26
+
27
+ $tempcart = Mage::getModel('stores/international_international');
28
+
29
+ if (!$tempcart) {
30
+ echo "No tempcart!";
31
+ die();
32
+ }
33
+
34
+ $cartId = $tempcart->getTempCartId();
35
+ $url = $helper->getCheckoutUrl($cartId);
36
+
37
+ if(Mage::getStoreConfig('iglobal_integration/apireqs/use_iframe')) {
38
+ // echo out the html that will build the iframe
39
+ $domCode = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
40
+ $domCode .= '<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>International Checkout</title>';
41
+ $domCode .= '<style type="text/css"> body, html {margin: 0; padding: 0; height: 100%; overflow: hidden;} #content{position:absolute; left: 0; right: 0; bottom: 0; top: 0;} </style>';
42
+ $domCode .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
43
+ $domCode .= '</head><body>';
44
+ $domCode .= '<div id="content"><iframe width="100%" height="100%" frameborder="0" src="';
45
+ $domCode .= $url . '"/></div></body></html>';
46
+ echo $domCode;
47
+ } else {
48
+ $this->_redirectUrl($url);
49
+ }
50
+ }
51
+
52
+ }
app/code/community/Iglobal/Stores.full/controllers/SuccessController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_SuccessController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+
8
+
9
+ $_order = $this->getRequest()->getParam('orderId', null);
10
+ try
11
+ {
12
+ $quote = Mage::getSingleton('checkout/session')->getQuote()->setStoreId(Mage::app()->getStore()->getId());
13
+ $order = Mage::getModel('sales/order')->loadByAttribute('ig_order_number', $_order);
14
+
15
+ if(!$_order ) {
16
+ header('Location: /');
17
+ die();
18
+ } else if($order->getId()) {
19
+ Mage::getModel('stores/order')->checkStatus($order);
20
+ } else {
21
+ $order = Mage::getModel('stores/order')->processOrder($_order, $quote);
22
+ }
23
+ }
24
+ catch(Exception $e)
25
+ {
26
+ $adminEmail = false;
27
+ //die($e);
28
+ if (Mage::getStoreConfig('iglobal_integration/apireqs/admin_email')) {
29
+ $adminEmail = Mage::getStoreConfig('iglobal_integration/apireqs/admin_email');
30
+ }
31
+ mail('monitoring@iglobalstores.com', 'Magento Integration Error - International order failed to import', 'International order# '. $_order .'.'. ' Exception Message: '.$e->getMessage());
32
+ mail('magentomissedorders@iglobalstores.com', 'Magento Integration Error - International order failed to import', 'International order# '. $_order .'.'. ' Exception Message: '.$e->getMessage());
33
+ if ($adminEmail) {
34
+ mail($adminEmail, 'iGlobal Import Error - International order failed to import', 'iGlobal International order# '. $_order . " failed to import properly. We've already received notice of the problem, and are probably working on it as you read this. Until then, you may manually enter the order, or give us a call for help at 1-800-942-0721." );
35
+ }
36
+ Mage::log("International order #{$_order} failed to import!" .$e, Zend_Log::ERR, 'iglobal.log', true);
37
+ }
38
+
39
+ $this->loadLayout();
40
+
41
+ $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
42
+ Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
43
+
44
+ $this->renderLayout();
45
+ }
46
+
47
+ }
app/code/community/Iglobal/Stores.full/etc/adminhtml.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @package jQuery Library.
5
+ * @author: A.A.Treitjak
6
+ * @copyright: 2012 - 2013 BelVG.com
7
+ */
8
+ -->
9
+ <config>
10
+ <acl>
11
+ <resources>
12
+ <all>
13
+ <title>Allow Everything</title>
14
+ </all>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <iglobal_integration>
22
+ <title>iGlobal Stores Integration Options</title>
23
+ </iglobal_integration>
24
+ <jquery translate="title">
25
+ <title>jQuery Library</title>
26
+ </jquery>
27
+ </children>
28
+ </config>
29
+ </children>
30
+ </system>
31
+ </children>
32
+ </admin>
33
+ </resources>
34
+ </acl>
35
+ </config>
app/code/community/Iglobal/Stores.full/etc/config.xml ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Iglobal_Stores>
5
+ <version>1.5.5</version>
6
+ <currencies>
7
+ <AED></AED>
8
+ <ARS>&amp;#8371;</ARS>
9
+ <AUD>&amp;#36;</AUD>
10
+ <BRL>R&amp;#36;</BRL>
11
+ <CAD>&amp;#36;</CAD>
12
+ <CHF></CHF>
13
+ <CLP>&amp;#36;</CLP>
14
+ <CNY>&amp;#165;</CNY>
15
+ <DKK>kr.</DKK>
16
+ <EUR>&amp;euro;</EUR>
17
+ <GBP>&amp;pound;</GBP>
18
+ <HKD>&amp;#36;</HKD>
19
+ <HUF></HUF>
20
+ <ILS>&amp;#8362;</ILS>
21
+ <INR>&amp;#8377;</INR>
22
+ <JPY>&#165;</JPY>
23
+ <KWD></KWD>
24
+ <MXN>&amp;#36;</MXN>
25
+ <MYR>RM</MYR>
26
+ <NOK>kr.</NOK>
27
+ <NZD>&amp;#36;</NZD>
28
+ <RUB>r.</RUB>
29
+ <SEK>kr.</SEK>
30
+ <SGD>S&amp;#36;</SGD>
31
+ <THB>&amp;#3647;</THB>
32
+ <TWD>NT&amp;#36;</TWD>
33
+ <USD>&amp;#36;</USD>
34
+ </currencies>
35
+ <countries>
36
+ <AL label="Albania">USD</AL>
37
+ <AS label="American Samoa">USD</AS>
38
+ <AD label="Andorra">EUR</AD>
39
+ <AI label="Anguilla">USD</AI>
40
+ <AG label="Antigua and Barbuda">USD</AG>
41
+ <AR label="Argentina">ARS</AR>
42
+ <AM label="Armenia">USD</AM>
43
+ <AW label="Aruba">USD</AW>
44
+ <AU label="Australia">AUD</AU>
45
+ <AT label="Austria">EUR</AT>
46
+
47
+ <BS label="Bahamas">USD</BS>
48
+ <BB label="Barbados">USD</BB>
49
+ <BE label="Belgium">EUR</BE>
50
+ <BZ label="Belize">USD</BZ>
51
+ <BM label="Bermuda">USD</BM>
52
+ <BQ label="Bonaire, Sint Eustatius and Saba">USD</BQ>
53
+ <BR label="Brazil">BRL</BR>
54
+ <BG label="Bulgaria">USD</BG>
55
+
56
+ <KH label="Cambodia">USD</KH>
57
+ <CA label="Canada">CAD</CA>
58
+ <IC label="Canary Islands">EUR</IC>
59
+ <KY label="Cayman Islands">USD</KY>
60
+ <CL label="Chile">CLP</CL>
61
+ <CN label="China">CNY</CN>
62
+ <CR label="Costa Rica">USD</CR>
63
+ <CK label="Cook Islands">NZD</CK>
64
+ <CY label="Cyprus">EUR</CY>
65
+
66
+ <DK label="Denmark">DKK</DK>
67
+ <DM label="Dominica">USD</DM>
68
+ <DO label="Dominican Republic">USD</DO>
69
+
70
+ <EC label="Ecuador">USD</EC>
71
+ <SV label="El Salvador">USD</SV>
72
+ <ER label="Eritrea">USD</ER>
73
+ <EE label="Estonia">EUR</EE>
74
+ <ET label="Ethiopia">USD</ET>
75
+
76
+ <FO label="Faroe Islands">DKK</FO>
77
+ <FI label="Finland">EUR</FI>
78
+ <FR label="France">EUR</FR>
79
+ <GF label="French Guiana">EUR</GF>
80
+ <PF label="French Polynesia">USD</PF>
81
+
82
+ <DE label="Germany">EUR</DE>
83
+ <GR label="Greece">EUR</GR>
84
+ <GL label="Greenland">DKK</GL>
85
+ <GD label="Grenada">USD</GD>
86
+ <GP label="Guadeloupe">EUR</GP>
87
+ <GU label="Guam">USD</GU>
88
+ <GT label="Guatemala">USD</GT>
89
+ <GY label="Guyana">USD</GY>
90
+
91
+ <HK label="Hong Kong">HKD</HK>
92
+ <HU label="Hungary">HUF</HU>
93
+
94
+ <IS label="Iceland">USD</IS>
95
+ <IN label="India">INR</IN>
96
+ <IE label="Ireland">EUR</IE>
97
+ <IL label="Israel">ILS</IL>
98
+ <IT label="Italy">EUR</IT>
99
+
100
+ <JM label="Jamaica">USD</JM>
101
+ <JP label="Japan">JPY</JP>
102
+ <JO label="Jordan">USD</JO>
103
+
104
+ <KI label="Kiribati">AUD</KI>
105
+ <KW label="Kuwait">KWD</KW>
106
+
107
+ <LT label="Lithuania">USD</LT>
108
+ <LU label="Luxembourg">EUR</LU>
109
+
110
+ <MY label="Malaysia">MYR</MY>
111
+ <MV label="Maldives">USD</MV>
112
+ <MT label="Malta">EUR</MT>
113
+ <MX label="Mexico">MXN</MX>
114
+ <MP label="Northern Mariana Islands">USD</MP>
115
+ <MH label="Marshall Islands">USD</MH>
116
+ <MQ label="Martinique">EUR</MQ>
117
+ <FM label="Micronesia, Federated States of">USD</FM>
118
+ <MD label="Moldova, Republic of">USD</MD>
119
+ <MC label="Monaco">EUR</MC>
120
+ <MS label="Montserrat">USD</MS>
121
+
122
+ <NL label="Netherlands">EUR</NL>
123
+ <NZ label="New Zealand">NZD</NZ>
124
+ <NI label="Nicaragua">USD</NI>
125
+ <NO label="Norway">NOK</NO>
126
+
127
+ <PK label="Pakistan">USD</PK>
128
+ <PW label="Palau">USD</PW>
129
+ <PA label="Panama">USD</PA>
130
+ <PY label="Paraguay">USD</PY>
131
+ <PL label="Poland">USD</PL>
132
+ <PT label="Portugal">EUR</PT>
133
+ <PR label="Puerto Rico">USD</PR>
134
+
135
+ <RO label="Romania">USD</RO>
136
+ <RU label="Russia">RUB</RU>
137
+
138
+ <BL label="Saint Barthélemy">EUR</BL>
139
+ <KN label="Saint Kitts and Nevis">USD</KN>
140
+ <LC label="Saint Lucia">USD</LC>
141
+ <SX label="Saint Maarten">USD</SX>
142
+ <VC label="Saint Vincent and the Grenadines">USD</VC>
143
+ <WS label="Samoa">USD</WS>
144
+ <SM label="San Marino">EUR</SM>
145
+ <ST label="Sao Tome and Principe">USD</ST>
146
+ <SC label="Seychelles">USD</SC>
147
+ <SG label="Singapore">SGD</SG>
148
+ <SK label="Slovakia">EUR</SK>
149
+ <SI label="Slovenia">EUR</SI>
150
+ <ES label="Spain">EUR</ES>
151
+ <SE label="Sweden">SEK</SE>
152
+ <CH label="Switzerland">CHF</CH>
153
+
154
+ <TW label="Taiwan">TWD</TW>
155
+ <TH label="Thailand">THB</TH>
156
+ <TC label="Turks and Caicos Islands">USD</TC>
157
+
158
+ <AE label="United Arab Emirates">AED</AE>
159
+ <GB label="United Kingdom">GBP</GB>
160
+ <US label="United States">USD</US>
161
+ <UY label="Uruguay">USD</UY>
162
+
163
+ <VU label="Vanuatu">USD</VU>
164
+ <VE label="Venezuela, Bolivarian Republic of">USD</VE>
165
+ <VN label="Viet Nam">USD</VN>
166
+ <VI label="Virgin Islands, U.S.">USD</VI>
167
+
168
+ <!--<KY>KYD</KY>-->
169
+ </countries>
170
+ </Iglobal_Stores>
171
+ </modules>
172
+ <global>
173
+ <sales>
174
+ <quote>
175
+ <totals>
176
+ <fee>
177
+ <class>stores/tax</class>
178
+ <after>tax</after>
179
+ <before>grand_total</before>
180
+ </fee>
181
+ </totals>
182
+ </quote>
183
+ </sales>
184
+ <events>
185
+ <core_block_abstract_prepare_layout_before>
186
+ <observers>
187
+ <iglobal_stores_prepare_layout_before>
188
+ <class>stores/observer</class>
189
+ <method>prepareLayoutBefore</method>
190
+ </iglobal_stores_prepare_layout_before>
191
+ </observers>
192
+ </core_block_abstract_prepare_layout_before>
193
+ <sales_order_place_after>
194
+ <observers>
195
+ <iglobal_stores_model_observer_order_created>
196
+ <type>singleton</type>
197
+ <class>Iglobal_Stores_Model_Observer</class>
198
+ <method>orderCreated</method>
199
+ </iglobal_stores_model_observer_order_created>
200
+ </observers>
201
+ </sales_order_place_after>
202
+ </events>
203
+ <models>
204
+ <stores>
205
+ <class>Iglobal_Stores_Model</class>
206
+ </stores>
207
+ </models>
208
+ <blocks>
209
+ <stores>
210
+ <class>Iglobal_Stores_Block</class>
211
+ </stores>
212
+ <checkout>
213
+ <rewrite>
214
+ <onepage_link>Iglobal_Stores_Block_Link</onepage_link>
215
+ </rewrite>
216
+ </checkout>
217
+ </blocks>
218
+ <helpers>
219
+ <stores>
220
+ <class>Iglobal_Stores_Helper</class>
221
+ </stores>
222
+ <checkout>
223
+ <rewrite>
224
+ <url>Iglobal_Stores_Helper_Url</url>
225
+ </rewrite>
226
+ </checkout>
227
+ </helpers>
228
+ <resources>
229
+ <iglobal_stores_setup>
230
+ <setup>
231
+ <module>Iglobal_Stores</module>
232
+ <class>Iglobal_Stores_Model_Resource_Setup</class>
233
+ </setup>
234
+ </iglobal_stores_setup>
235
+ </resources>
236
+ </global>
237
+ <frontend>
238
+ <routers>
239
+ <iglobal>
240
+ <use>standard</use>
241
+ <args>
242
+ <module>Iglobal_Stores</module>
243
+ <frontName>iglobal</frontName>
244
+ </args>
245
+ </iglobal>
246
+ <checkout>
247
+ <args>
248
+ <modules>
249
+ <Iglobal_Stores before="Mage_Cart">Iglobal_Stores</Iglobal_Stores>
250
+ </modules>
251
+ </args>
252
+ </checkout>
253
+ </routers>
254
+ <layout>
255
+ <updates>
256
+ <stores>
257
+ <file>iglobal.xml</file>
258
+ </stores>
259
+ </updates>
260
+ </layout>
261
+ </frontend>
262
+ <default>
263
+ <payment>
264
+ <iGlobal>
265
+ <active>1</active>
266
+ <model>stores/payment_iglobal</model>
267
+ <order_status>pending</order_status>
268
+ <title>iGlobal International Payment</title>
269
+ <allowspecific>0</allowspecific>
270
+ <group>offline</group>
271
+ </iGlobal>
272
+ <iGlobalCreditCard>
273
+ <active>1</active>
274
+ <model>stores/payment_iglobalcreditcard</model>
275
+ <order_status>pending</order_status>
276
+ <title>iGlobal International Credit Card Payment</title>
277
+ <allowspecific>0</allowspecific>
278
+ <group>offline</group>
279
+ </iGlobalCreditCard>
280
+ <iGlobalPaypal>
281
+ <active>1</active>
282
+ <model>stores/payment_iglobalpaypal</model>
283
+ <order_status>pending</order_status>
284
+ <title>iGlobal International PayPal Payment</title>
285
+ <allowspecific>0</allowspecific>
286
+ <group>offline</group>
287
+ </iGlobalPaypal>
288
+ </payment>
289
+ <carriers>
290
+ <ig>
291
+ <active>1</active>
292
+ <model>stores/carrier</model>
293
+ <title>iGlobal</title>
294
+ <name>International Shipping</name>
295
+ <price>0.00</price>
296
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this
297
+ shipping method, please contact us.
298
+ </specificerrmsg>
299
+ </ig>
300
+ </carriers>
301
+ <iglobal_integration>
302
+ <apireqs>
303
+ <secret>Your API Code Goes Here</secret>
304
+ <iglobalid>Your Store ID Goes Here</iglobalid>
305
+ <ice_toggle>0</ice_toggle>
306
+ <use_iframe>1</use_iframe>
307
+ </apireqs>
308
+ <igmat>
309
+ <welcome_mat_active>0</welcome_mat_active>
310
+ </igmat>
311
+ <igjq>
312
+ <enabled>0</enabled>
313
+ </igjq>
314
+ <igc_dev>
315
+ <dev_on>0</dev_on>
316
+ </igc_dev>
317
+ <ig_item_attribute>
318
+ <weight>weight</weight>
319
+ <length>ig_length</length>
320
+ <width>ig_width</width>
321
+ <height>ig_height</height>
322
+ <country_of_origin>country_of_manufacture</country_of_origin>
323
+ </ig_item_attribute>
324
+ </iglobal_integration>
325
+ <general>
326
+ <country>
327
+ <ig_domestic_countries>US</ig_domestic_countries>
328
+ </country>
329
+ </general>
330
+ </default>
331
+ <adminhtml>
332
+ <acl>
333
+ <resources>
334
+ <admin>
335
+ <children>
336
+ <system>
337
+ <children>
338
+ <config>
339
+ <children>
340
+ <iglobal_integration>
341
+ <title>iGlobal Stores Integration Options</title>
342
+ </iglobal_integration>
343
+ </children>
344
+ </config>
345
+ </children>
346
+ </system>
347
+ </children>
348
+ </admin>
349
+ </resources>
350
+ </acl>
351
+ <layout>
352
+ <updates>
353
+ <iglobal>
354
+ <file>iglobal.xml</file>
355
+ </iglobal>
356
+ </updates>
357
+ </layout>
358
+ </adminhtml>
359
+ <crontab>
360
+ <jobs>
361
+ <iglobal_order_update>
362
+ <schedule>
363
+ <cron_expr>*/30 * * * *</cron_expr>
364
+ </schedule>
365
+ <run>
366
+ <model>stores/observer::orderRec</model>
367
+ </run>
368
+ </iglobal_order_update>
369
+ </jobs>
370
+ </crontab>
371
+ </config>
app/code/community/Iglobal/Stores.full/etc/system.xml ADDED
@@ -0,0 +1,653 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <tabs>
5
+ <iglobal translate="label" module="stores">
6
+ <label>iGlobal Stores</label>
7
+ <sort_order>150</sort_order>
8
+ </iglobal>
9
+ </tabs>
10
+
11
+ <sections>
12
+ <general>
13
+
14
+ <groups>
15
+ <country>
16
+
17
+ <fields>
18
+
19
+ <ig_domestic_countries>
20
+ <label>Domestic Shipping Countries</label>
21
+ <comment>Hold down Ctrl to select more than one. Select each country to which you will ship. iGlobal will not service these countries, and customers will use your checkout system.</comment>
22
+ <frontend_type>multiselect</frontend_type>
23
+ <source_model>adminhtml/system_config_source_country</source_model>
24
+ <sort_order>2</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ <can_be_empty>1</can_be_empty>
29
+ </ig_domestic_countries>
30
+
31
+ </fields>
32
+ </country>
33
+ </groups>
34
+
35
+ </general>
36
+ </sections>
37
+
38
+ <sections>
39
+ <iglobal_integration translate="label" module="stores">
40
+ <label>iGlobal Integration</label>
41
+ <tab>iglobal</tab>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>1000</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+
48
+ <groups>
49
+ <apireqs translate="label">
50
+ <label>Store Setup</label>
51
+ <comment><![CDATA[ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;"><strong>iGlobal wants to help!</strong> You can always <a href="http://academy.iglobalstores.com/" target="_blank">learn more about how we can increase your sales</a> or if you have any questions or problems <a href="http://www.iglobalstores.com/contact-us.html" target="_blank">contact us online</a> or call 1-800-942-0721.<br /></div>]]></comment>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>10</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+
58
+ <fields>
59
+
60
+ <heading_id translate="label">
61
+ <label>Store Identification</label>
62
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
63
+ <sort_order>10</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>0</show_in_store>
67
+ </heading_id>
68
+
69
+ <iglobalid>
70
+ <label>iGlobal Store ID Number</label>
71
+ <comment>Paste the provided 3 digit store number here.</comment>
72
+ <frontend_type>text</frontend_type>
73
+ <sort_order>20</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </iglobalid>
78
+
79
+ <secret>
80
+ <label>iGlobal API Key</label>
81
+ <comment>Paste the provided API secret security key here.</comment>
82
+ <frontend_type>text</frontend_type>
83
+ <sort_order>30</sort_order>
84
+ <show_in_default>1</show_in_default>
85
+ <show_in_website>1</show_in_website>
86
+ <show_in_store>1</show_in_store>
87
+ </secret>
88
+
89
+ <igsubdomain>
90
+ <label>iGlobal Hosted Checkout Subdomain</label>
91
+ <comment>Paste the provided subdomain here.</comment>
92
+ <frontend_type>text</frontend_type>
93
+ <sort_order>35</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </igsubdomain>
98
+
99
+ <heading_includes translate="label">
100
+ <label>Included Files</label>
101
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
102
+ <sort_order>40</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>0</show_in_store>
106
+ </heading_includes>
107
+
108
+ <ice>
109
+ <label>ICE script</label>
110
+ <comment>Paste the provided link here. Please Be sure to include "https://" at the beginning.</comment>
111
+ <frontend_type>text</frontend_type>
112
+ <sort_order>50</sort_order>
113
+ <show_in_default>1</show_in_default>
114
+ <show_in_website>1</show_in_website>
115
+ <show_in_store>1</show_in_store>
116
+ </ice>
117
+
118
+ <ice_toggle>
119
+ <label>Turn on International Checkout?</label>
120
+ <comment>Turn on to enable iGlobal International Checkout. Leave this off until setup and testing has been completed!</comment>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_yesno</source_model>
123
+ <sort_order>5</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </ice_toggle>
128
+
129
+ <use_iframe>
130
+ <label>Embed iGlobal Checkout by iframe?</label>
131
+ <comment>Embed the iGlobal Checkout into your site, making customers feel more secure by seeing your url and improving the user experience.</comment>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>adminhtml/system_config_source_yesno</source_model>
134
+ <sort_order>42</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
+ </use_iframe>
139
+
140
+ <use_ice>
141
+ <label>Use an iCE Integration File?</label>
142
+ <comment>Turn on to use an iGlobal Connect Engine Integration Method instead of the default method. This should only be selected if suggested by an iGlobal Integration Specialist.</comment>
143
+ <frontend_type>select</frontend_type>
144
+ <source_model>adminhtml/system_config_source_yesno</source_model>
145
+ <sort_order>45</sort_order>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>1</show_in_store>
149
+ </use_ice>
150
+
151
+ <heading_checkout translate="label">
152
+ <label>Checkout Options</label>
153
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
154
+ <sort_order>90</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ </heading_checkout>
159
+
160
+ <send_order_email>
161
+ <label>Send Order Email</label>
162
+ <comment>Send a confirmation email after the order is placed (iGlobal may also send a confirmation email, depending on the settings you requested)</comment>
163
+ <frontend_type>select</frontend_type>
164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
165
+ <sort_order>100</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </send_order_email>
170
+
171
+ <heading_error translate="label">
172
+ <label>Error Reporting</label>
173
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
174
+ <sort_order>110</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ </heading_error>
179
+
180
+ <admin_email>
181
+ <label>Admin Email Address</label>
182
+ <comment>This email address will receive notices of errors</comment>
183
+ <frontend_type>text</frontend_type>
184
+ <sort_order>120</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>1</show_in_store>
188
+ </admin_email>
189
+
190
+ <heading_force_login translate="label">
191
+ <label>Customer Login</label>
192
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
193
+ <sort_order>130</sort_order>
194
+ <show_in_default>1</show_in_default>
195
+ <show_in_website>1</show_in_website>
196
+ <show_in_store>0</show_in_store>
197
+ </heading_force_login>
198
+
199
+ <force_login>
200
+ <label>Require Account for Checkout</label>
201
+ <comment>If yes, The option "Redirect Customer to Account Dashboard after Logging in" needs to be set to "No" in the Customer Configuration > Login Options.</comment>
202
+ <frontend_type>select</frontend_type>
203
+ <source_model>adminhtml/system_config_source_yesno</source_model>
204
+ <sort_order>140</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
+ </force_login>
209
+
210
+ </fields>
211
+ </apireqs>
212
+
213
+ <igmat translate="label">
214
+ <label>iGlobal Welcome Mat</label>
215
+ <frontend_type>text</frontend_type>
216
+ <sort_order>15</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>
221
+ <![CDATA[ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">iGlobal's unique welcome mat will recognize your customers' location and automatically tailor their shopping experience to make it seamless and increase your conversions! If you have any questions or problems <a href="http://www.iglobalstores.com/contact-us.html" target="_blank">contact us online</a> or call 1-800-942-0721.<br /></div>]]>
222
+ </comment>
223
+
224
+ <fields>
225
+
226
+ <welcome_mat_active translate="label comment">
227
+ <label>Use the Welcome Mat?</label>
228
+ <comment>For testing purposes you may use the default Welcome Mat by leaving the "Welcome Mat Script" field blank. This may result in poor appearance or strange behavior, and should be used only for testing and development. Please contact us at 1-800-942-0721 to have use make a customized script to match your site's style and design.</comment>
229
+ <frontend_type>select</frontend_type>
230
+ <source_model>adminhtml/system_config_source_yesno</source_model>
231
+ <sort_order>10</sort_order>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>1</show_in_store>
235
+ </welcome_mat_active>
236
+
237
+ <welcome_mat_script translate="label comment">
238
+ <label>Welcome Mat Script File</label>
239
+ <frontend_type>file</frontend_type>
240
+ <backend_model>adminhtml/system_config_backend_file</backend_model>
241
+ <upload_dir>js/iGlobal</upload_dir>
242
+ <sort_order>20</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>1</show_in_website>
245
+ <show_in_store>1</show_in_store>
246
+ <!--<depends><welcome_mat_active>1</welcome_mat_active></depends>-->
247
+ </welcome_mat_script>
248
+
249
+ <welcome_mat_css translate="label comment">
250
+ <label>Welcome Mat CSS File</label>
251
+ <frontend_type>file</frontend_type>
252
+ <backend_model>adminhtml/system_config_backend_file</backend_model>
253
+ <upload_dir>js/iGlobal</upload_dir>
254
+ <sort_order>30</sort_order>
255
+ <show_in_default>1</show_in_default>
256
+ <show_in_website>1</show_in_website>
257
+ <show_in_store>1</show_in_store>
258
+ <!--<depends><welcome_mat_active>1</welcome_mat_active></depends>-->
259
+ </welcome_mat_css>
260
+
261
+ <flag_parent>
262
+ <label>Flag position selector</label>
263
+ <comment>Enter the code provided to customize the location of the Welcome Mat flag, or leave blank to use the default location.</comment>
264
+ <frontend_type>text</frontend_type>
265
+ <sort_order>40</sort_order>
266
+ <show_in_default>1</show_in_default>
267
+ <show_in_website>1</show_in_website>
268
+ <show_in_store>1</show_in_store>
269
+ <!--<depends><welcome_mat_active>1</welcome_mat_active></depends>-->
270
+ </flag_parent>
271
+
272
+ <!-- <flag_method>
273
+ <label>Flag attachment method</label>
274
+ <comment>Enter the code provided to customize the location of the Welcome Mat flag, or leave blank to use the default location.</comment>
275
+ <frontend_type>select</frontend_type>
276
+ <source_model>iglobal_stores/system_config_source_dropdown_method</source_model>
277
+ <sort_order>41</sort_order>
278
+ <show_in_default>1</show_in_default>
279
+ <show_in_website>1</show_in_website>
280
+ <show_in_store>1</show_in_store>
281
+ <depends>
282
+ <welcome_mat_active>1</welcome_mat_active>
283
+ </depends>
284
+ </flag_method> -->
285
+
286
+ <flag_method>
287
+ <label>Flag insertion method</label>
288
+ <comment>Enter the code provided to customize the location of the Welcome Mat flag, or leave blank to use the default location.</comment>
289
+ <frontend_type>text</frontend_type>
290
+ <sort_order>42</sort_order>
291
+ <show_in_default>1</show_in_default>
292
+ <show_in_website>1</show_in_website>
293
+ <show_in_store>1</show_in_store>
294
+ <!--<depends><welcome_mat_active>1</welcome_mat_active></depends>-->
295
+ </flag_method>
296
+
297
+ <flag_code>
298
+ <label>Flag insertion code</label>
299
+ <comment>Enter the code provided to customize the location of the Welcome Mat flag, or leave blank to use the default location.</comment>
300
+ <frontend_type>text</frontend_type>
301
+ <sort_order>42</sort_order>
302
+ <show_in_default>1</show_in_default>
303
+ <show_in_website>1</show_in_website>
304
+ <show_in_store>1</show_in_store>
305
+ <!--<depends><welcome_mat_active>1</welcome_mat_active></depends>-->
306
+ </flag_code>
307
+
308
+ <store_logo>
309
+ <label>Your Store's Logo URL</label>
310
+ <comment>Enter the URL provided to customize the look of the welcome mat, showing customers your logo.</comment>
311
+ <frontend_type>text</frontend_type>
312
+ <sort_order>50</sort_order>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ <!--<depends><welcome_mat_active>1</welcome_mat_active></depends>-->
317
+ </store_logo>
318
+
319
+ </fields>
320
+
321
+ </igmat>
322
+ <ig_item_attribute translate="label">
323
+ <label>Cart Item Attribute Mapping</label>
324
+ <comment><![CDATA[ <div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">Map your existing and/or custom fields back to iGlobal for added product info and custom rules built around your store.</div>]]></comment>
325
+ <frontend_type>text</frontend_type>
326
+ <sort_order>19</sort_order>
327
+ <show_in_default>1</show_in_default>
328
+ <show_in_website>1</show_in_website>
329
+ <show_in_store>1</show_in_store>
330
+ <fields>
331
+ <weight translate="label">
332
+ <label>Weight</label>
333
+ <frontend_type>select</frontend_type>
334
+ <source_model>stores/configoptions</source_model>
335
+ <sort_order>1</sort_order>
336
+ <show_in_default>1</show_in_default>
337
+ <show_in_website>1</show_in_website>
338
+ <show_in_store>1</show_in_store>
339
+ </weight>
340
+ <length translate="label">
341
+ <label>Length</label>
342
+ <frontend_type>select</frontend_type>
343
+ <source_model>stores/configoptions</source_model>
344
+ <sort_order>2</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
+ </length>
349
+ <width translate="label">
350
+ <label>Width</label>
351
+ <frontend_type>select</frontend_type>
352
+ <source_model>stores/configoptions</source_model>
353
+ <sort_order>3</sort_order>
354
+ <show_in_default>1</show_in_default>
355
+ <show_in_website>1</show_in_website>
356
+ <show_in_store>1</show_in_store>
357
+ </width>
358
+ <height translate="label">
359
+ <label>Height</label>
360
+ <frontend_type>select</frontend_type>
361
+ <source_model>stores/configoptions</source_model>
362
+ <sort_order>4</sort_order>
363
+ <show_in_default>1</show_in_default>
364
+ <show_in_website>1</show_in_website>
365
+ <show_in_store>1</show_in_store>
366
+ </height>
367
+ <country_of_origin translate="label">
368
+ <label>Country of origin</label>
369
+ <frontend_type>select</frontend_type>
370
+ <source_model>stores/configoptions</source_model>
371
+ <sort_order>5</sort_order>
372
+ <show_in_default>1</show_in_default>
373
+ <show_in_website>1</show_in_website>
374
+ <show_in_store>1</show_in_store>
375
+ </country_of_origin>
376
+ <category translate="label">
377
+ <label>Category</label>
378
+ <frontend_type>select</frontend_type>
379
+ <source_model>stores/configoptions</source_model>
380
+ <sort_order>6</sort_order>
381
+ <show_in_default>1</show_in_default>
382
+ <show_in_website>1</show_in_website>
383
+ <show_in_store>1</show_in_store>
384
+ </category>
385
+ <brand translate="label">
386
+ <label>Brand</label>
387
+ <frontend_type>select</frontend_type>
388
+ <source_model>stores/configoptions</source_model>
389
+ <sort_order>13</sort_order>
390
+ <show_in_default>1</show_in_default>
391
+ <show_in_website>1</show_in_website>
392
+ <show_in_store>1</show_in_store>
393
+ </brand>
394
+ <hs_code translate="label">
395
+ <label>HS code</label>
396
+ <frontend_type>select</frontend_type>
397
+ <source_model>stores/configoptions</source_model>
398
+ <sort_order>8</sort_order>
399
+ <show_in_default>1</show_in_default>
400
+ <show_in_website>1</show_in_website>
401
+ <show_in_store>1</show_in_store>
402
+ </hs_code>
403
+ <customization translate="label">
404
+ <label>Customization</label>
405
+ <frontend_type>select</frontend_type>
406
+ <source_model>stores/configoptions</source_model>
407
+ <sort_order>14</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
+ </customization>
412
+ <color translate="label">
413
+ <label>Color</label>
414
+ <frontend_type>select</frontend_type>
415
+ <source_model>stores/configoptions</source_model>
416
+ <sort_order>10</sort_order>
417
+ <show_in_default>1</show_in_default>
418
+ <show_in_website>1</show_in_website>
419
+ <show_in_store>1</show_in_store>
420
+ </color>
421
+ <material translate="label">
422
+ <label>Material</label>
423
+ <frontend_type>select</frontend_type>
424
+ <source_model>stores/configoptions</source_model>
425
+ <sort_order>11</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
+ </material>
430
+ <status translate="label">
431
+ <label>Status</label>
432
+ <frontend_type>select</frontend_type>
433
+ <source_model>stores/configoptions</source_model>
434
+ <sort_order>12</sort_order>
435
+ <show_in_default>1</show_in_default>
436
+ <show_in_website>1</show_in_website>
437
+ <show_in_store>1</show_in_store>
438
+ </status>
439
+ <non_shippable translate="label">
440
+ <label>Non Shippable</label>
441
+ <frontend_type>select</frontend_type>
442
+ <source_model>stores/configoptions</source_model>
443
+ <sort_order>7</sort_order>
444
+ <show_in_default>1</show_in_default>
445
+ <show_in_website>1</show_in_website>
446
+ <show_in_store>1</show_in_store>
447
+ </non_shippable>
448
+ </fields>
449
+ </ig_item_attribute>
450
+ <igjq translate="label">
451
+ <label>jQuery Settings</label>
452
+ <frontend_type>text</frontend_type>
453
+ <sort_order>20</sort_order>
454
+ <show_in_default>1</show_in_default>
455
+ <show_in_website>1</show_in_website>
456
+ <show_in_store>1</show_in_store>
457
+ <comment>
458
+ <![CDATA[<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">To avoid conflicts, please select Yes ONLY if you do not currently have jQuery running on your site. If you are unsure, please contact us at 1-800-942-0721 and we will assist you. </div>]]>
459
+ </comment>
460
+
461
+ <fields>
462
+
463
+ <enabled translate="label">
464
+ <label>Enabled</label>
465
+ <frontend_type>select</frontend_type>
466
+ <source_model>adminhtml/system_config_source_yesno</source_model>
467
+ <sort_order>1</sort_order>
468
+ <show_in_default>1</show_in_default>
469
+ <show_in_website>1</show_in_website>
470
+ <show_in_store>1</show_in_store>
471
+ </enabled>
472
+
473
+ <iglogging>
474
+ <label>Turn on iGlobal Logging?</label>
475
+ <comment>Turn on to enable iGlobal Logging. This can result in very large log files, so it's best to leave this off unless needed!</comment>
476
+ <frontend_type>select</frontend_type>
477
+ <source_model>adminhtml/system_config_source_yesno</source_model>
478
+ <sort_order>5</sort_order>
479
+ <show_in_default>1</show_in_default>
480
+ <show_in_website>1</show_in_website>
481
+ <show_in_store>1</show_in_store>
482
+ </iglogging>
483
+
484
+ </fields>
485
+ </igjq>
486
+
487
+ </groups>
488
+
489
+ </iglobal_integration>
490
+
491
+ <payment translate="label" module="payment">
492
+ <groups>
493
+ <international translate="label">
494
+ <label>International Order Payment From iGlobal</label>
495
+ <frontend_type>text</frontend_type>
496
+ <sort_order>30</sort_order>
497
+ <show_in_default>1</show_in_default>
498
+ <show_in_website>1</show_in_website>
499
+ <show_in_store>1</show_in_store>
500
+ <fields>
501
+ <active translate="label">
502
+ <label>Enabled</label>
503
+ <frontend_type>select</frontend_type>
504
+ <source_model>adminhtml/system_config_source_yesno</source_model>
505
+ <sort_order>1</sort_order>
506
+ <show_in_default>1</show_in_default>
507
+ <show_in_website>1</show_in_website>
508
+ <show_in_store>0</show_in_store>
509
+ </active>
510
+ <order_status translate="label">
511
+ <label>New Order Status</label>
512
+ <frontend_type>select</frontend_type>
513
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
514
+ <sort_order>20</sort_order>
515
+ <show_in_default>1</show_in_default>
516
+ <show_in_website>1</show_in_website>
517
+ <show_in_store>0</show_in_store>
518
+ </order_status>
519
+ <sort_order translate="label">
520
+ <label>Sort Order</label>
521
+ <frontend_type>text</frontend_type>
522
+ <sort_order>100</sort_order>
523
+ <show_in_default>1</show_in_default>
524
+ <show_in_website>1</show_in_website>
525
+ <show_in_store>0</show_in_store>
526
+ <frontend_class>validate-number</frontend_class>
527
+ </sort_order>
528
+ <title translate="label">
529
+ <label>Title</label>
530
+ <frontend_type>text</frontend_type>
531
+ <sort_order>10</sort_order>
532
+ <show_in_default>1</show_in_default>
533
+ <show_in_website>1</show_in_website>
534
+ <show_in_store>1</show_in_store>
535
+ </title>
536
+ <allowspecific translate="label">
537
+ <label>Payment from Applicable Countries</label>
538
+ <frontend_type>allowspecific</frontend_type>
539
+ <sort_order>50</sort_order>
540
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
541
+ <show_in_default>1</show_in_default>
542
+ <show_in_website>1</show_in_website>
543
+ <show_in_store>0</show_in_store>
544
+ </allowspecific>
545
+ <specificcountry translate="label">
546
+ <label>Payment from Specific Countries</label>
547
+ <frontend_type>multiselect</frontend_type>
548
+ <sort_order>51</sort_order>
549
+ <source_model>adminhtml/system_config_source_country</source_model>
550
+ <show_in_default>1</show_in_default>
551
+ <show_in_website>1</show_in_website>
552
+ <show_in_store>0</show_in_store>
553
+ <can_be_empty>1</can_be_empty>
554
+ </specificcountry>
555
+ <min_order_total translate="label">
556
+ <label>Minimum Order Total</label>
557
+ <frontend_type>text</frontend_type>
558
+ <sort_order>98</sort_order>
559
+ <show_in_default>1</show_in_default>
560
+ <show_in_website>1</show_in_website>
561
+ <show_in_store>0</show_in_store>
562
+ </min_order_total>
563
+ <max_order_total translate="label">
564
+ <label>Maximum Order Total</label>
565
+ <frontend_type>text</frontend_type>
566
+ <sort_order>99</sort_order>
567
+ <show_in_default>1</show_in_default>
568
+ <show_in_website>1</show_in_website>
569
+ <show_in_store>0</show_in_store>
570
+ </max_order_total>
571
+ <model>
572
+ </model>
573
+ </fields>
574
+ </international>
575
+ </groups>
576
+ </payment>
577
+ <carriers>
578
+ <groups>
579
+ <ig translate="label" module="stores">
580
+ <label>Iglobal Shipping Module</label>
581
+ <frontend_type>text</frontend_type>
582
+ <sort_order>99</sort_order>
583
+ <show_in_default>1</show_in_default>
584
+ <show_in_website>1</show_in_website>
585
+ <show_in_store>1</show_in_store>
586
+ <fields>
587
+ <active translate="label">
588
+ <label>Enabled</label>
589
+ <frontend_type>select</frontend_type>
590
+ <source_model>adminhtml/system_config_source_yesno</source_model>
591
+ <sort_order>1</sort_order>
592
+ <show_in_default>1</show_in_default>
593
+ <show_in_website>1</show_in_website>
594
+ <show_in_store>1</show_in_store>
595
+ </active>
596
+ <title translate="label">
597
+ <label>Title</label>
598
+ <frontend_type>text</frontend_type>
599
+ <sort_order>2</sort_order>
600
+ <show_in_default>1</show_in_default>
601
+ <show_in_website>1</show_in_website>
602
+ <show_in_store>1</show_in_store>
603
+ </title>
604
+ <name translate="label">
605
+ <label>Method Name</label>
606
+ <frontend_type>text</frontend_type>
607
+ <sort_order>2</sort_order>
608
+ <show_in_default>1</show_in_default>
609
+ <show_in_website>1</show_in_website>
610
+ <show_in_store>1</show_in_store>
611
+ </name>
612
+ <price translate="label">
613
+ <label>Price</label>
614
+ <frontend_type>text</frontend_type>
615
+ <sort_order>3</sort_order>
616
+ <show_in_default>1</show_in_default>
617
+ <show_in_website>1</show_in_website>
618
+ <show_in_store>0</show_in_store>
619
+ </price>
620
+ <specificerrmsg translate="label">
621
+ <label>Displayed Error Message</label>
622
+ <frontend_type>textarea</frontend_type>
623
+ <sort_order>4</sort_order>
624
+ <show_in_default>1</show_in_default>
625
+ <show_in_website>1</show_in_website>
626
+ <show_in_store>1</show_in_store>
627
+ </specificerrmsg>
628
+ <sallowspecific translate="label">
629
+ <label>Ship to Applicable Countries</label>
630
+ <frontend_type>select</frontend_type>
631
+ <sort_order>90</sort_order>
632
+ <frontend_class>shipping-applicable-country</frontend_class>
633
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
634
+ <show_in_default>1</show_in_default>
635
+ <show_in_website>1</show_in_website>
636
+ <show_in_store>0</show_in_store>
637
+ </sallowspecific>
638
+ <specificcountry translate="label">
639
+ <label>Ship to Specific Countries</label>
640
+ <frontend_type>multiselect</frontend_type>
641
+ <sort_order>91</sort_order>
642
+ <source_model>adminhtml/system_config_source_country</source_model>
643
+ <show_in_default>1</show_in_default>
644
+ <show_in_website>1</show_in_website>
645
+ <show_in_store>0</show_in_store>
646
+ <can_be_empty>1</can_be_empty>
647
+ </specificcountry>
648
+ </fields>
649
+ </ig>
650
+ </groups>
651
+ </carriers>
652
+ </sections>
653
+ </config>
app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ // This whole /sql setup idea is the most awesome way to make updates and new tables in the DB
6
+ $installer->startSetup();
7
+ //$installer->run('ALTER TABLE `sales_flat_order` ADD `international_order` BOOLEAN NOT NULL DEFAULT 0');
8
+
9
+ $installer->getConnection()
10
+ ->addColumn($installer->getTable('sales_flat_order'),
11
+ 'international_order', "BOOLEAN NOT NULL DEFAULT 0"
12
+
13
+ );
14
+ $installer->getConnection()
15
+ ->addColumn($installer->getTable('sales_flat_order'),
16
+ 'ig_order_number', "VARCHAR( 15 ) NULL DEFAULT NULL , ADD INDEX ( `ig_order_number` )"
17
+
18
+ );
19
+
20
+
21
+ //$installer->run('ALTER TABLE `sales_flat_order` ADD `ig_order_number` VARCHAR( 15 ) NULL DEFAULT NULL , ADD INDEX ( `ig_order_number` )');
22
+
23
+
24
+ $installer->createAttribute('iGlobal Length','ig_length', 'text');
25
+ $installer->createAttribute('iGlobal Width', 'ig_width', 'text');
26
+ $installer->createAttribute('iGlobal Height', 'ig_height', 'text');
27
+ $installer->createAttribute('iGlobal Weight', 'ig_weight', 'text');
28
+ $weightUnits['value']['option_1'][0] = 'lbs';
29
+ $weightUnits['value']['option_2'][0] = 'kg';
30
+ $weightUnits['value']['option_3'][0] = 'oz';
31
+ $weightUnits['value']['option_4'][0] = 'g';
32
+ $installer->createAttribute('iGlobal Weight Units','ig_weight_units','select', $weightUnits );
33
+ $dimUnits['value']['option_1'][0] = 'in';
34
+ $dimUnits['value']['option_2'][0] = 'cm';
35
+ $installer->createAttribute('iGlobal Dimension Units','ig_dimension_units','select', $dimUnits );
36
+ $installer->endSetup();
app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ //no database changes for this upgrade
app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ $installer = $this;
5
+
6
+ //add test order flag attribute to order table.
7
+ $installer->startSetup();
8
+ //$installer->run('ALTER TABLE `sales_flat_order` ADD `iglobal_test_order` BOOLEAN NOT NULL DEFAULT 0');
9
+
10
+ $installer->getConnection()
11
+ ->addColumn($installer->getTable('sales_flat_order'),
12
+ 'iglobal_test_order', "BOOLEAN NOT NULL DEFAULT 0"
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ //no database changes for this upgrade
app/code/community/Iglobal/Stores.full/sql/iglobal_stores_setup/mysql4-upgrade-0.1.3-1.0.0.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ //no database changes for this upgrade
app/code/community/Iglobal/Stores/.DS_Store ADDED
Binary file
app/code/community/Iglobal/Stores/Helper/Data.php CHANGED
@@ -126,6 +126,7 @@ class Iglobal_Stores_Helper_Data extends Mage_Core_Helper_Abstract
126
  public function getCheckoutUrl($tempCart){
127
  $subdomain = (Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain') ? Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain') : "checkout");
128
  $storeNumber = (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid') ? Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid') : "3");
 
129
  $countryCode = (isset($_COOKIE['igCountry']) ? $_COOKIE['igCountry'] : "");
130
  $url = 'https://' . $subdomain . '.iglobalstores.com/?store=' . $storeNumber . '&tempCartUUID=' . $tempCart . '&country=' . $countryCode;
131
 
@@ -218,7 +219,7 @@ class Iglobal_Stores_Helper_Data extends Mage_Core_Helper_Abstract
218
  }
219
 
220
  protected function getProductAttribute($product, $attributeName) {
221
- $value = Mage::getStoreconfig('iglobal_integration/ig_item_attribute/' . $attributeName);
222
  if($value) {
223
  return $product->getData($value);
224
  }
126
  public function getCheckoutUrl($tempCart){
127
  $subdomain = (Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain') ? Mage::getStoreConfig('iglobal_integration/apireqs/igsubdomain') : "checkout");
128
  $storeNumber = (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid') ? Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid') : "3");
129
+ $storeNumber = trim($storeNumber, ' ');
130
  $countryCode = (isset($_COOKIE['igCountry']) ? $_COOKIE['igCountry'] : "");
131
  $url = 'https://' . $subdomain . '.iglobalstores.com/?store=' . $storeNumber . '&tempCartUUID=' . $tempCart . '&country=' . $countryCode;
132
 
219
  }
220
 
221
  protected function getProductAttribute($product, $attributeName) {
222
+ $value = Mage::getStoreConfig('iglobal_integration/ig_item_attribute/' . $attributeName);
223
  if($value) {
224
  return $product->getData($value);
225
  }
app/code/community/Iglobal/Stores/Model/International/International.php CHANGED
@@ -24,8 +24,10 @@ class Iglobal_Stores_Model_International_International extends Mage_Core_Model_A
24
  );
25
  }
26
  $rest = Mage::getModel('stores/rest');
 
 
27
  $response = $rest->createTempCart(array(
28
- "storeId" => Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid'),
29
  "referenceId" => $cart->getId(),
30
  "externalConfirmationPageURL" => MAge::getUrl('iglobal/success', array('_secure'=> true)),
31
  "misc6" => "iGlobal v".Mage::getConfig()->getModuleConfig("Iglobal_Stores")->version. ", Magento v".Mage::getVersion(),
24
  );
25
  }
26
  $rest = Mage::getModel('stores/rest');
27
+ $storeId = Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid');
28
+ $storeId = trim($storeId, ' ');
29
  $response = $rest->createTempCart(array(
30
+ "storeId" => $storeId,
31
  "referenceId" => $cart->getId(),
32
  "externalConfirmationPageURL" => MAge::getUrl('iglobal/success', array('_secure'=> true)),
33
  "misc6" => "iGlobal v".Mage::getConfig()->getModuleConfig("Iglobal_Stores")->version. ", Magento v".Mage::getVersion(),
app/code/community/Iglobal/Stores/Model/Observer.php CHANGED
@@ -1,102 +1,105 @@
1
- <?php
2
- /**
3
- * Created by JetBrains PhpStorm.
4
- * User: david
5
- * Date: 5/9/13
6
- * Time: 3:24 PM
7
- * To change this template use File | Settings | File Templates.
8
- */
9
-
10
- class Iglobal_Stores_Model_Observer
11
- {
12
- public function __construct()
13
- {
14
- //Just constructor for fun
15
- }
16
-
17
-
18
- public function orderCreated($observer)
19
- {
20
- //$observer contains the object returns in the event.
21
- $event = $observer->getEvent();
22
- $order = $event->getOrder();
23
- if($order->getRelationParentId()){
24
- $parentOrder = Mage::getModel('sales/order')->load($order->getRelationParentId());
25
- if($parentOrder->getIgOrderNumber()){
26
- $order->setIglobalTestOrder($parentOrder->getIglobalTestOrder());
27
- $order->setIgOrderNumber($parentOrder->getIgOrderNumber());
28
- $order->setInternationalOrder(1);
29
- $order->save();
30
- }
31
- }
32
- return $this;
33
- }
34
-
35
- /**
36
- * Added jQuery library.
37
- *
38
- * @param Varien_Event_Observer $observer
39
- *
40
- * @return string
41
- */
42
- public function prepareLayoutBefore(Varien_Event_Observer $observer)
43
- {
44
- if (!Mage::helper('stores')->isEnabled()) {
45
- return $this;
46
- }
47
-
48
- /* @var $block Mage_Page_Block_Html_Head */
49
- $block = $observer->getEvent()->getBlock();
50
-
51
- if ("head" == $block->getNameInLayout()) {
52
- foreach (Mage::helper('stores')->getFiles() as $file) {
53
- $block->addJs(Mage::helper('stores')->getJQueryPath($file));
54
- }
55
- }
56
-
57
- return $this;
58
- }
59
-
60
- public function orderRec () {
61
-
62
- //build array of orders currently in magento
63
- $magentoOrders = array();
64
- $orders = Mage::getModel('sales/order')->getCollection()
65
- ->addFilter('international_order', 1)
66
- ->addFieldToFilter('ig_order_number', array('notnull'=> true))
67
- ->getItems();
68
-
69
- foreach ($orders as $order) {
70
- $magentoOrders[$order->getIgOrderNumber()] = $order;
71
- }
72
- $date = date("Ymd", strtotime("-1 week"));
73
- //get array with all orders in past
74
- $data = Mage::getModel('stores/rest')->getAllOrdersSinceDate($date);
75
- foreach ($data->orders as $igOrder)
76
- {
77
-
78
- if ($igOrder->testOrder)
79
- {
80
- continue;
81
- }
82
- if(array_key_exists($igOrder->id, $magentoOrders)) {
83
- // check status
84
- Mage::getModel('stores/order')->checkStatus($magentoOrders[$igOrder->id]);
85
-
86
- } else {
87
- try {
88
- // re-import the order
89
- // Mage::getModel('stores/order')->processOrder($igOrder->id);
90
- }
91
- catch(Exception $e)
92
- {
93
- mail('monitoring@iglobalstores.com, magentomissedorders@iglobalstores.com',
94
- 'Magento Integration Error - International order failed to import',
95
- 'International order# '. $igOrder->id .'.'. ' Exception Message: '.$e->getMessage());
96
- Mage::log("International order #{$igOrder->id} failed to import!" .$e, Zend_Log::ERR, 'iglobal.log', true);
97
- }
98
-
99
- }
100
- }
101
- }
102
- }
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by JetBrains PhpStorm.
4
+ * User: david
5
+ * Date: 5/9/13
6
+ * Time: 3:24 PM
7
+ * To change this template use File | Settings | File Templates.
8
+ */
9
+
10
+ class Iglobal_Stores_Model_Observer
11
+ {
12
+ public function __construct()
13
+ {
14
+ //Just constructor for fun
15
+ }
16
+
17
+
18
+ public function orderCreated($observer)
19
+ {
20
+ //$observer contains the object returns in the event.
21
+ $event = $observer->getEvent();
22
+ $order = $event->getOrder();
23
+ if($order->getRelationParentId()){
24
+ $parentOrder = Mage::getModel('sales/order')->load($order->getRelationParentId());
25
+ if($parentOrder->getIgOrderNumber()){
26
+ $order->setIglobalTestOrder($parentOrder->getIglobalTestOrder());
27
+ $order->setIgOrderNumber($parentOrder->getIgOrderNumber());
28
+ $order->setInternationalOrder(1);
29
+ $order->save();
30
+ }
31
+ }
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * Added jQuery library.
37
+ *
38
+ * @param Varien_Event_Observer $observer
39
+ *
40
+ * @return string
41
+ */
42
+ public function prepareLayoutBefore(Varien_Event_Observer $observer)
43
+ {
44
+ if (!Mage::helper('stores')->isEnabled()) {
45
+ return $this;
46
+ }
47
+
48
+ /* @var $block Mage_Page_Block_Html_Head */
49
+ $block = $observer->getEvent()->getBlock();
50
+
51
+ if ("head" == $block->getNameInLayout()) {
52
+ foreach (Mage::helper('stores')->getFiles() as $file) {
53
+ $block->addJs(Mage::helper('stores')->getJQueryPath($file));
54
+ }
55
+ }
56
+
57
+ return $this;
58
+ }
59
+
60
+ public function orderRec () {
61
+
62
+ //build array of orders currently in magento
63
+ $magentoOrders = array();
64
+ $orders = Mage::getModel('sales/order')->getCollection()
65
+ ->addFilter('international_order', 1)
66
+ ->addFieldToFilter('ig_order_number', array('notnull'=> true))
67
+ ->getItems();
68
+
69
+ foreach ($orders as $order) {
70
+ $magentoOrders[$order->getIgOrderNumber()] = $order;
71
+ }
72
+ $date = date("Ymd", strtotime("-1 week"));
73
+ //get array with all orders in past
74
+ $data = Mage::getModel('stores/rest')->getAllOrdersSinceDate($date);
75
+ if(!isset($data) || !isset($data->orders)) {
76
+ return;
77
+ }
78
+ foreach ($data->orders as $igOrder)
79
+ {
80
+
81
+ if ($igOrder->testOrder)
82
+ {
83
+ continue;
84
+ }
85
+ if(array_key_exists($igOrder->id, $magentoOrders)) {
86
+ // check status
87
+ Mage::getModel('stores/order')->checkStatus($magentoOrders[$igOrder->id]);
88
+
89
+ } else {
90
+ try {
91
+ // re-import the order
92
+ // Mage::getModel('stores/order')->processOrder($igOrder->id);
93
+ }
94
+ catch(Exception $e)
95
+ {
96
+ mail('monitoring@iglobalstores.com, magentomissedorders@iglobalstores.com',
97
+ 'Magento Integration Error - International order failed to import',
98
+ 'International order# '. $igOrder->id .'.'. ' Exception Message: '.$e->getMessage());
99
+ Mage::log("International order #{$igOrder->id} failed to import!" .$e, Zend_Log::ERR, 'iglobal.log', true);
100
+ }
101
+
102
+ }
103
+ }
104
+ }
105
+ }
app/code/community/Iglobal/Stores/Model/Order.php CHANGED
@@ -235,16 +235,67 @@ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
235
  $address->setPaymentMethod('iGlobalCreditCard');
236
 
237
  //updates payment type in Magento Admin area
238
- $paymentMethod = $this->iglobal_order->paymentProcessing->paymentGateway;
239
- if($paymentMethod === 'iGlobal_CC'){
240
- $paymentType = 'iGlobalCreditCard';
241
- } else if ($paymentMethod === 'iGlobal PayPal') {
242
- $paymentType = 'iGlobalPaypal';
243
  } else {
244
- $paymentType = 'iGlobal';
245
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
- $this->quote->getPayment()->importData(array('method' => $paymentType));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  }
249
 
250
  protected function createOrder()
@@ -279,20 +330,7 @@ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
279
  $commentMessage = 'Order automatically imported from iGlobal order ID: '. $this->iglobal_order_id;
280
  try {
281
  $order = Mage::getModel("sales/order")->load($id);
282
- //add trans ID
283
- try {
284
- $transaction_id = $this->iglobal_order->paymentProcessing->transactionId;
285
- } catch (Exception $e){
286
- $transaction_id = '34234234234';
287
- }
288
- if(!$transaction_id) {
289
- $transaction_id = '34234234234';
290
- }
291
- $transaction = Mage::getModel('sales/order_payment_transaction');
292
- $transaction->setOrderPaymentObject($order->getPayment());
293
- $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
294
- $transaction->setTxnId($transaction_id);
295
- $transaction->save();
296
 
297
  $invoices = Mage::getModel('sales/order_invoice')->getCollection()->addAttributeToFilter('order_id', array('eq'=>$order->getId()));
298
  $invoices->getSelect()->limit(1);
235
  $address->setPaymentMethod('iGlobalCreditCard');
236
 
237
  //updates payment type in Magento Admin area
238
+ if (isset($this->iglobal_order->paymentProcessing)) {
239
+ $data = (array) $this->iglobal_order->paymentProcessing;
 
 
 
240
  } else {
241
+ $data = array();
242
  }
243
+ if(isset( $this->iglobal_order->paymentProcessing->paymentGateway)) {
244
+ $paymentMethod = $this->iglobal_order->paymentProcessing->paymentGateway;
245
+ } else if (isset($this->iglobal_order->paymentProcessing->paymentProcessor)) {
246
+ $paymentMethod = $this->iglobal_order->paymentProcessing->paymentProcessor;
247
+ } else {
248
+ $paymentMethod = 'iGlobal';
249
+ }
250
+ switch($paymentMethod) {
251
+ case 'iGlobal_CC':
252
+ case 'AUTHORIZE_NET':
253
+ case 'BRAINTREE':
254
+ case 'CYBERSOURCE':
255
+ case 'INTERPAY':
256
+ case 'PAYPAL_CC':
257
+ case 'PAY_FLOW':
258
+ case 'STRIPE':
259
+ case 'USA_EPAY':
260
+ $data['method'] = 'iGlobalCreditCard';
261
+ break;
262
+ case 'iGlobal PayPal':
263
+ case 'INTERPAY_PAYPAL':
264
+ case 'PAYPAL_EXPRESS':
265
+ case 'PAYPAL':
266
+ $data['method'] = 'iGlobalPaypal';
267
+ break;
268
+ default:
269
+ $data['method'] = 'iGlobal';
270
+ }
271
+ $this->quote->getPayment()->importData($data);
272
+ }
273
 
274
+ protected function setTransactionInfo($order){
275
+ //add trans ID
276
+ try {
277
+ $transaction_id = $this->iglobal_order->paymentProcessing->transactionId;
278
+ } catch (Exception $e){
279
+ $transaction_id = '34234234234';
280
+ }
281
+ if(!$transaction_id) {
282
+ $transaction_id = '34234234234';
283
+ }
284
+ $transaction = Mage::getModel('sales/order_payment_transaction');
285
+ $transaction->setOrderPaymentObject($order->getPayment());
286
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
287
+ $transaction->setTxnId($transaction_id);
288
+ if(isset($this->iglobal_order->paymentProcessing)) {
289
+ try {
290
+ $transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, (array)$this->iglobal_order->paymentProcessing);
291
+ if ($this->iglobal_order->paymentProcessing->transactionType == "AUTH_CAPTURE") {
292
+ $transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
293
+ }
294
+ } catch (Exception $e) {
295
+
296
+ }
297
+ }
298
+ $transaction->save();
299
  }
300
 
301
  protected function createOrder()
330
  $commentMessage = 'Order automatically imported from iGlobal order ID: '. $this->iglobal_order_id;
331
  try {
332
  $order = Mage::getModel("sales/order")->load($id);
333
+ $this->setTransactionInfo($order);
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
  $invoices = Mage::getModel('sales/order_invoice')->getCollection()->addAttributeToFilter('order_id', array('eq'=>$order->getId()));
336
  $invoices->getSelect()->limit(1);
app/code/community/Iglobal/Stores/Model/Payment/Iglobal.php CHANGED
@@ -1,20 +1,45 @@
1
- <?php
2
-
3
- class Iglobal_Stores_Model_Payment_Iglobal extends Mage_Payment_Model_Method_Checkmo
4
- {
5
-
6
- protected $_code = 'iGlobal';
7
- protected $_canUseInternal = true;
8
- protected $_canUseCheckout = false;
9
- protected $_canUseForMultishipping = false;
10
-
11
- public function getPayableTo()
12
- {
13
- return false;
14
- }
15
-
16
- public function getMailingAddress()
17
- {
18
- return false;
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Payment_Iglobal extends Mage_Payment_Model_Method_Abstract
4
+ {
5
+
6
+ protected $_code = 'iGlobal';
7
+ protected $_canUseInternal = true;
8
+ protected $_canUseCheckout = false;
9
+ protected $_canUseForMultishipping = false;
10
+
11
+ /**
12
+ * Assign data to info model instance
13
+ *
14
+ * @param mixed $data
15
+ * @return Mage_Payment_Model_Info
16
+ */
17
+ public function assignData($data)
18
+ {
19
+ $info = $this->getInfoInstance();
20
+ if ($data instanceof Varien_Object) {
21
+ $data = $data->getData();
22
+ }
23
+ if (is_array($data)) {
24
+ $info->addData($data);
25
+ if(array_key_exists('cardType', $data)) {
26
+ $info->setCcType($data['cardType']);
27
+ }
28
+ $monthMap = array(
29
+ 'JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6,
30
+ 'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12,
31
+ );
32
+ if(array_key_exists('cardExpMonth', $data) and array_key_exists($data['cardExpMonth'],$monthMap)) {
33
+ $info->setCcExpMonth($monthMap[$data['cardExpMonth']]);
34
+ }
35
+ if(array_key_exists('cardExpYear', $data)) {
36
+ $info->setCcExpYear($data['cardExpYear']);
37
+ }
38
+ if(array_key_exists('lastFour', $data)) {
39
+ $info->setCcLast4($data['lastFour']);
40
+ }
41
+ }
42
+ return $this;
43
+ }
44
+
45
+ }
app/code/community/Iglobal/Stores/Model/Payment/Iglobalcreditcard.php CHANGED
@@ -1,21 +1,7 @@
1
- <?php
2
-
3
- class Iglobal_Stores_Model_Payment_IglobalCreditCard extends Mage_Payment_Model_Method_Checkmo
4
- {
5
-
6
- protected $_code = 'iGlobalCreditCard';
7
- protected $_canUseInternal = true;
8
- protected $_canUseCheckout = false;
9
- protected $_canUseForMultishipping = false;
10
-
11
- public function getPayableTo()
12
- {
13
- return false;
14
- }
15
-
16
- public function getMailingAddress()
17
- {
18
- return false;
19
- }
20
- }
21
-
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Payment_IglobalCreditCard extends Iglobal_Stores_Model_Payment_Iglobal
4
+ {
5
+ protected $_code = 'iGlobalCreditCard';
6
+ }
7
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iglobal/Stores/Model/Payment/Iglobalpaypal.php CHANGED
@@ -1,21 +1,7 @@
1
- <?php
2
-
3
- class Iglobal_Stores_Model_Payment_IglobalPaypal extends Mage_Payment_Model_Method_Checkmo
4
- {
5
-
6
- protected $_code = 'iGlobalPaypal';
7
- protected $_canUseInternal = true;
8
- protected $_canUseCheckout = false;
9
- protected $_canUseForMultishipping = false;
10
-
11
- public function getPayableTo()
12
- {
13
- return false;
14
- }
15
-
16
- public function getMailingAddress()
17
- {
18
- return false;
19
- }
20
- }
21
-
1
+ <?php
2
+
3
+ class Iglobal_Stores_Model_Payment_IglobalPaypal extends Iglobal_Stores_Model_Payment_Iglobal
4
+ {
5
+ protected $_code = 'iGlobalPaypal';
6
+ }
7
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Iglobal/Stores/Model/Rest.php CHANGED
@@ -11,10 +11,12 @@ class Iglobal_Stores_Model_Rest extends Mage_Core_Model_Abstract
11
  //set store ID
12
  if (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid')) {
13
  $this->_store = Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid');
 
14
  }
15
  //Set API Key
16
  if (Mage::getStoreConfig('iglobal_integration/apireqs/secret')) {
17
  $this->_key = Mage::getStoreConfig('iglobal_integration/apireqs/secret');
 
18
  }
19
  }
20
 
11
  //set store ID
12
  if (Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid')) {
13
  $this->_store = Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid');
14
+ $this->_store = trim($this->_store, ' ');
15
  }
16
  //Set API Key
17
  if (Mage::getStoreConfig('iglobal_integration/apireqs/secret')) {
18
  $this->_key = Mage::getStoreConfig('iglobal_integration/apireqs/secret');
19
+ $this->_key = trim($this->_key, ' ');
20
  }
21
  }
22
 
app/code/community/Iglobal/Stores/controllers/SuccessController.php CHANGED
@@ -12,13 +12,14 @@ class Iglobal_Stores_SuccessController extends Mage_Core_Controller_Front_Action
12
  $quote = Mage::getSingleton('checkout/session')->getQuote()->setStoreId(Mage::app()->getStore()->getId());
13
  $order = Mage::getModel('sales/order')->loadByAttribute('ig_order_number', $_order);
14
 
15
- if(!$_order || $order->getId()) {
16
  header('Location: /');
17
  die();
 
 
 
 
18
  }
19
-
20
- $order = Mage::getModel('stores/order');
21
- $order->processOrder($_order, $quote);
22
  }
23
  catch(Exception $e)
24
  {
12
  $quote = Mage::getSingleton('checkout/session')->getQuote()->setStoreId(Mage::app()->getStore()->getId());
13
  $order = Mage::getModel('sales/order')->loadByAttribute('ig_order_number', $_order);
14
 
15
+ if(!$_order ) {
16
  header('Location: /');
17
  die();
18
+ } else if($order->getId()) {
19
+ Mage::getModel('stores/order')->checkStatus($order);
20
+ } else {
21
+ $order = Mage::getModel('stores/order')->processOrder($_order, $quote);
22
  }
 
 
 
23
  }
24
  catch(Exception $e)
25
  {
js/iGlobal/ig_welcome_mat_default.css CHANGED
@@ -9,16 +9,13 @@
9
  #igFlag { width: 30px; }
10
  #igFlag img { max-width: 25px; margin-bottom: -3px; cursor: pointer; margin-left: 5px;}
11
 
12
- /* Background blur effect */
13
- body.welcome-mat-blur > *:not(#igSplashElement) { -webkit-filter: blur(8px); -moz-filter: blur(8px); -o-filter: blur(8px); -ms-filter: blur(8px); filter: blur(8px); }
14
-
15
  /* Begin Modal Styles */
16
  #igSplashElement {
17
- position: absolute;
18
  max-width: 500px;
19
  background-color: #fff;
20
- top: 50%;
21
- left: 50%;
22
  width: 100%;
23
  -webkit-box-shadow: 0px 0px 60px 0px rgba(0, 0, 0, 0.5);
24
  box-shadow: 0px 0px 60px 0px rgba(0, 0, 0, 0.5);
@@ -26,11 +23,6 @@ body.welcome-mat-blur > *:not(#igSplashElement) { -webkit-filter: blur(8px); -m
26
  font-size: 14px;
27
  font-family: 'Roboto', Helvetica, Arial, sans-serif;
28
  /* The CSS below is for the opening and closing animation */
29
- -webkit-transform: translateY(20%) translateX(-50%);
30
- -moz-transform: translateY(20%) translateX(-50%);
31
- -ms-transform: translateY(20%) translateX(-50%);
32
- transform: translateY(20%) translateX(-50%);
33
- opacity: 0;
34
  -webkit-transition: all 0.3s;
35
  -moz-transition: all 0.3s;
36
  transition: all 0.3s;
@@ -51,7 +43,7 @@ body.welcome-mat-blur > *:not(#igSplashElement) { -webkit-filter: blur(8px); -m
51
  .igModalBody {background-color: white;width: 100%;}
52
  .countryDropDownWrapper {width: 100%;min-height: 25px;-webkit-border-radius: 2px;border-radius: 2px;background: #eee;border: 0px; /* Set the color of your choice here */margin: 0 auto;padding: 0px;cursor: pointer;position: relative;}
53
  .countryDropDownWrapper i { position: absolute; right: 10px; top: 10px; color: rgba(0,0,0,.3); }
54
- #countrySelect { width:100%; position: relative; box-shadow: 0px 0px 0px; padding: 10px 15px;margin: 0px;font-size: 14px;line-height: 14px;color: #333 !important;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;-o-user-select: none;user-select: none;background: none !important;border: 0 !important;-webkit-appearance: none;-moz-appearance: window;appearance: none;ms-appearance: none;overflow: hidden;height: 44px;text-align: center;text-align-last: center;}
55
  select::-ms-expand { display: none; }
56
  ul.featureList { padding: 30px; margin: 20px 0px 30px; background-color: #eee; display: none !important; }
57
  ul.featureList li { list-style-type: none; padding: 5px 0px; }
@@ -59,13 +51,6 @@ ul.featureList li i { position: relative; top: 6px; }
59
  .igWelcomeCTAButton { width: 100%;padding: 0px 30px 30px; box-sizing: border-box;}
60
  .igWelcomeCTAButton button {width: 100%;height: 44px;-webkit-border-radius: 2px;border-radius: 2px;color: white;margin: 0 auto;border: none;font-size: 14px;font-weight: normal; background-color: #333;opacity: 1;text-shadow: none;float: none;text-transform: uppercase;text-align: center;}
61
  .igWelcomeCTAButton button:hover { color: white; background-color: #666; opacity: 1; }
62
- .modal-open {
63
- -webkit-transform: translateY(-50%) translateX(-50%) !important;
64
- -moz-transform: translateY(-50%) translateX(-50%) !important;
65
- -ms-transform: translateY(-50%) translateX(-50%) !important;
66
- transform: translateY(-50%) translateX(-50%) !important;
67
- opacity: 1 !important;
68
- }
69
 
70
  @media screen and (max-width: 600px) { /* Responsive design sets a width of 400px for all devices <= 600px */
71
  #igSplashElement { width: 95%; top: 10px; }
9
  #igFlag { width: 30px; }
10
  #igFlag img { max-width: 25px; margin-bottom: -3px; cursor: pointer; margin-left: 5px;}
11
 
 
 
 
12
  /* Begin Modal Styles */
13
  #igSplashElement {
14
+ position: fixed;
15
  max-width: 500px;
16
  background-color: #fff;
17
+ top: 30%;
18
+ left: 37%;
19
  width: 100%;
20
  -webkit-box-shadow: 0px 0px 60px 0px rgba(0, 0, 0, 0.5);
21
  box-shadow: 0px 0px 60px 0px rgba(0, 0, 0, 0.5);
23
  font-size: 14px;
24
  font-family: 'Roboto', Helvetica, Arial, sans-serif;
25
  /* The CSS below is for the opening and closing animation */
 
 
 
 
 
26
  -webkit-transition: all 0.3s;
27
  -moz-transition: all 0.3s;
28
  transition: all 0.3s;
43
  .igModalBody {background-color: white;width: 100%;}
44
  .countryDropDownWrapper {width: 100%;min-height: 25px;-webkit-border-radius: 2px;border-radius: 2px;background: #eee;border: 0px; /* Set the color of your choice here */margin: 0 auto;padding: 0px;cursor: pointer;position: relative;}
45
  .countryDropDownWrapper i { position: absolute; right: 10px; top: 10px; color: rgba(0,0,0,.3); }
46
+ #countrySelect { width:100%; position: relative; box-shadow: 0px 0px 0px; padding: 10px 15px; padding-left: 60px; margin: 0px;font-size: 14px;line-height: 14px;color: #333 !important;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;-o-user-select: none;user-select: none;background: none !important;border: 0 !important;-webkit-appearance: none;-moz-appearance: window;appearance: none;ms-appearance: none;overflow: hidden;height: 44px;text-align: left;}
47
  select::-ms-expand { display: none; }
48
  ul.featureList { padding: 30px; margin: 20px 0px 30px; background-color: #eee; display: none !important; }
49
  ul.featureList li { list-style-type: none; padding: 5px 0px; }
51
  .igWelcomeCTAButton { width: 100%;padding: 0px 30px 30px; box-sizing: border-box;}
52
  .igWelcomeCTAButton button {width: 100%;height: 44px;-webkit-border-radius: 2px;border-radius: 2px;color: white;margin: 0 auto;border: none;font-size: 14px;font-weight: normal; background-color: #333;opacity: 1;text-shadow: none;float: none;text-transform: uppercase;text-align: center;}
53
  .igWelcomeCTAButton button:hover { color: white; background-color: #666; opacity: 1; }
 
 
 
 
 
 
 
54
 
55
  @media screen and (max-width: 600px) { /* Responsive design sets a width of 400px for all devices <= 600px */
56
  #igSplashElement { width: 95%; top: 10px; }
js/iGlobal/ig_welcome_mat_default.js CHANGED
@@ -11,7 +11,7 @@ var ig_storeId = ig_vars.storeId || 3;
11
  var ig_cookieDomain = window.location.hostname;// If you prefer, you can put your domain here, like so "yourdomain.com";
12
  var ig_countries = ig_vars.servicedCountries || {"AL":"Albania","DZ":"Algeria","AS":"American Samoa","AD":"Andorra","AO":"Angola","AI":"Anguilla","AG":"Antigua","AR":"Argentina","AM":"Armenia","AW":"Aruba","AU":"Australia","AT":"Austria","AZ":"Azerbaijan","BS":"Bahamas","BH":"Bahrain","BD":"Bangladesh","BB":"Barbados","BE":"Belgium","BZ":"Belize","BJ":"Benin","BM":"Bermuda","BT":"Bhutan","BO":"Bolivia","BQ":"Bonaire, St. Eustatius & Saba","BA":"Bosnia & Herzegovina","BW":"Botswana","BR":"Brazil","BN":"Brunei","BG":"Bulgaria","BF":"Burkina Faso","BI":"Burundi","KH":"Cambodia","CM":"Cameroon","CA":"Canada","IC":"Canary Islands","CV":"Cape Verde","KY":"Cayman Islands","CF":"Central African Republic","TD":"Chad","CL":"Chile","CN":"China - People's Republic of","CO":"Colombia","KM":"Comoros","CG":"Congo","CK":"Cook Islands","CR":"Costa Rica","HR":"Croatia","CW":"Curaçao","CY":"Cyprus","CZ":"Czech Republic","DK":"Denmark","DJ":"Djibouti","DM":"Dominica","DO":"Dominican Republic","EC":"Ecuador","EG":"Egypt","SV":"El Salvador","GQ":"Equatorial Guinea","ER":"Eritrea","EE":"Estonia","ET":"Ethiopia","FK":"Falkland Islands","FO":"Faroe Islands (Denmark)","FJ":"Fiji","FI":"Finland","FR":"France","GF":"French Guiana","GA":"Gabon","GM":"Gambia","GE":"Georgia","DE":"Germany","GH":"Ghana","GI":"Gibraltar","GR":"Greece","GL":"Greenland (Denmark)","GD":"Grenada","GP":"Guadeloupe","GU":"Guam","GT":"Guatemala","GG":"Guernsey","GN":"Guinea","GW":"Guinea-Bissau","GY":"Guyana","HT":"Haiti","HN":"Honduras","HK":"Hong Kong","HU":"Hungary","IS":"Iceland","IN":"India","ID":"Indonesia","IE":"Ireland - Republic Of","IL":"Israel","IT":"Italy","CI":"Ivory Coast","JM":"Jamaica","JP":"Japan","JE":"Jersey","JO":"Jordan","KZ":"Kazakhstan","KE":"Kenya","KI":"Kiribati","KR":"Korea, Republic of (South Korea)","KW":"Kuwait","KG":"Kyrgyzstan","LA":"Laos","LV":"Latvia","LS":"Lesotho","LR":"Liberia","LI":"Liechtenstein","LT":"Lithuania","LU":"Luxembourg","MO":"Macau","MK":"Macedonia","MG":"Madagascar","MW":"Malawi","MY":"Malaysia","MV":"Maldives","ML":"Mali","MT":"Malta","MH":"Marshall Islands","MQ":"Martinique","MR":"Mauritania","MU":"Mauritius","YT":"Mayotte","MX":"Mexico","FM":"Micronesia - Federated States of","MD":"Moldova","MC":"Monaco","MN":"Mongolia","ME":"Montenegro","MS":"Montserrat","MA":"Morocco","MZ":"Mozambique","MM":"Myanmar","NA":"Namibia","NR":"Nauru, Republic of","NP":"Nepal","NL":"Netherlands (Holland)","NV":"Nevis","NC":"New Caledonia","NZ":"New Zealand","NI":"Nicaragua","NE":"Niger","NG":"Nigeria","NU":"Niue Island","NO":"Norway","OM":"Oman","PK":"Pakistan","PW":"Palau","PA":"Panama","PG":"Papua New Guinea","PY":"Paraguay","PE":"Peru","PH":"Philippines","PL":"Poland","PT":"Portugal","PR":"Puerto Rico","QA":"Qatar","RE":"Reunion","RO":"Romania","RU":"Russia","RW":"Rwanda","SM":"San Marino","ST":"Sao Tome & Principe","SA":"Saudi Arabia","SN":"Senegal","RS":"Serbia & Montenegro","SC":"Seychelles","SL":"Sierra Leone","SG":"Singapore","SK":"Slovakia","SI":"Slovenia","SB":"Solomon Islands","ZA":"South Africa","SS":"South Sudan","ES":"Spain","LK":"Sri Lanka","BL":"St. Barthelemy","EU":"St. Eustatius","KN":"St. Kitts and Nevis","LC":"St. Lucia","MF":"St. Maarten","VC":"St. Vincent","SR":"Suriname","SZ":"Swaziland","SE":"Sweden","CH":"Switzerland","PF":"Tahiti","TW":"Taiwan","TJ":"Tajikistan","TZ":"Tanzania","TH":"Thailand","TL":"Timor-Leste","TG":"Togo","TO":"Tonga","TT":"Trinidad and Tobago","TN":"Tunisia","TR":"Turkey","TM":"Turkmenistan","TC":"Turks and Caicos Islands","TV":"Tuvalu","UG":"Uganda","UA":"Ukraine","AE":"United Arab Emirates","GB":"United Kingdom","US":"United States","UY":"Uruguay","UZ":"Uzbekistan","VU":"Vanuatu","VE":"Venezuela","VN":"Vietnam","VG":"Virgin Islands (British)","VI":"Virgin Islands (U.S.)","WS":"Western Samoa","YE":"Yemen","ZM":"Zambia","ZW":"Zimbabwe"};
13
  var ig_domesticCountryCodes = (ig_vars.domesticCountries || 'US').split(",");
14
- var ig_logoUrl = ig_vars.storeLogo || "http://iglobalstores.com/images/iglobal-stores.png";
15
  var ig_flagLocation = ig_vars.flag_parent || "body";
16
  var ig_flagMethod = ig_vars.flag_method || "prepend";
17
  var ig_flagCode = ig_vars.flag_code || '<div id="igFlag"></div>';
11
  var ig_cookieDomain = window.location.hostname;// If you prefer, you can put your domain here, like so "yourdomain.com";
12
  var ig_countries = ig_vars.servicedCountries || {"AL":"Albania","DZ":"Algeria","AS":"American Samoa","AD":"Andorra","AO":"Angola","AI":"Anguilla","AG":"Antigua","AR":"Argentina","AM":"Armenia","AW":"Aruba","AU":"Australia","AT":"Austria","AZ":"Azerbaijan","BS":"Bahamas","BH":"Bahrain","BD":"Bangladesh","BB":"Barbados","BE":"Belgium","BZ":"Belize","BJ":"Benin","BM":"Bermuda","BT":"Bhutan","BO":"Bolivia","BQ":"Bonaire, St. Eustatius & Saba","BA":"Bosnia & Herzegovina","BW":"Botswana","BR":"Brazil","BN":"Brunei","BG":"Bulgaria","BF":"Burkina Faso","BI":"Burundi","KH":"Cambodia","CM":"Cameroon","CA":"Canada","IC":"Canary Islands","CV":"Cape Verde","KY":"Cayman Islands","CF":"Central African Republic","TD":"Chad","CL":"Chile","CN":"China - People's Republic of","CO":"Colombia","KM":"Comoros","CG":"Congo","CK":"Cook Islands","CR":"Costa Rica","HR":"Croatia","CW":"Curaçao","CY":"Cyprus","CZ":"Czech Republic","DK":"Denmark","DJ":"Djibouti","DM":"Dominica","DO":"Dominican Republic","EC":"Ecuador","EG":"Egypt","SV":"El Salvador","GQ":"Equatorial Guinea","ER":"Eritrea","EE":"Estonia","ET":"Ethiopia","FK":"Falkland Islands","FO":"Faroe Islands (Denmark)","FJ":"Fiji","FI":"Finland","FR":"France","GF":"French Guiana","GA":"Gabon","GM":"Gambia","GE":"Georgia","DE":"Germany","GH":"Ghana","GI":"Gibraltar","GR":"Greece","GL":"Greenland (Denmark)","GD":"Grenada","GP":"Guadeloupe","GU":"Guam","GT":"Guatemala","GG":"Guernsey","GN":"Guinea","GW":"Guinea-Bissau","GY":"Guyana","HT":"Haiti","HN":"Honduras","HK":"Hong Kong","HU":"Hungary","IS":"Iceland","IN":"India","ID":"Indonesia","IE":"Ireland - Republic Of","IL":"Israel","IT":"Italy","CI":"Ivory Coast","JM":"Jamaica","JP":"Japan","JE":"Jersey","JO":"Jordan","KZ":"Kazakhstan","KE":"Kenya","KI":"Kiribati","KR":"Korea, Republic of (South Korea)","KW":"Kuwait","KG":"Kyrgyzstan","LA":"Laos","LV":"Latvia","LS":"Lesotho","LR":"Liberia","LI":"Liechtenstein","LT":"Lithuania","LU":"Luxembourg","MO":"Macau","MK":"Macedonia","MG":"Madagascar","MW":"Malawi","MY":"Malaysia","MV":"Maldives","ML":"Mali","MT":"Malta","MH":"Marshall Islands","MQ":"Martinique","MR":"Mauritania","MU":"Mauritius","YT":"Mayotte","MX":"Mexico","FM":"Micronesia - Federated States of","MD":"Moldova","MC":"Monaco","MN":"Mongolia","ME":"Montenegro","MS":"Montserrat","MA":"Morocco","MZ":"Mozambique","MM":"Myanmar","NA":"Namibia","NR":"Nauru, Republic of","NP":"Nepal","NL":"Netherlands (Holland)","NV":"Nevis","NC":"New Caledonia","NZ":"New Zealand","NI":"Nicaragua","NE":"Niger","NG":"Nigeria","NU":"Niue Island","NO":"Norway","OM":"Oman","PK":"Pakistan","PW":"Palau","PA":"Panama","PG":"Papua New Guinea","PY":"Paraguay","PE":"Peru","PH":"Philippines","PL":"Poland","PT":"Portugal","PR":"Puerto Rico","QA":"Qatar","RE":"Reunion","RO":"Romania","RU":"Russia","RW":"Rwanda","SM":"San Marino","ST":"Sao Tome & Principe","SA":"Saudi Arabia","SN":"Senegal","RS":"Serbia & Montenegro","SC":"Seychelles","SL":"Sierra Leone","SG":"Singapore","SK":"Slovakia","SI":"Slovenia","SB":"Solomon Islands","ZA":"South Africa","SS":"South Sudan","ES":"Spain","LK":"Sri Lanka","BL":"St. Barthelemy","EU":"St. Eustatius","KN":"St. Kitts and Nevis","LC":"St. Lucia","MF":"St. Maarten","VC":"St. Vincent","SR":"Suriname","SZ":"Swaziland","SE":"Sweden","CH":"Switzerland","PF":"Tahiti","TW":"Taiwan","TJ":"Tajikistan","TZ":"Tanzania","TH":"Thailand","TL":"Timor-Leste","TG":"Togo","TO":"Tonga","TT":"Trinidad and Tobago","TN":"Tunisia","TR":"Turkey","TM":"Turkmenistan","TC":"Turks and Caicos Islands","TV":"Tuvalu","UG":"Uganda","UA":"Ukraine","AE":"United Arab Emirates","GB":"United Kingdom","US":"United States","UY":"Uruguay","UZ":"Uzbekistan","VU":"Vanuatu","VE":"Venezuela","VN":"Vietnam","VG":"Virgin Islands (British)","VI":"Virgin Islands (U.S.)","WS":"Western Samoa","YE":"Yemen","ZM":"Zambia","ZW":"Zimbabwe"};
13
  var ig_domesticCountryCodes = (ig_vars.domesticCountries || 'US').split(",");
14
+ var ig_logoUrl = ig_vars.storeLogo || "https://iglobalstores.com/images/iglobal-stores.png";
15
  var ig_flagLocation = ig_vars.flag_parent || "body";
16
  var ig_flagMethod = ig_vars.flag_method || "prepend";
17
  var ig_flagCode = ig_vars.flag_code || '<div id="igFlag"></div>';
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iglobal_Main</name>
4
- <version>1.5.5</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
@@ -29,12 +29,11 @@
29
  The iGlobal Stores extension will have limited use for stores that are not set up with an iGlobal Stores account. In order to accept orders internationally through iGlobal Stores, please contact us at 1-800-942-0721, at www.iglobalstores.com or at info@iglobalstores.com.</description>
30
  <notes>New Features:&#xD;
31
  &#xD;
32
- Update the shipping method with the actual shipping method chosen.&#xD;
33
- </notes>
34
  <authors><author><name>Brian Olsen</name><user>brianolsen</user><email>brian@iglobalstores.com</email></author><author><name>iGlobal Stores</name><user>iGlobalStores</user><email>travis@iglobalstores.com</email></author></authors>
35
- <date>2017-08-07</date>
36
- <time>21:03:53</time>
37
- <contents><target name="mageetc"><dir name="modules"><file name="Iglobal_Stores.xml" hash="56839ad045b6a99f97564de63ebed700"/><file name="Iglobal_Ship.xml" hash=""/></dir></target><target name="magecommunity"><dir name="Iglobal"><dir name="Stores"><dir name="Block"><file name="Ajax.php" hash="5d288c6bc298db3bdc86adcdd036bdd6"/><file name="Cart.php" hash="a162e67a8c445b911dd25897e4d886a3"/><file name="Includes.php" hash="8214ef5eae6a83e2909f8ebeee6ea1f7"/><file name="Link.php" hash="69b0efcc8d2ffd6ca9daed407260d793"/></dir><dir name="Helper"><file name="Configoptions.php" hash="b129e55b21f845a20d6e7fdb3b532be3"/><file name="Data.php" hash="4b4d51e05c6565a4413d68a9ef3ae555"/><file name="Url.php" hash="e430471ab463e1fc7812c4a96d5f3208"/></dir><dir name="Model"><file name="Carrier.php" hash="2c255448c82e20f375a8a81dae912a6e"/><file name="Configoptions.php" hash="2cbd3eb8357f80c2de5a48f32709b1c5"/><dir name="International"><file name="International.php" hash="c0d897eafe1fe60f725147c5e8789131"/></dir><file name="Observer.php" hash="8bca52293f76cab0c92e8e30ada75662"/><file name="Order.php" hash="42a9fc6cf2ab6d2e0ffa73304da17f5f"/><dir name="Payment"><file name="Iglobal.php" hash="9ac8f8d81b8f8d547831ad6db8a1c7fc"/><file name="Iglobalcreditcard.php" hash="f2f5cf4507a128fadc95071951ca2a41"/><file name="Iglobalpaypal.php" hash="3a566289db82b177ce6b52ce205728f6"/></dir><dir name="Resource"><file name="Setup.php" hash="f725924af461644af75a455210097a53"/></dir><file name="Rest.php" hash="98750cee4441854556cd5fe283e4e13e"/><dir name="Service"><file name="Quote.php" hash="bae0e5a710b9e3aa1427bb78a08fbfd8"/></dir><file name="Tax.php" hash="9645d04415913bea333b5aba99b1909c"/></dir><dir name="controllers"><file name="AjaxController.php" hash="62228ca95872788a18256bbf20839a07"/><file name="CheckoutController.php" hash="dc79a1b3d6734051ea0081f272432911"/><file name="SuccessController.php" hash="ed6df1368ce185de7bf6c557e55d2339"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7f10c9724b1294a506df47cf569bc9e6"/><file name="config.xml" hash="137bec6da315903775a30699ca6a97c4"/><file name="system.xml" hash="c5a58d69f8891793f2c94571f3b221f9"/></dir><dir name="sql"><dir name="iglobal_stores_setup"><file name="mysql4-install-0.1.0.php" hash="72c543090fe27608e582d22494b65d75"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="51e83dd266d7b232d42f03cac66350df"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="4dc024ad63d7a7ea20697ddef4b60a29"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="51e83dd266d7b232d42f03cac66350df"/><file name="mysql4-upgrade-0.1.3-1.0.0.php" hash="829b7c08d5bce22b5c1750a3d72e21ca"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iglobal.xml" hash="6df6f5f0aceab891d0cd13061a3b5e55"/></dir><dir name="template"><dir name="iglobal"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="06280040dd9521efcd36c12779648108"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iglobal.xml" hash="d49680762997b0480aaaeae331dc4695"/></dir><dir name="template"><dir name="iglobal"><dir name="checkout"><dir name="cart"><dir name="item"><dir name="configure"><file name="updatecart.phtml" hash="9eaac8c650b6986db7c0a5005966c4ee"/></dir></dir></dir><dir name="onepage"><file name="link.phtml" hash="12a68b6580f9441bc0400b72c66b8358"/></dir></dir><dir name="stores"><file name="cart.phtml" hash="6afb67cae6995499ad5d13bbf56b1b0a"/><file name="igcincludes.phtml" hash="43752aafba25bc795f9f708c0d470181"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="iGlobal"><file name="ig_welcome_mat_default.css" hash="6067b53be104d439c33bcbbd349f4b41"/><file name="ig_welcome_mat_default.js" hash="27e179a7509505c6feee121b46298b88"/><file name="igc.cs.magento_default_ice.js" hash="eb2507a442883dda09975301455877a7"/><dir name="jquery"><file name="jquery.js" hash="6903c661e9db496b11e737478528318f"/><file name="jquery.noconflict.js" hash="09bfdd3b964eb2b17b5d6caa1d20a607"/></dir></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.2.0</min><max>7.0.7</max></php></required></dependencies>
40
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iglobal_Main</name>
4
+ <version>1.5.6</version>
5
  <stability>stable</stability>
6
  <license>OSL</license>
7
  <channel>community</channel>
29
  The iGlobal Stores extension will have limited use for stores that are not set up with an iGlobal Stores account. In order to accept orders internationally through iGlobal Stores, please contact us at 1-800-942-0721, at www.iglobalstores.com or at info@iglobalstores.com.</description>
30
  <notes>New Features:&#xD;
31
  &#xD;
32
+ Save off payment transaction details to the order transaction.</notes>
 
33
  <authors><author><name>Brian Olsen</name><user>brianolsen</user><email>brian@iglobalstores.com</email></author><author><name>iGlobal Stores</name><user>iGlobalStores</user><email>travis@iglobalstores.com</email></author></authors>
34
+ <date>2017-09-11</date>
35
+ <time>22:37:27</time>
36
+ <contents><target name="mageetc"><dir name="modules"><file name="Iglobal_Stores.xml" hash="56839ad045b6a99f97564de63ebed700"/></dir></target><target name="magecommunity"><dir name="Iglobal"><dir name="Stores"><dir name="Block"><file name="Ajax.php" hash="5d288c6bc298db3bdc86adcdd036bdd6"/><file name="Cart.php" hash="a162e67a8c445b911dd25897e4d886a3"/><file name="Includes.php" hash="8214ef5eae6a83e2909f8ebeee6ea1f7"/><file name="Link.php" hash="69b0efcc8d2ffd6ca9daed407260d793"/></dir><dir name="Helper"><file name="Configoptions.php" hash="b129e55b21f845a20d6e7fdb3b532be3"/><file name="Data.php" hash="95b0a619bff6bfd288a748aca65cdba9"/><file name="Url.php" hash="e430471ab463e1fc7812c4a96d5f3208"/></dir><dir name="Model"><file name="Carrier.php" hash="2c255448c82e20f375a8a81dae912a6e"/><file name="Configoptions.php" hash="2cbd3eb8357f80c2de5a48f32709b1c5"/><dir name="International"><file name="International.php" hash="afe4d55d944b7883fb9a14ded44d767a"/></dir><file name="Observer.php" hash="55a6d027d7054593a3d9cfa5725f52d2"/><file name="Order.php" hash="c0cba4709a2c29222da09f84f85a452e"/><dir name="Payment"><file name="Iglobal.php" hash="41aa3c183e10b6ac5c8af65e1fcf7e21"/><file name="Iglobalcreditcard.php" hash="aa62b9bf8b2f93cc4994869bbf1326f8"/><file name="Iglobalpaypal.php" hash="36d1d347abe30fe45dc52968f0e93d17"/></dir><dir name="Resource"><file name="Setup.php" hash="f725924af461644af75a455210097a53"/></dir><file name="Rest.php" hash="267d2fdc2357886e752535879f47b418"/><dir name="Service"><file name="Quote.php" hash="bae0e5a710b9e3aa1427bb78a08fbfd8"/></dir><file name="Tax.php" hash="9645d04415913bea333b5aba99b1909c"/></dir><dir name="controllers"><file name="AjaxController.php" hash="62228ca95872788a18256bbf20839a07"/><file name="CheckoutController.php" hash="dc79a1b3d6734051ea0081f272432911"/><file name="SuccessController.php" hash="33e759cea3b668dfe5a55ca575c6359e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7f10c9724b1294a506df47cf569bc9e6"/><file name="config.xml" hash="137bec6da315903775a30699ca6a97c4"/><file name="system.xml" hash="c5a58d69f8891793f2c94571f3b221f9"/></dir><dir name="sql"><dir name="iglobal_stores_setup"><file name="mysql4-install-0.1.0.php" hash="72c543090fe27608e582d22494b65d75"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="51e83dd266d7b232d42f03cac66350df"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="4dc024ad63d7a7ea20697ddef4b60a29"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="51e83dd266d7b232d42f03cac66350df"/><file name="mysql4-upgrade-0.1.3-1.0.0.php" hash="829b7c08d5bce22b5c1750a3d72e21ca"/></dir></dir><file name=".DS_Store" hash="9be95711b9cb71b324b62e1df33a1f10"/></dir><dir name="Stores.full"><dir name="Block"><file name="Ajax.php" hash="5d288c6bc298db3bdc86adcdd036bdd6"/><file name="Cart.php" hash="a162e67a8c445b911dd25897e4d886a3"/><file name="Includes.php" hash="8214ef5eae6a83e2909f8ebeee6ea1f7"/><file name="Link.php" hash="69b0efcc8d2ffd6ca9daed407260d793"/></dir><dir name="Helper"><file name="Configoptions.php" hash="b129e55b21f845a20d6e7fdb3b532be3"/><file name="Data.php" hash="4b4d51e05c6565a4413d68a9ef3ae555"/><file name="Url.php" hash="e430471ab463e1fc7812c4a96d5f3208"/></dir><dir name="Model"><file name="Carrier.php" hash="2c255448c82e20f375a8a81dae912a6e"/><file name="Configoptions.php" hash="2cbd3eb8357f80c2de5a48f32709b1c5"/><dir name="International"><file name="International.php" hash="c0d897eafe1fe60f725147c5e8789131"/></dir><file name="Observer.php" hash="55a6d027d7054593a3d9cfa5725f52d2"/><file name="Order.php" hash="b04c43c7524b927c85334befa20c02dd"/><dir name="Payment"><file name="Iglobal.php" hash="41aa3c183e10b6ac5c8af65e1fcf7e21"/><file name="Iglobalcreditcard.php" hash="aa62b9bf8b2f93cc4994869bbf1326f8"/><file name="Iglobalpaypal.php" hash="36d1d347abe30fe45dc52968f0e93d17"/></dir><dir name="Resource"><file name="Setup.php" hash="f725924af461644af75a455210097a53"/></dir><file name="Rest.php" hash="98750cee4441854556cd5fe283e4e13e"/><dir name="Service"><file name="Quote.php" hash="bae0e5a710b9e3aa1427bb78a08fbfd8"/></dir><file name="Tax.php" hash="9645d04415913bea333b5aba99b1909c"/></dir><dir name="controllers"><file name="AjaxController.php" hash="62228ca95872788a18256bbf20839a07"/><file name="CheckoutController.php" hash="ca3404a01f93faa77c6e8acfba91ae20"/><file name="SuccessController.php" hash="33e759cea3b668dfe5a55ca575c6359e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7f10c9724b1294a506df47cf569bc9e6"/><file name="config.xml" hash="137bec6da315903775a30699ca6a97c4"/><file name="system.xml" hash="c5a58d69f8891793f2c94571f3b221f9"/></dir><dir name="sql"><dir name="iglobal_stores_setup"><file name="mysql4-install-0.1.0.php" hash="72c543090fe27608e582d22494b65d75"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="51e83dd266d7b232d42f03cac66350df"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="4dc024ad63d7a7ea20697ddef4b60a29"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="51e83dd266d7b232d42f03cac66350df"/><file name="mysql4-upgrade-0.1.3-1.0.0.php" hash="829b7c08d5bce22b5c1750a3d72e21ca"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iglobal.xml" hash="6df6f5f0aceab891d0cd13061a3b5e55"/></dir><dir name="template"><dir name="iglobal"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="06280040dd9521efcd36c12779648108"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iglobal.xml" hash="d49680762997b0480aaaeae331dc4695"/></dir><dir name="template"><dir name="iglobal"><dir name="checkout"><dir name="cart"><dir name="item"><dir name="configure"><file name="updatecart.phtml" hash="9eaac8c650b6986db7c0a5005966c4ee"/></dir></dir></dir><dir name="onepage"><file name="link.phtml" hash="12a68b6580f9441bc0400b72c66b8358"/></dir></dir><dir name="stores"><file name="cart.phtml" hash="6afb67cae6995499ad5d13bbf56b1b0a"/><file name="igcincludes.phtml" hash="43752aafba25bc795f9f708c0d470181"/></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="iGlobal"><file name="ig_welcome_mat_default.css" hash="0cc7e4da2d6adae94e53326e5bae369a"/><file name="ig_welcome_mat_default.js" hash="5d2037bed1e3530ec278377bfbb7083c"/><file name="igc.cs.magento_default_ice.js" hash="eb2507a442883dda09975301455877a7"/><dir name="jquery"><file name="jquery.js" hash="6903c661e9db496b11e737478528318f"/><file name="jquery.noconflict.js" hash="09bfdd3b964eb2b17b5d6caa1d20a607"/></dir></dir></dir></target></contents>
37
  <compatible/>
38
  <dependencies><required><php><min>5.2.0</min><max>7.0.7</max></php></required></dependencies>
39
  </package>