Version Notes
New Features:
Send applied discounts to checkout
Include product options in the description
Update order status from iglobal
Improvements:
the order number is passed back as a reference to iglobal
Download this release
Release Info
Developer | Matt Flamm |
Extension | Iglobal_Main |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.3.0
- app/code/community/Iglobal/Stores/Helper/Data.php +64 -104
- app/code/community/Iglobal/Stores/Model/International/International.php +13 -28
- app/code/community/Iglobal/Stores/Model/Observer.php +52 -101
- app/code/community/Iglobal/Stores/Model/Order.php +93 -17
- app/code/community/Iglobal/Stores/Model/Sales/Quote/Address/Total/Fee.php +30 -13
- app/code/community/Iglobal/Stores/controllers/SuccessController.php +3 -7
- app/code/community/Iglobal/Stores/etc/config.xml +4 -3
- app/design/frontend/base/default/template/iglobal/stores/cart.phtml +32 -255
- package.xml +11 -11
app/code/community/Iglobal/Stores/Helper/Data.php
CHANGED
@@ -2,110 +2,6 @@
|
|
2 |
|
3 |
class Iglobal_Stores_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
5 |
-
protected static $_i = 1;
|
6 |
-
|
7 |
-
public function showHiddenProductFields($item)
|
8 |
-
{
|
9 |
-
$sku = $item->getProduct()->getTypeId() == 'bundle' ? substr($item->getSku(), strpos($item->getSku(), '-')+1) : $item->getSku();
|
10 |
-
$id = $item->getProductId();
|
11 |
-
$price = $item->getPrice();
|
12 |
-
// This is because Magento fails to load the custom attributes on this php template, hence we have to go back to the DB.
|
13 |
-
$weight = "";
|
14 |
-
$length = "";
|
15 |
-
$width = "";
|
16 |
-
$height = "";
|
17 |
-
|
18 |
-
try {
|
19 |
-
|
20 |
-
$allItemData = Mage::getModel('catalog/product')->load($item['product_id']);
|
21 |
-
try {
|
22 |
-
$weightUnits = "";
|
23 |
-
if (!empty($allItemData['ig_weight_units'])) {
|
24 |
-
$weightUnits = $allItemData->getAttributeText('ig_weight_units');
|
25 |
-
}
|
26 |
-
} catch (Exception $e) {
|
27 |
-
$weightUnits = "";
|
28 |
-
}
|
29 |
-
try {
|
30 |
-
$weight = "";
|
31 |
-
if (!empty($allItemData['ig_weight'])) {
|
32 |
-
$weight = $allItemData->getData('ig_weight');
|
33 |
-
}
|
34 |
-
if (!empty($weight)) {
|
35 |
-
if ($weightUnits=="kg") {
|
36 |
-
$weight = round(floatval($weight) / 0.453592, 2);
|
37 |
-
} else if ($weightUnits=="oz") {
|
38 |
-
$weight = round(floatval($weight) / 16, 2);
|
39 |
-
} else if ($weightUnits=="g") {
|
40 |
-
$weight = round(floatval($weight) / 453.592, 2);
|
41 |
-
} else {//Default is lbs
|
42 |
-
$weight = round(floatval($weight), 2);
|
43 |
-
}
|
44 |
-
} else {
|
45 |
-
$weight = "";
|
46 |
-
}
|
47 |
-
} catch(Exception $e) {
|
48 |
-
$weight = "";
|
49 |
-
}
|
50 |
-
try {
|
51 |
-
$dimUnits = "";
|
52 |
-
if (!empty($allItemData['ig_dimension_units'])) {
|
53 |
-
$dimUnits = $allItemData->getAttributeText('ig_dimension_units');
|
54 |
-
}
|
55 |
-
} catch (Exception $e) {
|
56 |
-
$dimUnits = "";
|
57 |
-
}
|
58 |
-
try {
|
59 |
-
$length = "";
|
60 |
-
if (!empty($allItemData['ig_length'])) {
|
61 |
-
$length = $allItemData->getData('ig_length');
|
62 |
-
}
|
63 |
-
$width = "";
|
64 |
-
if (!empty($allItemData['ig_width'])) {
|
65 |
-
$width = $allItemData->getData('ig_width');
|
66 |
-
}
|
67 |
-
$height = "";
|
68 |
-
if (!empty($allItemData['ig_height'])) {
|
69 |
-
$height = $allItemData->getData('ig_height');
|
70 |
-
}
|
71 |
-
if (!empty($length) && !empty($width) && !empty($height)) {
|
72 |
-
if ($dimUnits=="cm") {
|
73 |
-
$length = ceil(floatval($length) / 2.54);
|
74 |
-
$width = ceil(floatval($width) / 2.54);
|
75 |
-
$height = ceil(floatval($height) / 2.54);
|
76 |
-
} else {//Default is inches
|
77 |
-
$length = ceil(floatval($length));
|
78 |
-
$width = ceil(floatval($width));
|
79 |
-
$height = ceil(floatval($height));
|
80 |
-
}
|
81 |
-
} else {
|
82 |
-
$length = "";
|
83 |
-
$width = "";
|
84 |
-
$height = "";
|
85 |
-
}
|
86 |
-
} catch(Exception $e) {
|
87 |
-
$length = "";
|
88 |
-
$width = "";
|
89 |
-
$height = "";
|
90 |
-
}
|
91 |
-
} catch (Exception $outerE) {
|
92 |
-
|
93 |
-
}
|
94 |
-
|
95 |
-
echo "<div class='ig_itemAttributes' style='display:none;'>";
|
96 |
-
echo "<span class='ig_itemProductId'>".$id."</span>";
|
97 |
-
echo "<span class='ig_itemSku'>".$sku."</span>";
|
98 |
-
echo "<span class='ig_itemPrice'>".$price."</span>";
|
99 |
-
echo "<span class='ig_itemWeight'>".$weight."</span>";
|
100 |
-
echo "<span class='ig_itemLength'>".$length."</span>";
|
101 |
-
echo "<span class='ig_itemWidth'>".$width."</span>";
|
102 |
-
echo "<span class='ig_itemHeight'>".$height."</span>";
|
103 |
-
echo "</div>";
|
104 |
-
|
105 |
-
self::$_i++;
|
106 |
-
}
|
107 |
-
|
108 |
-
//stuff for jquery observer
|
109 |
/**
|
110 |
* Path for config.
|
111 |
*/
|
@@ -126,6 +22,70 @@ class Iglobal_Stores_Helper_Data extends Mage_Core_Helper_Abstract
|
|
126 |
'jquery.noconflict.js',
|
127 |
);
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
/**
|
130 |
* Check enabled.
|
131 |
*
|
2 |
|
3 |
class Iglobal_Stores_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
* Path for config.
|
7 |
*/
|
22 |
'jquery.noconflict.js',
|
23 |
);
|
24 |
|
25 |
+
public function units2lbs($value, $unit='lbs')
|
26 |
+
{
|
27 |
+
$convert = array('kg' => 0.453592, 'oz' => 16, 'g' => 453.592, 'lbs' => 1, '' => 1);
|
28 |
+
$value = round(floatval($value) / $convert[$unit], 2);
|
29 |
+
if($value){
|
30 |
+
return $value;
|
31 |
+
}
|
32 |
+
return null;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function dim2inch($value, $dim='in')
|
36 |
+
{
|
37 |
+
$convert = array('cm' => 2.54, 'in' => 1, '' => 1);
|
38 |
+
$value = ceil(floatval($value) / $convert[$dim]);
|
39 |
+
if($value){
|
40 |
+
return $value;
|
41 |
+
}
|
42 |
+
return null;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getDimensions($product, $item)
|
46 |
+
{
|
47 |
+
$dim = $product->getIgDemesionUnits();
|
48 |
+
$weight = $product->getIgWeight();
|
49 |
+
if (empty($weight))
|
50 |
+
{
|
51 |
+
$weight = $item->getWeight();
|
52 |
+
}
|
53 |
+
$dimensions = array(
|
54 |
+
'weight' => $this->units2lbs($weight, $product->getIgWeightUnits()),
|
55 |
+
'length' => $this->dim2inch($product->getIgLength(), $dim),
|
56 |
+
'width' => $this->dim2inch($product->getIgWidth(), $dim),
|
57 |
+
'height' => $this->dim2inch($product->getIgHeight(), $dim),
|
58 |
+
);
|
59 |
+
return $dimensions;
|
60 |
+
}
|
61 |
+
|
62 |
+
public function getItemDetails($item)
|
63 |
+
{
|
64 |
+
$product = $item->getProduct();
|
65 |
+
|
66 |
+
//get options on the items
|
67 |
+
$options = $product->getTypeInstance(true)->getOrderOptions($product);
|
68 |
+
$optionList = "";
|
69 |
+
if ($options && isset($options["options"])) {
|
70 |
+
$optionList = "|";
|
71 |
+
foreach ($options["options"] as $option) { //todo: add loops for $options[additional_options] and $options[attributes_info] to get all possible options
|
72 |
+
$optionList = $optionList . $option["label"] . ':"' . $option["value"] . '"|';
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
return array(
|
77 |
+
'productId' => $product->getId(),
|
78 |
+
'sku' => $product->getSku(),
|
79 |
+
'description' => $product->getName(),
|
80 |
+
'unitPrice' => $item->getPrice(),
|
81 |
+
'quantity' => $item->getQty(),
|
82 |
+
'itemURL' => $product->getProductUrl(),
|
83 |
+
'imageURL' => str_replace("http:", "https:", Mage::helper('catalog/image')->init($product, 'thumbnail')),
|
84 |
+
'itemDescriptionLong' => $optionList,
|
85 |
+
) + $this->getDimensions($product, $item);
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
/**
|
90 |
* Check enabled.
|
91 |
*
|
app/code/community/Iglobal/Stores/Model/International/International.php
CHANGED
@@ -9,39 +9,24 @@ class Iglobal_Stores_Model_International_International extends Mage_Core_Model_A
|
|
9 |
//get all the items in the cart
|
10 |
$cart = Mage::getModel('checkout/cart')->getQuote();
|
11 |
$items = array();
|
12 |
-
|
13 |
-
foreach ($cart->getAllVisibleItems() as $
|
14 |
-
$
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
{
|
21 |
-
$weight = $item->getWeight();
|
22 |
-
}
|
23 |
-
|
24 |
$items[] = array(
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
"unitPrice" => $item->getPrice(),
|
29 |
-
"quantity" => $item->getQty(),
|
30 |
-
"length" => ceil(floatval($product->getIgLength()) / $dim2inch[$dimUnits]),
|
31 |
-
"width" => ceil(floatval($product->getIgWidth()) / $dim2inch[$dimUnits]),
|
32 |
-
"height" => ceil(floatval($product->getIgHeight()) / $dim2inch[$dimUnits]),
|
33 |
-
"weight" => $weight,
|
34 |
-
"weightUnits" => strtoupper($product->getIgWeightUnits()),
|
35 |
-
"itemURL" => $product->getProductUrl(),
|
36 |
-
"imageURL" => str_replace("http:", "https:", Mage::helper('catalog/image')->init($product, 'thumbnail')),
|
37 |
-
"itemDescriptionLong" => $product->getDescription(),
|
38 |
-
|
39 |
);
|
40 |
}
|
41 |
-
|
42 |
$rest = Mage::getModel('stores/rest');
|
43 |
$response = $rest->createTempCart(array(
|
44 |
-
"storeId" =>Mage::getStoreConfig('iglobal_integration/apireqs/iglobalid'),
|
|
|
45 |
"items" => $items,));
|
46 |
return $response->tempCartUUID;
|
47 |
}
|
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 |
"items" => $items,));
|
31 |
return $response->tempCartUUID;
|
32 |
}
|
app/code/community/Iglobal/Stores/Model/Observer.php
CHANGED
@@ -20,47 +20,25 @@ class Iglobal_Stores_Model_Observer
|
|
20 |
//$observer contains the object returns in the event.
|
21 |
$event = $observer->getEvent();
|
22 |
$order = $event->getOrder();
|
23 |
-
$
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
$parentId = $array['relation_parent_id'];
|
31 |
-
}
|
32 |
-
|
33 |
-
if (isset($parentId)) {
|
34 |
-
|
35 |
-
$parentOrder = Mage::getModel('sales/order')->load($parentId);
|
36 |
-
$parentData = $parentOrder->getData();
|
37 |
-
|
38 |
-
if($parentData['ig_order_number']){
|
39 |
-
|
40 |
-
$igcOrderId = $parentData['ig_order_number'];
|
41 |
-
|
42 |
-
if ($parentData['iglobal_test_order'] == '1') {
|
43 |
-
//Set the international_order flag and the ig_order_number on the order and mark as a test order
|
44 |
-
$query = "UPDATE `" . $tableName . "` SET `international_order` = 1, `ig_order_number` = '{$igcOrderId}', `iglobal_test_order` = 1 WHERE `entity_id` = '{$array['entity_id']}'";
|
45 |
-
} else {
|
46 |
-
//Set the international_order flag and the ig_order_number on the order
|
47 |
-
$query = "UPDATE `" . $tableName . "` SET `international_order` = 1, `ig_order_number` = '{$igcOrderId}' WHERE `entity_id` = '{$array['entity_id']}'";
|
48 |
-
}
|
49 |
-
|
50 |
-
Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
|
51 |
-
|
52 |
}
|
53 |
}
|
54 |
return $this;
|
55 |
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
public function prepareLayoutBefore(Varien_Event_Observer $observer)
|
65 |
{
|
66 |
if (!Mage::helper('stores')->isEnabled()) {
|
@@ -79,72 +57,45 @@ class Iglobal_Stores_Model_Observer
|
|
79 |
return $this;
|
80 |
}
|
81 |
|
82 |
-
public function
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
//get array with all orders in past
|
89 |
-
$
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$newId = $order['id'];
|
100 |
-
array_push($restOrders, $newId);
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
//build array of orders currently in magento
|
105 |
-
$reader = Mage::getSingleton('core/resource')->getConnection('core_read'); // get our connection to the DB
|
106 |
-
$importedIgOrdersQuery = "Select `ig_order_number` from `sales_flat_order` where `international_order` = 1 AND `ig_order_number` IS NOT NULL"; //select rows that are ig orders
|
107 |
-
$importedIgOrders = $reader->fetchAll($importedIgOrdersQuery); //fetch them all
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
if (count($missedOrders) == 1) {
|
122 |
-
$body = '<div style=" border-top: 5px solid #88d600; border-bottom: 5px solid #88d600;"><div style="background-color: #ebebea; position: relative; height: 80px; border-bottom: 2px solid #414c50; padding: 15px;"><a style="float: left;" href="https://account.iglobalstores.com"><img src="https://checkout.iglobalstores.com/images/iglobal-exports.png" alt="iGlobal Stores Logo" /></a><h2 style="font-family: arial,sans-serif; color: #414c50; padding-left: 20px; text-align: left;float: left;font-size: 28px;">You\'ve Got An Order!</h2></div><div style="clear: both; padding: 20px; font-family: arial,sans-serif; color: #414c50;"><p>It looks like you\'ve received an international order but it weren\'t successfully imported into your system. The following iGlobal Stores order failed to import:</p><ul style="color: black;"> <li>' . join('</li><li>', $missedOrders) . '</li></ul><p>We recommend that you review the orders and enter them manually. These orders have already been paid for. You can always <a href="http://www.iglobalstores.com/contact-us.html">contact us</a> with any questions. Thanks!</p><p>Sincerely,<br />The iGlobal Stores team</p></div></div>';
|
123 |
-
} else {
|
124 |
-
$body = '<div style=" border-top: 5px solid #88d600; border-bottom: 5px solid #88d600;"><div style="background-color: #ebebea; position: relative; height: 80px; border-bottom: 2px solid #414c50; padding: 15px;"><a style="float: left;" href="https://account.iglobalstores.com"><img src="https://checkout.iglobalstores.com/images/iglobal-exports.png" alt="iGlobal Stores Logo" /></a><h2 style="font-family: arial,sans-serif; color: #414c50; padding-left: 20px; text-align: left;float: left;font-size: 28px;">You\'ve Got Orders!</h2></div><div style="clear: both; padding: 20px; font-family: arial,sans-serif; color: #414c50;"><p>It looks like you\'ve received some international orders but they weren\'t successfully imported into your system. The following iGlobal Stores orders failed to import:</p><ul style="color: black;"> <li>' . join('</li><li>', $missedOrders) . '</li></ul><p>We recommend that you review the orders and enter them manually. These orders have already been paid for. You can always <a href="http://www.iglobalstores.com/contact-us.html">contact us</a> with any questions. Thanks!</p><p>Sincerely,<br />The iGlobal Stores team</p></div></div>';
|
125 |
-
}
|
126 |
-
$mail = Mage::getModel('core/email');
|
127 |
-
$mail->setToName('iGlobal Customer');
|
128 |
-
if (Mage::getStoreConfig('iglobal_integration/apireqs/admin_email')) {
|
129 |
-
$mail->setBcc('monitoring@iglobalstores.com');
|
130 |
-
$mail->setCc('magentomonitoring@iglobalstores.com');
|
131 |
-
$mail->setToEmail(Mage::getStoreConfig('iglobal_integration/apireqs/admin_email'));
|
132 |
-
} else {
|
133 |
-
$mail->setToEmail('monitoring@iglobalstores.com');
|
134 |
-
}
|
135 |
-
$mail->setBody($body);
|
136 |
-
$mail->setSubject('International orders that need your help being processed: Your Attention Required');
|
137 |
-
$mail->setFromEmail('support@iglobalstores.com');
|
138 |
-
$mail->setFromName("iGlobal Import Error");
|
139 |
-
$mail->setType('html');
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
$mail->send();
|
144 |
-
Mage::log("Email notification of needed order reconciliation successfully sent. Effected orders are: " . join("," ,$missedOrders), null, 'iglobal.log');
|
145 |
-
} catch (Exception $e) {
|
146 |
-
Mage::log("EMAIL SEND FAILURE - Merchant was not notified of needed order reconciliation! Missed order numbers are: " . join("," ,$missedOrders), Zend_Log::ERR, 'iglobal.log', true);
|
147 |
-
}
|
148 |
-
}
|
149 |
}
|
150 |
}
|
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()) {
|
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[] = array($order->getIgOrderNumber =>$order);
|
71 |
+
}
|
72 |
+
|
73 |
//get array with all orders in past
|
74 |
+
$data = Mage::getModel('stores/rest')->getAllOrdersSinceDate('20140526');
|
75 |
+
foreach ($data->orders as $igOrder)
|
76 |
+
{
|
77 |
+
if ($igOrder->testOrder)
|
78 |
+
{
|
79 |
+
continue;
|
80 |
+
}
|
81 |
+
if(array_key_exists($igOrder->id, $magentoOrders)) {
|
82 |
+
// check status
|
83 |
+
Mage::getModel('stores/order')->checkStatus($magentoOrders[$igOrder->id]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
+
} else {
|
86 |
+
try {
|
87 |
+
// re-import the order
|
88 |
+
Mage::getModel('stores/order')->processOrder($igOrder->id);
|
89 |
+
}
|
90 |
+
catch(Exception $e)
|
91 |
+
{
|
92 |
+
mail('monitoring@iglobalstores.com, magentomissedorders@iglobalstores.com',
|
93 |
+
'Magento Integration Error - International order failed to import',
|
94 |
+
'International order# '. $igOrder->id .'.'. ' Exception Message: '.$e->getMessage());
|
95 |
+
Mage::log("International order #{$igOrder->id} failed to import!" .$e, Zend_Log::ERR, 'iglobal.log', true);
|
96 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
+
}
|
99 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
}
|
app/code/community/Iglobal/Stores/Model/Order.php
CHANGED
@@ -2,22 +2,70 @@
|
|
2 |
|
3 |
class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
protected $quote = null;
|
6 |
protected $iglobal_order_id = null;
|
7 |
protected $iglobal_order = null;
|
8 |
protected $rest = null;
|
|
|
9 |
public function setQuote($quote)
|
10 |
{
|
11 |
$this->quote = $quote;
|
12 |
}
|
13 |
|
14 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
{
|
16 |
$this->iglobal_order_id = $orderid;
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
Mage::register('duty_tax', $this->iglobal_order->dutyTaxesTotal);
|
20 |
$shippingAddress = $this->setContactInfo();
|
|
|
21 |
$shippingAddress = $this->setShipping($shippingAddress);
|
22 |
$this->setPayment($shippingAddress);
|
23 |
return $this->createOrder();
|
@@ -124,7 +172,34 @@ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
|
|
124 |
|
125 |
protected function setItems()
|
126 |
{
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
protected function setShipping($shippingAddress)
|
@@ -184,7 +259,7 @@ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
|
|
184 |
protected function setPayment($address)
|
185 |
{
|
186 |
$address->setPaymentMethod('iGlobalCreditCard');
|
187 |
-
|
188 |
//updates payment type in Magento Admin area
|
189 |
$paymentMethod = $this->iglobal_order->paymentProcessing->paymentGateway;
|
190 |
if($paymentMethod === 'iGlobal_CC'){
|
@@ -227,7 +302,11 @@ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
|
|
227 |
try {
|
228 |
$order = Mage::getModel("sales/order")->load($id);
|
229 |
//add trans ID
|
230 |
-
|
|
|
|
|
|
|
|
|
231 |
$transaction = Mage::getModel('sales/order_payment_transaction');
|
232 |
$transaction->setOrderPaymentObject($order->getPayment());
|
233 |
$transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
@@ -255,25 +334,22 @@ class Iglobal_Stores_Model_Order extends Mage_Core_Model_Abstract
|
|
255 |
$transactionSave->save();
|
256 |
}
|
257 |
}
|
|
|
258 |
} catch (Exception $e) {
|
259 |
$order->addStatusHistoryComment('iGlobal Invoicer: Exception occurred during automatically invoicing. Exception message: '.$e->getMessage(), false);
|
260 |
$order->save();
|
261 |
}
|
262 |
-
$tableName = Mage::getSingleton("core/resource")->getTableName("sales_flat_order");
|
263 |
if ($this->iglobal_order->testOrder) {
|
264 |
-
|
265 |
-
$query = "UPDATE `" . $tableName . "` SET `international_order` = 1, `ig_order_number` = '{$this->iglobal_order_id}', `iglobal_test_order` = 1 WHERE `entity_id` = '{$id}'";
|
266 |
-
Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
|
267 |
-
} else {
|
268 |
-
//Set the international_order flag and the ig_order_number on the order
|
269 |
-
$query = "UPDATE `" . $tableName . "` SET `international_order` = 1, `ig_order_number` = '{$this->iglobal_order_id}' WHERE `entity_id` = '{$id}'";
|
270 |
-
Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
|
271 |
}
|
|
|
|
|
|
|
272 |
|
273 |
//Send the magento id to iGlobal
|
274 |
-
$this->rest->sendMagentoOrderId($this->iglobal_order_id, $
|
275 |
return $order;
|
276 |
}
|
277 |
|
278 |
-
|
279 |
-
}
|
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 |
+
|
52 |
+
// check the if this is the same quote that was sent.
|
53 |
+
if ($quote)
|
54 |
+
{
|
55 |
+
$this->quote = $quote;
|
56 |
+
} elseif (!$this->quote) {
|
57 |
+
$this->quote = Mage::getSingleton('checkout/session')->getQuote();
|
58 |
+
}
|
59 |
+
|
60 |
+
if ($this->iglobal_order->referenceId && $this->iglobal_order->referenceId != $this->quote->getId())
|
61 |
+
{
|
62 |
+
$this->quote->load($this->iglobal_order->referenceId);
|
63 |
+
}
|
64 |
+
|
65 |
+
// Set the duty_tax for the address total collection to use
|
66 |
Mage::register('duty_tax', $this->iglobal_order->dutyTaxesTotal);
|
67 |
$shippingAddress = $this->setContactInfo();
|
68 |
+
$this->setItems();
|
69 |
$shippingAddress = $this->setShipping($shippingAddress);
|
70 |
$this->setPayment($shippingAddress);
|
71 |
return $this->createOrder();
|
172 |
|
173 |
protected function setItems()
|
174 |
{
|
175 |
+
$quote_items = array();
|
176 |
+
$ig_items = array();
|
177 |
+
foreach($this->quote->getAllVisibleItems() as $item) {
|
178 |
+
$quote_items[$item->getProductId()] = $item;
|
179 |
+
}
|
180 |
+
foreach ($this->iglobal_order->items as $item) {
|
181 |
+
if ($item->productId) { // discounts do not have a productId set
|
182 |
+
$ig_items[$item->productId] = $item;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
$missing = array_diff_key($ig_items, $quote_items);
|
187 |
+
$extra = array_diff_key($quote_items, $ig_items);
|
188 |
+
foreach ($missing as $pid => $item)
|
189 |
+
{
|
190 |
+
// Add the product to the quote
|
191 |
+
$product = Mage::getModel("catalog/product")->load($pid);
|
192 |
+
if ($product->getId())
|
193 |
+
{
|
194 |
+
$this->quote->addProduct($product, new Varien_Object(array('qty'=> $item->quantity)));
|
195 |
+
} else {
|
196 |
+
Mage::log("Missing sku `{$item->sku}' for {$this->iglobal_order_id}", null, 'iglobal.log', true);
|
197 |
+
}
|
198 |
+
}
|
199 |
+
foreach($extra as $item)
|
200 |
+
{
|
201 |
+
$this->quote->removeItem($item->getId());
|
202 |
+
}
|
203 |
}
|
204 |
|
205 |
protected function setShipping($shippingAddress)
|
259 |
protected function setPayment($address)
|
260 |
{
|
261 |
$address->setPaymentMethod('iGlobalCreditCard');
|
262 |
+
|
263 |
//updates payment type in Magento Admin area
|
264 |
$paymentMethod = $this->iglobal_order->paymentProcessing->paymentGateway;
|
265 |
if($paymentMethod === 'iGlobal_CC'){
|
302 |
try {
|
303 |
$order = Mage::getModel("sales/order")->load($id);
|
304 |
//add trans ID
|
305 |
+
try {
|
306 |
+
$transaction_id = $this->iglobal_order->paymentProcessing->transactionId;
|
307 |
+
} catch (Exception $e){
|
308 |
+
$transaction_id = '34234234234';
|
309 |
+
}
|
310 |
$transaction = Mage::getModel('sales/order_payment_transaction');
|
311 |
$transaction->setOrderPaymentObject($order->getPayment());
|
312 |
$transaction->setTxnType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH);
|
334 |
$transactionSave->save();
|
335 |
}
|
336 |
}
|
337 |
+
$this->checkStatus($order);
|
338 |
} catch (Exception $e) {
|
339 |
$order->addStatusHistoryComment('iGlobal Invoicer: Exception occurred during automatically invoicing. Exception message: '.$e->getMessage(), false);
|
340 |
$order->save();
|
341 |
}
|
|
|
342 |
if ($this->iglobal_order->testOrder) {
|
343 |
+
$order->setIglobalTestOrder(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
}
|
345 |
+
$order->setIgOrderNumber($this->iglobal_order_id);
|
346 |
+
$order->setInternationalOrder(1);
|
347 |
+
$order->save();
|
348 |
|
349 |
//Send the magento id to iGlobal
|
350 |
+
$this->rest->sendMagentoOrderId($this->iglobal_order_id, $order->getIncrementId());
|
351 |
return $order;
|
352 |
}
|
353 |
|
354 |
+
|
355 |
+
}
|
app/code/community/Iglobal/Stores/Model/Sales/Quote/Address/Total/Fee.php
CHANGED
@@ -1,17 +1,34 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
public function collect(Mage_Sales_Model_Quote_Address $address)
|
5 |
{
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
}
|
16 |
}
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
if (version_compare(Mage::getVersion(), '1.8', '>=')) {
|
3 |
+
class Iglobal_Stores_Model_Sales_Quote_Address_Total_Fee extends Mage_Sales_Model_Quote_Address_Total_Tax
|
|
|
4 |
{
|
5 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
6 |
+
{
|
7 |
+
$fee = Mage::registry('duty_tax');
|
8 |
+
if ($fee) {
|
9 |
+
// Do not override taxes if there is no duty_tax set.
|
10 |
+
$this->_setAddress($address);
|
11 |
+
$this->_setAmount($fee);
|
12 |
+
$this->_setBaseAmount($fee);
|
13 |
+
} else {
|
14 |
+
parent::collect($address);
|
15 |
+
}
|
16 |
}
|
17 |
}
|
18 |
+
}else {
|
19 |
+
class Iglobal_Stores_Model_Sales_Quote_Address_Total_Fee extends Mage_Tax_Model_Sales_Total_Quote_Tax
|
20 |
+
{
|
21 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
22 |
+
{
|
23 |
+
$fee = Mage::registry('duty_tax');
|
24 |
+
if ($fee) {
|
25 |
+
// Do not override taxes if there is no duty_tax set.
|
26 |
+
$this->_setAddress($address);
|
27 |
+
$this->_setAmount($fee);
|
28 |
+
$this->_setBaseAmount($fee);
|
29 |
+
} else {
|
30 |
+
return parent::collect($address);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Iglobal/Stores/controllers/SuccessController.php
CHANGED
@@ -10,19 +10,15 @@ class Iglobal_Stores_SuccessController extends Mage_Core_Controller_Front_Action
|
|
10 |
try
|
11 |
{
|
12 |
$quote = Mage::getSingleton('checkout/session')->getQuote()->setStoreId(Mage::app()->getStore()->getId());
|
13 |
-
$
|
14 |
-
$tableName = Mage::getSingleton("core/resource")->getTableName($table);
|
15 |
-
$existsQuery = "SELECT `entity_id` FROM `" . $tableName. "` WHERE `ig_order_number` = '{$_order}'";
|
16 |
-
$orderExists = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($existsQuery);
|
17 |
|
18 |
-
if(!$_order || $
|
19 |
header('Location: /');
|
20 |
die();
|
21 |
}
|
22 |
|
23 |
$order = Mage::getModel('stores/order');
|
24 |
-
$order->
|
25 |
-
$order->processOrder($_order);
|
26 |
}
|
27 |
catch(Exception $e)
|
28 |
{
|
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 || $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 |
{
|
app/code/community/Iglobal/Stores/etc/config.xml
CHANGED
@@ -186,7 +186,8 @@
|
|
186 |
<totals>
|
187 |
<tax>
|
188 |
<class>stores/sales_quote_address_total_fee</class>
|
189 |
-
<
|
|
|
190 |
</tax>
|
191 |
</totals>
|
192 |
</quote>
|
@@ -355,12 +356,12 @@
|
|
355 |
</controller_action_predispatch>
|
356 |
</events> -->
|
357 |
</adminhtml>
|
358 |
-
|
359 |
<jobs>
|
360 |
<iglobal_order_update>
|
361 |
<schedule><cron_expr>* * */2 * *</cron_expr></schedule>
|
362 |
<run><model>stores/observer::orderRec</model></run>
|
363 |
</iglobal_order_update>
|
364 |
</jobs>
|
365 |
-
</crontab>
|
366 |
</config>
|
186 |
<totals>
|
187 |
<tax>
|
188 |
<class>stores/sales_quote_address_total_fee</class>
|
189 |
+
<after>subtotal,shipping</after>
|
190 |
+
<before>grand_total</before>
|
191 |
</tax>
|
192 |
</totals>
|
193 |
</quote>
|
356 |
</controller_action_predispatch>
|
357 |
</events> -->
|
358 |
</adminhtml>
|
359 |
+
<crontab>
|
360 |
<jobs>
|
361 |
<iglobal_order_update>
|
362 |
<schedule><cron_expr>* * */2 * *</cron_expr></schedule>
|
363 |
<run><model>stores/observer::orderRec</model></run>
|
364 |
</iglobal_order_update>
|
365 |
</jobs>
|
366 |
+
</crontab>
|
367 |
</config>
|
app/design/frontend/base/default/template/iglobal/stores/cart.phtml
CHANGED
@@ -1,273 +1,50 @@
|
|
1 |
<?php
|
2 |
|
3 |
|
|
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
$cart = Mage::getModel('checkout/cart')->getQuote();
|
15 |
-
|
16 |
-
|
17 |
-
foreach ($cart->getAllVisibleItems() as $item) {
|
18 |
-
|
19 |
-
echo '<div class="igItemDetails '.$item->getName().'">';
|
20 |
-
$product = $item->getProduct();
|
21 |
-
|
22 |
-
/* figure this item type problem out, okay?
|
23 |
-
|
24 |
$options = $item->getOptionByCode('simple_product')->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
|
25 |
if ($options){
|
26 |
-
|
27 |
-
|
28 |
if(isset($options['options'])){
|
29 |
-
|
30 |
echo '<span class="igItemOptions"><dl class="igOptionsList">';
|
31 |
-
|
32 |
$optionArray = $options['options'];
|
33 |
foreach ($optionArray as $optionDetails) {
|
34 |
echo '<dt>' . $optionDetails['label'] . '</dt>';
|
35 |
echo '<dd>' . $optionDetails['value'] . '</dd>';
|
36 |
}
|
37 |
-
|
38 |
echo '</dl></span>';
|
39 |
}
|
40 |
-
|
41 |
} */
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
//starts here
|
70 |
-
|
71 |
-
$sku = $product->getTypeId() == 'bundle' ? substr($item->getSku(), strpos($item->getSku(), '-')+1) : $item->getSku();
|
72 |
-
|
73 |
-
$id = $item->getProductId();
|
74 |
-
|
75 |
-
$price = $item->getPrice();
|
76 |
-
|
77 |
-
// This is because Magento fails to load the custom attributes on this php template, hence we have to go back to the DB.
|
78 |
-
|
79 |
-
$weight = "";
|
80 |
-
|
81 |
-
$length = "";
|
82 |
-
|
83 |
-
$width = "";
|
84 |
-
|
85 |
-
$height = "";
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
try {
|
90 |
-
|
91 |
-
$weightUnits = "";
|
92 |
-
|
93 |
-
$dimUnits = "";
|
94 |
-
|
95 |
-
try {
|
96 |
-
|
97 |
-
$weightUnits = "";
|
98 |
-
|
99 |
-
if (!empty($product['ig_weight_units'])) {
|
100 |
-
|
101 |
-
$weightUnits = $product->getAttributeText('ig_weight_units');
|
102 |
-
|
103 |
-
}
|
104 |
-
|
105 |
-
} catch (Exception $e) {
|
106 |
-
|
107 |
-
$weightUnits = "";
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
try {
|
112 |
-
|
113 |
-
$weight = "";
|
114 |
-
|
115 |
-
if (!empty($product['ig_weight'])) {
|
116 |
-
|
117 |
-
$weight = $product->getData('ig_weight');
|
118 |
-
|
119 |
-
} else if (!empty($product['weight'])) {
|
120 |
-
|
121 |
-
$weight = $item->getWeight();
|
122 |
-
|
123 |
-
}
|
124 |
-
|
125 |
-
if (!empty($weight)) {
|
126 |
-
|
127 |
-
if ($weightUnits=="kg") {
|
128 |
-
|
129 |
-
$weight = round(floatval($weight) / 0.453592, 2);
|
130 |
-
|
131 |
-
} else if ($weightUnits=="oz") {
|
132 |
-
|
133 |
-
$weight = round(floatval($weight) / 16, 2);
|
134 |
-
|
135 |
-
} else if ($weightUnits=="g") {
|
136 |
-
|
137 |
-
$weight = round(floatval($weight) / 453.592, 2);
|
138 |
-
|
139 |
-
} else {//Default is lbs
|
140 |
-
|
141 |
-
$weight = round(floatval($weight), 2);
|
142 |
-
|
143 |
-
}
|
144 |
-
|
145 |
-
} else {
|
146 |
-
|
147 |
-
$weight = "";
|
148 |
-
|
149 |
-
}
|
150 |
-
|
151 |
-
} catch(Exception $e) {
|
152 |
-
|
153 |
-
$weight = "";
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
try {
|
158 |
-
|
159 |
-
$dimUnits = "";
|
160 |
-
|
161 |
-
if (!empty($product['ig_dimension_units'])) {
|
162 |
-
|
163 |
-
$dimUnits = $product->getAttributeText('ig_dimension_units');
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
} catch (Exception $e) {
|
168 |
-
|
169 |
-
$dimUnits = "";
|
170 |
-
|
171 |
-
}
|
172 |
-
|
173 |
-
try {
|
174 |
-
|
175 |
-
$length = "";
|
176 |
-
|
177 |
-
if (!empty($product['ig_length'])) {
|
178 |
-
|
179 |
-
$length = $product->getData('ig_length');
|
180 |
-
|
181 |
-
}
|
182 |
-
|
183 |
-
$width = "";
|
184 |
-
|
185 |
-
if (!empty($product['ig_width'])) {
|
186 |
-
|
187 |
-
$width = $product->getData('ig_width');
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
$height = "";
|
192 |
-
|
193 |
-
if (!empty($product['ig_height'])) {
|
194 |
-
|
195 |
-
$height = $product->getData('ig_height');
|
196 |
-
|
197 |
-
}
|
198 |
-
|
199 |
-
if (!empty($length) && !empty($width) && !empty($height)) {
|
200 |
-
|
201 |
-
if ($dimUnits=="cm") {
|
202 |
-
|
203 |
-
$length = ceil(floatval($length) / 2.54);
|
204 |
-
|
205 |
-
$width = ceil(floatval($width) / 2.54);
|
206 |
-
|
207 |
-
$height = ceil(floatval($height) / 2.54);
|
208 |
-
|
209 |
-
} else {//Default is inches
|
210 |
-
|
211 |
-
$length = ceil(floatval($length));
|
212 |
-
|
213 |
-
$width = ceil(floatval($width));
|
214 |
-
|
215 |
-
$height = ceil(floatval($height));
|
216 |
-
|
217 |
-
}
|
218 |
-
|
219 |
-
} else {
|
220 |
-
|
221 |
-
$length = "";
|
222 |
-
|
223 |
-
$width = "";
|
224 |
-
|
225 |
-
$height = "";
|
226 |
-
|
227 |
-
}
|
228 |
-
|
229 |
-
} catch(Exception $e) {
|
230 |
-
|
231 |
-
$length = "";
|
232 |
-
|
233 |
-
$width = "";
|
234 |
-
|
235 |
-
$height = "";
|
236 |
-
|
237 |
-
}
|
238 |
-
|
239 |
-
} catch (Exception $outerE) {
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
}
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
// echo "<div class='ig_itemAttributes' style='display:none;'>";
|
248 |
-
|
249 |
-
echo "<span class='ig_itemProductId'>".$id."</span>";
|
250 |
-
|
251 |
-
echo "<span class='ig_itemSku'>".$sku."</span>";
|
252 |
-
|
253 |
-
echo "<span class='ig_itemPrice'>".$price."</span>";
|
254 |
-
|
255 |
-
echo "<span class='ig_itemWeight'>".$weight."</span>";
|
256 |
-
|
257 |
-
echo "<span class='ig_itemLength'>".$length."</span>";
|
258 |
-
|
259 |
-
echo "<span class='ig_itemWidth'>".$width."</span>";
|
260 |
-
|
261 |
-
echo "<span class='ig_itemHeight'>".$height."</span>";
|
262 |
-
|
263 |
-
//echo "</div>";
|
264 |
-
|
265 |
-
//ends here
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
echo '</div><!-- end igItemDetails-->';
|
270 |
-
|
271 |
-
}
|
272 |
-
|
273 |
-
echo '</div><!--end igItemAttr-->';
|
1 |
<?php
|
2 |
|
3 |
|
4 |
+
echo '<div class="igItemAttr" style="display: none;">';
|
5 |
|
6 |
+
$cart = Mage::getModel('checkout/cart')->getQuote();
|
7 |
+
$helper = Mage::helper('stores');
|
8 |
+
foreach ($cart->getAllVisibleItems() as $item) {
|
9 |
+
echo '<div class="igItemDetails '.$item->getName().'">';
|
10 |
+
$details = $helper->getItemDetails($item);
|
11 |
|
12 |
+
/* figure this item type problem out, okay?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
$options = $item->getOptionByCode('simple_product')->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct());
|
14 |
if ($options){
|
|
|
|
|
15 |
if(isset($options['options'])){
|
|
|
16 |
echo '<span class="igItemOptions"><dl class="igOptionsList">';
|
|
|
17 |
$optionArray = $options['options'];
|
18 |
foreach ($optionArray as $optionDetails) {
|
19 |
echo '<dt>' . $optionDetails['label'] . '</dt>';
|
20 |
echo '<dd>' . $optionDetails['value'] . '</dd>';
|
21 |
}
|
|
|
22 |
echo '</dl></span>';
|
23 |
}
|
|
|
24 |
} */
|
25 |
|
26 |
+
echo '<span class="igID">'.$details['productId'].'</span>';
|
27 |
+
echo '<span class="igName">'.$details['description'].'</span>';
|
28 |
+
echo '<span class="igSku">'.$details['sku'].'</span>';
|
29 |
+
echo '<span class="igQty">'.$details['quantity'].'</span>';
|
30 |
+
echo '<span class="igPrice">'.$details['unitPrice'].'</span>';
|
31 |
+
echo '<span class="igUrl">'.$details['itemURL'].'</span>';
|
32 |
+
echo '<span class="igImage">'. $details['imageURL'].'</span>';
|
33 |
+
echo '<span class="igDescription">'.$details['itemDescriptionLong'].'</span>';
|
34 |
+
echo '<span class="igShortDescription">'.$item->getProduct()->getShortDescription().'</span>';
|
35 |
+
echo '<span class="MageWeight">'.$details['weight'].'</span>';
|
36 |
+
|
37 |
+
// echo "<div class='ig_itemAttributes' style='display:none;'>";
|
38 |
+
echo "<span class='ig_itemProductId'>".$details['productId']."</span>";
|
39 |
+
echo "<span class='ig_itemSku'>".$details['sku']."</span>";
|
40 |
+
echo "<span class='ig_itemPrice'>".$details['unitPrice']."</span>";
|
41 |
+
echo "<span class='ig_itemWeight'>".$details['weight']."</span>";
|
42 |
+
echo "<span class='ig_itemLength'>".$details['length']."</span>";
|
43 |
+
echo "<span class='ig_itemWidth'>".$details['width']."</span>";
|
44 |
+
echo "<span class='ig_itemHeight'>".$details['height']."</span>";
|
45 |
+
//echo "</div>";
|
46 |
+
|
47 |
+
echo '</div><!-- end igItemDetails-->';
|
48 |
+
}
|
49 |
+
|
50 |
+
echo '</div><!--end igItemAttr-->';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Iglobal_Main</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
@@ -30,17 +30,17 @@ Your Payment Processor or Ours - Use your own payment processor or leverage the
|
|
30 |
Before You Install
|
31 |
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>
|
32 |
<notes>New Features:
|
33 |
-
|
34 |
-
|
|
|
35 |

|
36 |
Improvements:
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
<
|
41 |
-
<
|
42 |
-
<
|
43 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Iglobal_Stores.xml" hash="56839ad045b6a99f97564de63ebed700"/><file name="Iglobal_Ship.xml" hash="6d40f1c84e29bb7d8b70eadd77a03917"/></dir></target><target name="magecommunity"><dir name="Iglobal"><dir name="Ship"><dir name="Block"><file name="Ship.php" hash="a802b4d42e72997ec4ab466dec75b743"/></dir><dir name="Helper"><file name="Data.php" hash="fe9f074c1cb74260fa134efa94eb67c9"/></dir><dir name="Model"><dir name="Carrier"><file name="Excellence.php" hash="d1814260e342346b74d7ff3543499d4f"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="3355a75caf30f4ff96499da3d8a4102a"/></dir><dir name="etc"><file name="config.xml" hash="adecbc76332ffb4b0f8918d3166c655c"/><file name="system.xml" hash="fea6b2ed9b7fdf5748cb57e53fe1301b"/></dir></dir><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="e3fa83ebece58a1c869ac8aa001536ec"/></dir><dir name="Helper"><file name="Configoptions.php" hash="b129e55b21f845a20d6e7fdb3b532be3"/><file name="Data.php" hash="3cb8b1a1c1fe86e703c6ffd6763c66a0"/><file name="Url.php" hash="89bd9bbc4628dd545c72f19db69a7dd8"/></dir><dir name="Model"><file name="Configoptions.php" hash="56a5c17a3e71079ecf574fd4a0e69011"/><dir name="International"><file name="International.php" hash="434d2dd1052de9023db149e05673cb8b"/></dir><file name="Observer.php" hash="c55e17df0bb21fcc916bac2874e52fec"/><file name="Order.php" hash="0bbd2db7ec80fdec8260864538f74f46"/><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="0b3fd2a4bffc0a4a5e8aca28ad3fce5f"/><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Fee.php" hash="433e135f082364766ca14e0f8694e741"/></dir></dir></dir></dir><dir name="Service"><file name="Quote.php" hash="bae0e5a710b9e3aa1427bb78a08fbfd8"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="3169062e850efd55749ae8033676bf2d"/><file name="CheckoutController.php" hash="f4b9b2cf1441b3efa30473cc602b4a77"/><file name="SuccessController.php" hash="4e5dbc1bf261cd9e536fb8cc6f4d4b87"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7f10c9724b1294a506df47cf569bc9e6"/><file name="config.xml" hash="4f52d0e71c5566132d6f762d522d3918"/><file name="system.xml" hash="41142f308c4189f5b8cc17ab1730823b"/></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="d2188a71fb45d4a5fba006b8748cf7b7"/><file name="igcincludes.phtml" hash="43f0bf839553fce75626ee5fa822260d"/></dir></dir></dir></dir></dir></dir></target></contents>
|
44 |
<compatible/>
|
45 |
-
<dependencies><required><php><min>5.
|
46 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Iglobal_Main</name>
|
4 |
+
<version>1.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
30 |
Before You Install
|
31 |
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>
|
32 |
<notes>New Features:
|
33 |
+
Send applied discounts to checkout
|
34 |
+
Include product options in the description
|
35 |
+
Update order status from iglobal
|
36 |

|
37 |
Improvements:
|
38 |
+
the order number is passed back as a reference to iglobal
|
39 |
+
</notes>
|
40 |
+
<authors><author><name>Matt Flamm</name><user>mattflamm</user><email>matt@iglobalstores.com</email></author><author><name>Brian Olsen</name><user>brianolsen</user><email>brian@iglobalstores.com</email></author></authors>
|
41 |
+
<date>2015-10-02</date>
|
42 |
+
<time>19:41:46</time>
|
43 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Iglobal_Stores.xml" hash="56839ad045b6a99f97564de63ebed700"/><file name="Iglobal_Ship.xml" hash="6d40f1c84e29bb7d8b70eadd77a03917"/></dir></target><target name="magecommunity"><dir name="Iglobal"><dir name="Ship"><dir name="Block"><file name="Ship.php" hash="a802b4d42e72997ec4ab466dec75b743"/></dir><dir name="Helper"><file name="Data.php" hash="fe9f074c1cb74260fa134efa94eb67c9"/></dir><dir name="Model"><dir name="Carrier"><file name="Excellence.php" hash="d1814260e342346b74d7ff3543499d4f"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="3355a75caf30f4ff96499da3d8a4102a"/></dir><dir name="etc"><file name="config.xml" hash="adecbc76332ffb4b0f8918d3166c655c"/><file name="system.xml" hash="fea6b2ed9b7fdf5748cb57e53fe1301b"/></dir></dir><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="e3fa83ebece58a1c869ac8aa001536ec"/></dir><dir name="Helper"><file name="Configoptions.php" hash="b129e55b21f845a20d6e7fdb3b532be3"/><file name="Data.php" hash="8ad8a075070c35cebd073456cf2c125c"/><file name="Url.php" hash="89bd9bbc4628dd545c72f19db69a7dd8"/></dir><dir name="Model"><file name="Configoptions.php" hash="56a5c17a3e71079ecf574fd4a0e69011"/><dir name="International"><file name="International.php" hash="6073b26ff3ccb9f58dc8d098b22f1144"/></dir><file name="Observer.php" hash="4b2356a80ff34f2802f3fa69f2900311"/><file name="Order.php" hash="b2b3ae7898d1b51d1d40cd597739fea0"/><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="0b3fd2a4bffc0a4a5e8aca28ad3fce5f"/><dir name="Sales"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Fee.php" hash="c28dc3156230c3ad452ebfeede2de244"/></dir></dir></dir></dir><dir name="Service"><file name="Quote.php" hash="bae0e5a710b9e3aa1427bb78a08fbfd8"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="3169062e850efd55749ae8033676bf2d"/><file name="CheckoutController.php" hash="f4b9b2cf1441b3efa30473cc602b4a77"/><file name="SuccessController.php" hash="ed6df1368ce185de7bf6c557e55d2339"/></dir><dir name="etc"><file name="adminhtml.xml" hash="7f10c9724b1294a506df47cf569bc9e6"/><file name="config.xml" hash="be140e459f959f8604220c0976d91f77"/><file name="system.xml" hash="41142f308c4189f5b8cc17ab1730823b"/></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="43f0bf839553fce75626ee5fa822260d"/></dir></dir></dir></dir></dir></dir></target></contents>
|
|
|
44 |
<compatible/>
|
45 |
+
<dependencies><required><php><min>5.3.0</min><max>7.0.7</max></php></required></dependencies>
|
46 |
</package>
|