Ship2MyID - Version 1.3.0

Version Notes

Ship2MyId Magento Extension Stable Module.

Download this release

Release Info

Developer MapMyId Inc.
Extension Ship2MyID
Version 1.3.0
Comparing to
See all releases


Version 1.3.0

Files changed (78) hide show
  1. app/code/local/Xclm24/Checkout/controllers/OnepageController.php +58 -0
  2. app/code/local/Xclm24/Checkout/etc/config.xml +49 -0
  3. app/code/local/Xclm24/Myidshipping/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php +260 -0
  4. app/code/local/Xclm24/Myidshipping/Block/Adminhtml/System/Config/Fieldset/Hint.php +43 -0
  5. app/code/local/Xclm24/Myidshipping/Block/GiftMessage/Message/Inline.php +69 -0
  6. app/code/local/Xclm24/Myidshipping/Block/Myidpopup.php +36 -0
  7. app/code/local/Xclm24/Myidshipping/Helper/Data.php +953 -0
  8. app/code/local/Xclm24/Myidshipping/LICENSE.txt +48 -0
  9. app/code/local/Xclm24/Myidshipping/Model/Api/Nvp.php +64 -0
  10. app/code/local/Xclm24/Myidshipping/Model/Api/Standard.php +66 -0
  11. app/code/local/Xclm24/Myidshipping/Model/Coupon.php +48 -0
  12. app/code/local/Xclm24/Myidshipping/Model/Cron.php +404 -0
  13. app/code/local/Xclm24/Myidshipping/Model/Mysql4/Coupon.php +35 -0
  14. app/code/local/Xclm24/Myidshipping/Model/Mysql4/Coupon/Collection.php +27 -0
  15. app/code/local/Xclm24/Myidshipping/Model/Mysql4/Ordergrid.php +34 -0
  16. app/code/local/Xclm24/Myidshipping/Model/Mysql4/Ordergrid/Collection.php +27 -0
  17. app/code/local/Xclm24/Myidshipping/Model/Mysql4/Shipping.php +34 -0
  18. app/code/local/Xclm24/Myidshipping/Model/Mysql4/Shipping/Collection.php +27 -0
  19. app/code/local/Xclm24/Myidshipping/Model/Observer.php +503 -0
  20. app/code/local/Xclm24/Myidshipping/Model/Order.php +506 -0
  21. app/code/local/Xclm24/Myidshipping/Model/Order/Creditmemo.php +118 -0
  22. app/code/local/Xclm24/Myidshipping/Model/Order/Invoice.php +239 -0
  23. app/code/local/Xclm24/Myidshipping/Model/Order/Shipment.php +116 -0
  24. app/code/local/Xclm24/Myidshipping/Model/Ordergrid.php +50 -0
  25. app/code/local/Xclm24/Myidshipping/Model/Resource/Coupon.php +47 -0
  26. app/code/local/Xclm24/Myidshipping/Model/Resource/Coupon/Collection.php +31 -0
  27. app/code/local/Xclm24/Myidshipping/Model/Resource/Eav/Mysql4/Setup.php +23 -0
  28. app/code/local/Xclm24/Myidshipping/Model/Resource/Ordergrid.php +47 -0
  29. app/code/local/Xclm24/Myidshipping/Model/Resource/Ordergrid/Collection.php +31 -0
  30. app/code/local/Xclm24/Myidshipping/Model/Resource/Shipping.php +47 -0
  31. app/code/local/Xclm24/Myidshipping/Model/Resource/Shipping/Collection.php +31 -0
  32. app/code/local/Xclm24/Myidshipping/Model/Shipping.php +50 -0
  33. app/code/local/Xclm24/Myidshipping/Model/System/Config/Source/Order/Status/New.php +30 -0
  34. app/code/local/Xclm24/Myidshipping/Model/System/Config/Source/Order/Status/Rejected.php +30 -0
  35. app/code/local/Xclm24/Myidshipping/controllers/CronController.php +242 -0
  36. app/code/local/Xclm24/Myidshipping/controllers/IndexController.php +147 -0
  37. app/code/local/Xclm24/Myidshipping/etc/adminhtml.xml +45 -0
  38. app/code/local/Xclm24/Myidshipping/etc/config.xml +315 -0
  39. app/code/local/Xclm24/Myidshipping/etc/system.xml +377 -0
  40. app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/install-1.0.php +32 -0
  41. app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/upgrade-1.0-1.1.php +36 -0
  42. app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/upgrade-1.1-1.2.php +37 -0
  43. app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/upgrade-1.2-1.3.php +31 -0
  44. app/design/adminhtml/default/default/layout/myidshipping.xml +35 -0
  45. app/design/adminhtml/default/default/template/myidshipping/sales/order/view/info.phtml +210 -0
  46. app/design/adminhtml/default/default/template/myidshipping/system/config/fieldset/hint.phtml +30 -0
  47. app/design/frontend/base/default/layout/myidshipping.xml +111 -0
  48. app/design/frontend/base/default/template/myidshipping/myidpopup.phtml +26 -0
  49. app/design/frontend/base/default/template/myidshipping/myidshipping.phtml +65 -0
  50. app/design/frontend/base/default/template/myidshipping/progress/progress.phtml +244 -0
  51. app/design/frontend/base/default/template/myidshipping/progress/shipping.phtml +57 -0
  52. app/design/frontend/base/default/template/myidshipping/sales/order/info.phtml +125 -0
  53. app/etc/modules/Xclm24_Checkout.xml +32 -0
  54. app/etc/modules/Xclm24_Myidshipping.xml +29 -0
  55. app/locale/en_US/template/email/sales/clm24/creditmemo_new.html +119 -0
  56. app/locale/en_US/template/email/sales/clm24/creditmemo_new_guest.html +117 -0
  57. app/locale/en_US/template/email/sales/clm24/invoice_new.html +118 -0
  58. app/locale/en_US/template/email/sales/clm24/invoice_new_guest.html +117 -0
  59. app/locale/en_US/template/email/sales/clm24/order_new.html +115 -0
  60. app/locale/en_US/template/email/sales/clm24/order_new_guest.html +115 -0
  61. app/locale/en_US/template/email/sales/clm24/shipment_new.html +122 -0
  62. app/locale/en_US/template/email/sales/clm24/shipment_new_guest.html +120 -0
  63. package.xml +19 -0
  64. skin/frontend/base/default/css/myshipping/lightwindow.css +400 -0
  65. skin/frontend/base/default/images/mapmyid/ajax-loading.gif +0 -0
  66. skin/frontend/base/default/images/mapmyid/arrow-down.gif +0 -0
  67. skin/frontend/base/default/images/mapmyid/arrow-up.gif +0 -0
  68. skin/frontend/base/default/images/mapmyid/backgroundlight.jpg +0 -0
  69. skin/frontend/base/default/images/mapmyid/backgroundlight.png +0 -0
  70. skin/frontend/base/default/images/mapmyid/black-70.png +0 -0
  71. skin/frontend/base/default/images/mapmyid/black.png +0 -0
  72. skin/frontend/base/default/images/mapmyid/nextlabel.gif +0 -0
  73. skin/frontend/base/default/images/mapmyid/pattern_148-70.png +0 -0
  74. skin/frontend/base/default/images/mapmyid/pattern_148.gif +0 -0
  75. skin/frontend/base/default/images/mapmyid/prevlabel.gif +0 -0
  76. skin/frontend/base/default/images/ship2myidlogo.png +0 -0
  77. skin/frontend/base/default/js/myshipping/inline.js +8 -0
  78. skin/frontend/base/default/js/myshipping/lightwindow.js +1922 -0
app/code/local/Xclm24/Checkout/controllers/OnepageController.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
22
+ class Xclm24_Checkout_OnepageController extends Mage_Checkout_OnepageController
23
+ {
24
+ /**
25
+ * Shipping method save action rewrited to skip payment method
26
+ */
27
+ public function saveShippingMethodAction()
28
+ {
29
+ if ($this->_expireAjax()) {
30
+ return;
31
+ }
32
+ if ($this->getRequest()->isPost()) {
33
+ $data = $this->getRequest()->getPost('shipping_method', '');
34
+ $result = $this->getOnepage()->saveShippingMethod($data);
35
+ // $result will contain error data if shipping method is empty
36
+ if (!$result) {
37
+ Mage::dispatchEvent(
38
+ 'checkout_controller_onepage_save_shipping_method',
39
+ array(
40
+ 'request' => $this->getRequest(),
41
+ 'quote' => $this->getOnepage()->getQuote()));
42
+ $this->getOnepage()->getQuote()->collectTotals();
43
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
44
+ $result['skipPayment'] = false;
45
+ if($this->getOnepage()->getQuote()->getGrandTotal() == 0){
46
+ $result['skipPayment'] = true;
47
+ }
48
+ $result['goto_section'] = 'payment';
49
+ $result['update_section'] = array(
50
+ 'name' => 'payment-method',
51
+ 'html' => $this->_getPaymentMethodsHtml()
52
+ );
53
+ }
54
+ $this->getOnepage()->getQuote()->collectTotals()->save();
55
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
56
+ }
57
+ }
58
+ }
app/code/local/Xclm24/Checkout/etc/config.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Xclm24_Checkout>
25
+ <version>1.3</version>
26
+ </Xclm24_Checkout>
27
+ </modules>
28
+
29
+ <frontend>
30
+ <routers>
31
+ <checkout>
32
+ <use>standard</use>
33
+ <args>
34
+ <modules>
35
+ <Xclm24_Checkout before="Mage_Checkout">Xclm24_Checkout</Xclm24_Checkout>
36
+ </modules>
37
+ </args>
38
+ </checkout>
39
+ </routers>
40
+
41
+ <!-- <layout>
42
+ <updates>
43
+ <custom>
44
+ <file>mycheckout.xml</file>
45
+ </custom>
46
+ </updates>
47
+ </layout>-->
48
+ </frontend>
49
+ </config>
app/code/local/Xclm24/Myidshipping/Block/Adminhtml/Promo/Quote/Edit/Tab/Main.php ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Shopping Cart Price Rule General Information Tab
23
+ */
24
+
25
+ class Xclm24_Myidshipping_Block_Adminhtml_Promo_Quote_Edit_Tab_Main extends Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main
26
+ {
27
+
28
+ /**
29
+ * Add Ship2MyId Coupon Code condition in Form
30
+ *
31
+ * @return Mage_Adminhtml_Block_Widget_Form
32
+ */
33
+
34
+ protected function _prepareForm()
35
+ {
36
+ $model = Mage::registry('current_promo_quote_rule');
37
+
38
+ $form = new Varien_Data_Form();
39
+ $form->setHtmlIdPrefix('rule_');
40
+
41
+ $fieldset = $form->addFieldset('base_fieldset',
42
+ array('legend' => Mage::helper('salesrule')->__('General Information'))
43
+ );
44
+
45
+ if ($model->getId()) {
46
+ $fieldset->addField('rule_id', 'hidden', array(
47
+ 'name' => 'rule_id',
48
+ ));
49
+ }
50
+
51
+ $fieldset->addField('product_ids', 'hidden', array(
52
+ 'name' => 'product_ids',
53
+ ));
54
+
55
+ $fieldset->addField('name', 'text', array(
56
+ 'name' => 'name',
57
+ 'label' => Mage::helper('salesrule')->__('Rule Name'),
58
+ 'title' => Mage::helper('salesrule')->__('Rule Name'),
59
+ 'required' => true,
60
+ ));
61
+
62
+ $fieldset->addField('description', 'textarea', array(
63
+ 'name' => 'description',
64
+ 'label' => Mage::helper('salesrule')->__('Description'),
65
+ 'title' => Mage::helper('salesrule')->__('Description'),
66
+ 'style' => 'height: 100px;',
67
+ ));
68
+
69
+ $fieldset->addField('is_active', 'select', array(
70
+ 'label' => Mage::helper('salesrule')->__('Status'),
71
+ 'title' => Mage::helper('salesrule')->__('Status'),
72
+ 'name' => 'is_active',
73
+ 'required' => true,
74
+ 'options' => array(
75
+ '1' => Mage::helper('salesrule')->__('Active'),
76
+ '0' => Mage::helper('salesrule')->__('Inactive'),
77
+ ),
78
+ ));
79
+ if(Mage::getStoreConfig('clm24core/shippings/enabled'))
80
+ {
81
+ if ($model->getId()) {
82
+ $clm24myidCouponModel = Mage::getModel('myidshipping/coupon')->loadByRuleId($model->getId());
83
+ if($clm24myidCouponModel->getShip2myidOnly()){
84
+ $clm24value = $clm24myidCouponModel->getShip2myidOnly();
85
+ }else{
86
+ $clm24value = 0;
87
+ }
88
+ $model->setShip2myidOnly($clm24value);
89
+ }
90
+ $fieldset->addField('ship2myid_only', 'select', array(
91
+ 'label' => Mage::helper('salesrule')->__('Use for Ship2myId only'),
92
+ 'title' => Mage::helper('salesrule')->__('Use for Ship2myId only'),
93
+ 'name' => 'ship2myid_only',
94
+ 'required' => false,
95
+ 'value' => $clm24value,
96
+ 'options' => array(
97
+ 1 => Mage::helper('salesrule')->__('Yes'),
98
+ 0 => Mage::helper('salesrule')->__('No'),
99
+ ),
100
+ ));
101
+ }
102
+
103
+ if (!$model->getId()) {
104
+ $model->setData('is_active', '1');
105
+ }
106
+
107
+ if (Mage::app()->isSingleStoreMode()) {
108
+ $websiteId = Mage::app()->getStore(true)->getWebsiteId();
109
+ $fieldset->addField('website_ids', 'hidden', array(
110
+ 'name' => 'website_ids[]',
111
+ 'value' => $websiteId
112
+ ));
113
+ $model->setWebsiteIds($websiteId);
114
+ } else {
115
+ $field = $fieldset->addField('website_ids', 'multiselect', array(
116
+ 'name' => 'website_ids[]',
117
+ 'label' => Mage::helper('salesrule')->__('Websites'),
118
+ 'title' => Mage::helper('salesrule')->__('Websites'),
119
+ 'required' => true,
120
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm()
121
+ ));
122
+ $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
123
+ $field->setRenderer($renderer);
124
+ }
125
+
126
+ $customerGroups = Mage::getResourceModel('customer/group_collection')->load()->toOptionArray();
127
+ $found = false;
128
+
129
+ foreach ($customerGroups as $group) {
130
+ if ($group['value']==0) {
131
+ $found = true;
132
+ }
133
+ }
134
+ if (!$found) {
135
+ array_unshift($customerGroups, array(
136
+ 'value' => 0,
137
+ 'label' => Mage::helper('salesrule')->__('NOT LOGGED IN'))
138
+ );
139
+ }
140
+
141
+ $fieldset->addField('customer_group_ids', 'multiselect', array(
142
+ 'name' => 'customer_group_ids[]',
143
+ 'label' => Mage::helper('salesrule')->__('Customer Groups'),
144
+ 'title' => Mage::helper('salesrule')->__('Customer Groups'),
145
+ 'required' => true,
146
+ 'values' => Mage::getResourceModel('customer/group_collection')->toOptionArray(),
147
+ ));
148
+
149
+ $couponTypeFiled = $fieldset->addField('coupon_type', 'select', array(
150
+ 'name' => 'coupon_type',
151
+ 'label' => Mage::helper('salesrule')->__('Coupon'),
152
+ 'required' => true,
153
+ 'options' => Mage::getModel('salesrule/rule')->getCouponTypes(),
154
+ ));
155
+
156
+ $couponCodeFiled = $fieldset->addField('coupon_code', 'text', array(
157
+ 'name' => 'coupon_code',
158
+ 'label' => Mage::helper('salesrule')->__('Coupon Code'),
159
+ 'required' => true,
160
+ ));
161
+
162
+ $autoGenerationCheckbox = $fieldset->addField('use_auto_generation', 'checkbox', array(
163
+ 'name' => 'use_auto_generation',
164
+ 'label' => Mage::helper('salesrule')->__('Use Auto Generation'),
165
+ 'note' => Mage::helper('salesrule')->__('If you select and save the rule you will be able to generate multiple coupon codes.'),
166
+ 'onclick' => 'handleCouponsTabContentActivity()',
167
+ 'checked' => (int)$model->getUseAutoGeneration() > 0 ? 'checked' : ''
168
+ ));
169
+
170
+ $autoGenerationCheckbox->setRenderer(
171
+ $this->getLayout()->createBlock('adminhtml/promo_quote_edit_tab_main_renderer_checkbox')
172
+ );
173
+
174
+ $usesPerCouponFiled = $fieldset->addField('uses_per_coupon', 'text', array(
175
+ 'name' => 'uses_per_coupon',
176
+ 'label' => Mage::helper('salesrule')->__('Uses per Coupon'),
177
+ ));
178
+
179
+ $fieldset->addField('uses_per_customer', 'text', array(
180
+ 'name' => 'uses_per_customer',
181
+ 'label' => Mage::helper('salesrule')->__('Uses per Customer'),
182
+ ));
183
+
184
+ $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
185
+ $fieldset->addField('from_date', 'date', array(
186
+ 'name' => 'from_date',
187
+ 'label' => Mage::helper('salesrule')->__('From Date'),
188
+ 'title' => Mage::helper('salesrule')->__('From Date'),
189
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
190
+ 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
191
+ 'format' => $dateFormatIso
192
+ ));
193
+ $fieldset->addField('to_date', 'date', array(
194
+ 'name' => 'to_date',
195
+ 'label' => Mage::helper('salesrule')->__('To Date'),
196
+ 'title' => Mage::helper('salesrule')->__('To Date'),
197
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
198
+ 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
199
+ 'format' => $dateFormatIso
200
+ ));
201
+
202
+ $fieldset->addField('sort_order', 'text', array(
203
+ 'name' => 'sort_order',
204
+ 'label' => Mage::helper('salesrule')->__('Priority'),
205
+ ));
206
+
207
+ $fieldset->addField('is_rss', 'select', array(
208
+ 'label' => Mage::helper('salesrule')->__('Public In RSS Feed'),
209
+ 'title' => Mage::helper('salesrule')->__('Public In RSS Feed'),
210
+ 'name' => 'is_rss',
211
+ 'options' => array(
212
+ '1' => Mage::helper('salesrule')->__('Yes'),
213
+ '0' => Mage::helper('salesrule')->__('No'),
214
+ ),
215
+ ));
216
+
217
+ if(!$model->getId()){
218
+ //set the default value for is_rss feed to yes for new promotion
219
+ $model->setIsRss(1);
220
+ }
221
+
222
+ $form->setValues($model->getData());
223
+
224
+ $autoGenerationCheckbox->setValue(1);
225
+
226
+ if ($model->isReadonly()) {
227
+ foreach ($fieldset->getElements() as $element) {
228
+ $element->setReadonly(true, true);
229
+ }
230
+ }
231
+
232
+ //$form->setUseContainer(true);
233
+
234
+ $this->setForm($form);
235
+
236
+ // field dependencies
237
+ $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
238
+ ->addFieldMap($couponTypeFiled->getHtmlId(), $couponTypeFiled->getName())
239
+ ->addFieldMap($couponCodeFiled->getHtmlId(), $couponCodeFiled->getName())
240
+ ->addFieldMap($autoGenerationCheckbox->getHtmlId(), $autoGenerationCheckbox->getName())
241
+ ->addFieldMap($usesPerCouponFiled->getHtmlId(), $usesPerCouponFiled->getName())
242
+ ->addFieldDependence(
243
+ $couponCodeFiled->getName(),
244
+ $couponTypeFiled->getName(),
245
+ Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
246
+ ->addFieldDependence(
247
+ $autoGenerationCheckbox->getName(),
248
+ $couponTypeFiled->getName(),
249
+ Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
250
+ ->addFieldDependence(
251
+ $usesPerCouponFiled->getName(),
252
+ $couponTypeFiled->getName(),
253
+ Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
254
+ );
255
+
256
+ Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_main_prepare_form', array('form' => $form));
257
+
258
+ return Mage_Adminhtml_Block_Widget_Form::_prepareForm();
259
+ }
260
+ }
app/code/local/Xclm24/Myidshipping/Block/Adminhtml/System/Config/Fieldset/Hint.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+
22
+ class Xclm24_Myidshipping_Block_Adminhtml_System_Config_Fieldset_Hint
23
+ extends Mage_Adminhtml_Block_Abstract
24
+ implements Varien_Data_Form_Element_Renderer_Interface
25
+ {
26
+ protected $_template = 'myidshipping/system/config/fieldset/hint.phtml';
27
+
28
+ /**
29
+ * Render fieldset html
30
+ *
31
+ * @param Varien_Data_Form_Element_Abstract $element
32
+ * @return string
33
+ */
34
+ public function render(Varien_Data_Form_Element_Abstract $element)
35
+ {
36
+ $elementOriginalData = $element->getOriginalData();
37
+ if (isset($elementOriginalData['help_link'])) {
38
+ $this->setHelpLink($elementOriginalData['help_link']);
39
+ }
40
+
41
+ return $this->toHtml();
42
+ }
43
+ }
app/code/local/Xclm24/Myidshipping/Block/GiftMessage/Message/Inline.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+
22
+ /**
23
+ * Gift message inline edit form
24
+ */
25
+
26
+ class Xclm24_Myidshipping_Block_GiftMessage_Message_Inline extends Mage_GiftMessage_Block_Message_Inline
27
+ {
28
+ /**
29
+ * Get default value for To field
30
+ *
31
+ * @return string
32
+ */
33
+ public function getDefaultTo()
34
+ {
35
+ if(Mage::getStoreConfig('clm24core/shippings/enabled')):
36
+ if ($shippingAddress = $this->getEntity()->getShippingAddress()) {
37
+ $shippingAddressEmail = $shippingAddress->getEmail();
38
+ $_clm24 = Mage::getSingleton('checkout/session')->getData("ship2myid");
39
+ if(!empty($_clm24) && array_key_exists($shippingAddressEmail,$_clm24)){
40
+ $recData = $_clm24[$shippingAddressEmail];
41
+ return $recData['firstname'].' '.$recData['lastname'];
42
+ }elseif(!empty($_clm24) && array_key_exists('firstname',$_clm24)){
43
+ return $_clm24['firstname'].' '.$_clm24['lastname'];
44
+ }else{
45
+ return $this->getEntity()->getShippingAddress()->getName();
46
+ }
47
+ } else {
48
+ $shippingAddress = $this->getEntity();
49
+ $shippingAddressEmail = $shippingAddress->getEmail();
50
+ $_clm24 = Mage::getSingleton('checkout/session')->getData("ship2myid");
51
+ if(!empty($_clm24) && array_key_exists($shippingAddressEmail,$_clm24)){
52
+ $recData = $_clm24[$shippingAddressEmail];
53
+ return $recData['Myidfirstname'].' '.$recData['Myidlastname'];
54
+ }elseif(!empty($_clm24) && array_key_exists('firstname',$_clm24)){
55
+ return $_clm24['firstname'].' '.$_clm24['lastname'];
56
+ }else{
57
+ return $this->getEntity()->getName();
58
+ }
59
+ }
60
+ else:
61
+ if ($this->getEntity()->getShippingAddress()) {
62
+ return $this->getEntity()->getShippingAddress()->getName();
63
+ } else {
64
+ return $this->getEntity()->getName();
65
+ }
66
+ endif;
67
+ }
68
+
69
+ }
app/code/local/Xclm24/Myidshipping/Block/Myidpopup.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Ship2myid Popup Block
23
+ */
24
+
25
+ class Xclm24_Myidshipping_Block_Myidpopup extends Mage_Checkout_Block_Onepage_Abstract
26
+ {
27
+
28
+ /**
29
+ * _construct for popup page
30
+ */
31
+
32
+ protected function _construct()
33
+ {
34
+ parent::_construct();
35
+ }
36
+ }
app/code/local/Xclm24/Myidshipping/Helper/Data.php ADDED
@@ -0,0 +1,953 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping default helper
23
+ */
24
+
25
+ class Xclm24_Myidshipping_Helper_Data extends Mage_Core_Helper_Abstract
26
+ {
27
+
28
+ /**
29
+ * Close the Session with Ship2MyId Server
30
+ * @param Strinng $_clm24Session
31
+ *
32
+ */
33
+ public function closeMyIDSession($_clm24Session)
34
+ {
35
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session?";
36
+ $_requestUrl = $url . "access_token=" . $_clm24Session;
37
+ $ch = curl_init($_requestUrl);
38
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
39
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
40
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
41
+ $response = curl_exec($ch);
42
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
43
+ Mage::Log("Clm24: " . print_r($response, true));
44
+ }
45
+ curl_close($ch);
46
+ }
47
+
48
+ /**
49
+ * Submit Order at Ship2MyId Server
50
+ *
51
+ * @param String $clm24_token
52
+ * @param Mage_Sales_Model_Order $order
53
+ * @param Array $_clm24Data
54
+ *
55
+ * @return result array()
56
+ */
57
+
58
+ public function submitOrder($clm24_token, $order, $_clm24Data)
59
+ {
60
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
61
+ Mage::Log("Submit Order: " . print_r($_clm24Data, true));
62
+ }
63
+ $_result = null;
64
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/create?";
65
+ $_requestUrl = $url . "access_token=" . $clm24_token;
66
+ $xml = new DOMDocument('1.0', 'utf-8');
67
+ $xmlRoot = $xml->createElement('OrderDetails');
68
+ $xml->appendChild($xmlRoot);
69
+ $orderItems = $order->getItemsCollection(array(), true);
70
+ foreach ($orderItems as $item) {
71
+ $item_id = $item->getData("item_id");
72
+ $order_id = $item->getData("order_id");
73
+ $product_id = $item->getData("product_id");
74
+ $product_sku = $item->getSku();
75
+ $product_name = $item->getName();
76
+ $qty = $item->getData("qty_ordered");
77
+ $price = $item->getData("price");
78
+ $subtotal = $item->getData("row_total");
79
+ $taxtotal = $item->getData("tax_amount");
80
+ $grandtotal = $item->getData("row_total_incl_tax");
81
+ $xmlItem = $xml->createElement('Item');
82
+ $xmlItem->appendChild($xml->createTextNode($product_name));
83
+ $domAttribute = $xml->createAttribute('MerchentOrderRecordRef');
84
+ $domAttribute->value = $order_id;
85
+ $xmlItem->appendChild($domAttribute);
86
+ $domAttribute = $xml->createAttribute('MerchentOrderRecordLineRef');
87
+ $domAttribute->value = $item_id;
88
+ $xmlItem->appendChild($domAttribute);
89
+ $domAttribute = $xml->createAttribute('Sku');
90
+ $domAttribute->value = $product_sku;
91
+ $xmlItem->appendChild($domAttribute);
92
+ $domAttribute = $xml->createAttribute('Qty');
93
+ $domAttribute->value = $qty;
94
+ $xmlItem->appendChild($domAttribute);
95
+ $domAttribute = $xml->createAttribute('Price');
96
+ $domAttribute->value = $price;
97
+ $xmlItem->appendChild($domAttribute);
98
+ $domAttribute = $xml->createAttribute('LineSubTotal');
99
+ $domAttribute->value = $subtotal;
100
+ $xmlItem->appendChild($domAttribute);
101
+ $domAttribute = $xml->createAttribute('LineTaxesTotal');
102
+ $domAttribute->value = $taxtotal;
103
+ $xmlItem->appendChild($domAttribute);
104
+ $domAttribute = $xml->createAttribute('LineTotal');
105
+ $domAttribute->value = $grandtotal;
106
+ $xmlItem->appendChild($domAttribute);
107
+ $xmlRoot->appendChild($xmlItem);
108
+ }
109
+ $xmlOrderDetails = $xml->saveXML();
110
+ $_orderDetailsXML = $arrOrderInfo = array(
111
+ "ExternalOrder" => array(
112
+ "sender_email_address" => $order->getData("customer_email"),
113
+ "sender_first_name" => $order->getData("customer_firstname"),
114
+ "sender_last_name" => $order->getData("customer_lastname"),
115
+ "sender_message" => "Brought to you by Ship2MyID",
116
+ "receiver_email_address" => $_clm24Data["email"],
117
+ "receiver_first_name" => $_clm24Data["firstname"],
118
+ "receiver_last_name" => $_clm24Data["lastname"],
119
+ "receiver_telephone" => $_clm24Data["telephone"],
120
+ "receiver_type" => $_clm24Data["receiver_type"],
121
+ "receiver_linkedin_id" => $_clm24Data["receiver_linkedin_id"],
122
+ "receiver_facebook_id" => $_clm24Data["receiver_facebook_id"],
123
+ "marketplace_order_data" => $xmlOrderDetails
124
+ )
125
+ );
126
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
127
+ Mage::Log("Clm24 [submitOrder Array]: " . print_r($arrOrderInfo, true));
128
+ Mage::Log("Clm24 [submitOrder Payload Data]: " . print_r(Zend_Json::Encode($arrOrderInfo), true));
129
+ }
130
+ $ch = curl_init($_requestUrl);
131
+ $headers = array(
132
+ "Content-Type: application/json"
133
+ );
134
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
135
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
136
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
137
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
138
+ curl_setopt($ch, CURLOPT_POSTFIELDS, Zend_Json::Encode($arrOrderInfo));
139
+ $response = curl_exec($ch);
140
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
141
+ Mage::Log("Clm24 [submitOrder Response ]: " . print_r($response, true));
142
+ }
143
+ if ($response) {
144
+ $_objResponse = Zend_Json::decode($response);
145
+ if (isset($_objResponse["ExternalOrder"])) {
146
+ $_result = $_objResponse["ExternalOrder"];
147
+ } else {
148
+ $_result = array(
149
+ "status" => $_objResponse["Error"]["status"],
150
+ "message" => isset($_objResponse["Error"]["message"])?$_objResponse["Error"]["message"]:"Error By Server for ".__FUNCTION__
151
+ );
152
+ }
153
+ }
154
+ curl_close($ch);
155
+ return $_result;
156
+ }
157
+
158
+ /**
159
+ * Mark Order as Cancel Ship2MyId
160
+ *
161
+ * @param String $clm24_token
162
+ * @param Int $orderId
163
+ *
164
+ * @return result array()
165
+ */
166
+
167
+ public function cancelOrder($clm24_token, $orderId)
168
+ {
169
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->loadByOrderId($orderId);
170
+ $_result = null;
171
+ $realorderId = $clm24_model->getData("real_order_id");
172
+ $entityId = $clm24_model->getData("entity_id");
173
+ if ((isset($clm24_model)) && (!empty($realorderId))) {
174
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/cancel/" . $realorderId . "?";
175
+ $_requestUrl = $url . "access_token=" . $clm24_token;
176
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
177
+ Mage::Log("Clm24 [cancelOrder]: " . print_r($realorderId, true));
178
+ Mage::Log("Clm24 [cancelOrder]: " . print_r($url, true));
179
+ }
180
+ $ch = curl_init($_requestUrl);
181
+ $headers = array(
182
+ "Content-Type: application/json"
183
+ );
184
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
185
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
186
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
187
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
188
+ $response = curl_exec($ch);
189
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
190
+ Mage::Log("Clm24 [cancelOrder]: " . print_r($response, true));
191
+ }
192
+ if ($response) {
193
+ $_objResponse = Zend_Json::decode($response);
194
+ if (isset($_objResponse["ExternalOrder"])) {
195
+ $_result = $_objResponse["ExternalOrder"];
196
+ if ($_result["is_order_cancelled"] == "true") {
197
+ $_data = array(
198
+ "entity_id" => $entityId,
199
+ "order_status_id" => 4,
200
+ "updated_at" => date('Y-m-d H:i:s')
201
+ );
202
+ } else {
203
+ $_data = array(
204
+ "entity_id" => $entityId,
205
+ "order_status_id" => 100,
206
+ "updated_at" => date('Y-m-d H:i:s')
207
+ );
208
+ }
209
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->setData($_data)->save();
210
+ } else {
211
+ $_result = array(
212
+ "status" => $_objResponse["Error"]["status"],
213
+ "message" => isset($_objResponse["Error"]["message"])?$_objResponse["Error"]["message"]:"Error By Server for ".__FUNCTION__
214
+ );
215
+ $_data = array(
216
+ "entity_id" => $entityId,
217
+ "order_status_id" => 100,
218
+ "updated_at" => date('Y-m-d H:i:s')
219
+ );
220
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->setData($_data)->save();
221
+ }
222
+ }
223
+ curl_close($ch);
224
+ }
225
+ return $_result;
226
+ }
227
+
228
+ /**
229
+ * Mark Order as Completed at Ship2MyId
230
+ *
231
+ * @param String $clm24_token
232
+ * @param Int $orderId
233
+ *
234
+ * @return result array()
235
+ */
236
+
237
+ public function completeOrder($clm24_token, $orderId)
238
+ {
239
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->loadByOrderId($orderId);
240
+ $_result = null;
241
+ $realorderId = $clm24_model->getData("real_order_id");
242
+ $entityId = $clm24_model->getData("entity_id");
243
+ if ((isset($clm24_model)) && (!empty($realorderId))) {
244
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/complete/" . $realorderId . "?";
245
+ $_requestUrl = $url . "access_token=" . $clm24_token;
246
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
247
+ Mage::Log("Clm24 [completeOrder]: " . print_r($realorderId, true));
248
+ }
249
+ $ch = curl_init($_requestUrl);
250
+ $headers = array(
251
+ "Content-Type: application/json"
252
+ );
253
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
254
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
255
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
256
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
257
+ $response = curl_exec($ch);
258
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
259
+ Mage::Log("Clm24 [completeOrder]: " . print_r($response, true));
260
+ }
261
+ if ($response) {
262
+ $_objResponse = Zend_Json::decode($response);
263
+ if (isset($_objResponse["ExternalOrder"])) {
264
+ $_result = $_objResponse["ExternalOrder"];
265
+ } else {
266
+ $_result = array(
267
+ "status" => $_objResponse["Error"]["status"],
268
+ "message" => isset($_objResponse["Error"]["message"])?$_objResponse["Error"]["message"]:"Error By Server for ".__FUNCTION__
269
+ );
270
+ }
271
+ }
272
+ curl_close($ch);
273
+ $_data = array(
274
+ "entity_id" => $entityId,
275
+ "order_status_id" => 3,
276
+ "updated_at" => date('Y-m-d H:i:s')
277
+ );
278
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->setData($_data)->save();
279
+ }
280
+ return $_result;
281
+ }
282
+
283
+ /**
284
+ * Check Order at Ship2MyId
285
+ *
286
+ * @param String $clm24_token
287
+ * @param Int $realorderId
288
+ *
289
+ * @return result array()
290
+ */
291
+
292
+ public function checkOrder($clm24_token, $realorderId)
293
+ {
294
+ $_result = null;
295
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/" . $realorderId . "?";
296
+ $_requestUrl = $url . "access_token=" . $clm24_token;
297
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
298
+ Mage::Log("Clm24 [checkOrder]: " . print_r($realorderId, true));
299
+ }
300
+ $ch = curl_init($_requestUrl);
301
+ $headers = array(
302
+ "Content-Type: application/json"
303
+ );
304
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
305
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
306
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
307
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
308
+ $response = curl_exec($ch);
309
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
310
+ Mage::Log("Clm24 [checkOrder]: " . print_r($response, true));
311
+ }
312
+ if ($response) {
313
+ $_objResponse = Zend_Json::decode($response);
314
+ if (isset($_objResponse["ExternalOrder"])) {
315
+ $_result = $_objResponse["ExternalOrder"];
316
+ } else {
317
+ $_result = array(
318
+ "status" => $_objResponse["Error"]["status"],
319
+ "message" => isset($_objResponse["Error"]["message"])?$_objResponse["Error"]["message"]:"Error By Server for ".__FUNCTION__
320
+ );
321
+ }
322
+ }
323
+ curl_close($ch);
324
+ return $_result;
325
+ }
326
+
327
+ /**
328
+ * Check Order Status at Ship2MyId with Multiple OrderIds
329
+ *
330
+ * @param String $clm24_token
331
+ * @param Array $orderIds
332
+ * @param String $status_type (both|)
333
+ *
334
+ * @return result array()
335
+ */
336
+
337
+
338
+ public function checkOrderStatus($clm24_token, $orderIds, $status_type = 'both')
339
+ {
340
+
341
+ $_result = null;
342
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/status?";
343
+
344
+ // Form the Url Request
345
+ $url = $url . "access_token=" . $clm24_token . "&";
346
+ $_requestUrl = $url . "status_type=" . $status_type;
347
+
348
+ $ch = curl_init($_requestUrl);
349
+ $headers = array("Content-Type: application/json");
350
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
351
+
352
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
353
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
354
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
355
+ curl_setopt($ch, CURLOPT_POSTFIELDS, Zend_Json::Encode($orderIds));
356
+
357
+ $response = curl_exec($ch);
358
+
359
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
360
+ Mage::Log("Clm24 [submitOrder]: " . print_r($response, true));
361
+ }
362
+ if ($response) {
363
+ $_result = Zend_Json::decode($response);
364
+ } else {
365
+ $_result = array('accepted_order' => array(), 'rejected_order' => array());
366
+ }
367
+ curl_close($ch);
368
+ return $_result;
369
+ }
370
+
371
+ /**
372
+ * Validae Token and return Access token for Merchant
373
+ *
374
+ * @return String $_access_token
375
+ */
376
+
377
+ public function getMyIDSession()
378
+ {
379
+
380
+ $_access_token = '';
381
+ $session = Mage::getSingleton('core/session');
382
+ $_session_token = $session->getShip2MyIdAccesstoken();
383
+
384
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
385
+ Mage::Log("Clm24 [Session Token]: " . print_r($_session_token, true));
386
+ }
387
+
388
+ if (isset($_session_token) && !empty($_session_token)) {
389
+ $_validate_flag = $this->validateShip2MyIdToken($_session_token);
390
+ if ($_validate_flag) {
391
+ $_access_token = $_session_token;
392
+ } else {
393
+ $_access_token = $this->_getShip2MyIDSession();
394
+ }
395
+ } else {
396
+ $_access_token = $this->_getShip2MyIDSession();
397
+ }
398
+ $session->setShip2MyIdAccesstoken($_access_token);
399
+ return $_access_token;
400
+ }
401
+
402
+ /**
403
+ * Validate Access Token from Ship2MyId Server
404
+ *
405
+ * @param String $clm24_token
406
+ * @return String $_access_token
407
+ */
408
+
409
+ public function validateShip2MyIdToken($clm24_token)
410
+ {
411
+
412
+ if (!empty($clm24_token)) {
413
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session/?";
414
+
415
+ $_requestUrl = $url . "access_token=" . $clm24_token;
416
+
417
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
418
+ Mage::Log(" Toekn Validation : ");
419
+ Mage::Log("Clm24 [validate Token]: " . print_r($_requestUrl, true));
420
+ }
421
+
422
+ $ch = curl_init($_requestUrl);
423
+
424
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
425
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
426
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
427
+ //curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($userInfo));
428
+
429
+ $response = curl_exec($ch);
430
+
431
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
432
+ Mage::Log("Clm24 [getMyIDSession]: " . print_r($response, true));
433
+ }
434
+ curl_close($ch);
435
+ if ($response) {
436
+ $_objResponse = Zend_Json::decode($response);
437
+ if (isset($_objResponse["Session"]["access_token"]) && !empty($_objResponse["Session"]["access_token"])) {
438
+ return true;
439
+ } else {
440
+ return false;
441
+ }
442
+ } else {
443
+ return false;
444
+ }
445
+ } else {
446
+ return false;
447
+ }
448
+ }
449
+
450
+ /**
451
+ * Get Access Token From Ship2Myd Server For Merchant
452
+ *
453
+ * @param String $clm24_token
454
+ * @return Array $_session
455
+ */
456
+
457
+ public function _getShip2MyIDSession()
458
+ {
459
+ $_session = null;
460
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session/signin";
461
+
462
+ // Get username and password
463
+ $merchantCode = Mage::getStoreConfig('clm24core/shippings/merchantID');
464
+ $password = Mage::helper('core')->decrypt(Mage::getStoreConfig('clm24core/shippings/merchantPassword'));
465
+
466
+ // User Information
467
+ $userInfo = array(
468
+ "username" => base64_encode($merchantCode),
469
+ "password" => base64_encode($password)
470
+ );
471
+
472
+ $jsondata = Zend_Json::encode($userInfo);
473
+ $payload['signin_details'] = base64_encode($jsondata);
474
+ $jsonpayload = Zend_Json::encode($payload);
475
+ $_requestUrl = $url; //. "username=" . $userInfo["username"] . "&password=" . $userInfo["password"];
476
+
477
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
478
+ Mage::Log(" Login Step For Vendor : ");
479
+ Mage::Log("Clm24 [requestIrl]: " . print_r($_requestUrl, true));
480
+ Mage::Log("Clm24 [payload]: " . print_r($jsonpayload, true));
481
+ }
482
+
483
+ $ch = curl_init($_requestUrl);
484
+
485
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
486
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
487
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonpayload);
488
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
489
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
490
+ 'Content-Type: application/json',
491
+ 'Content-Length: ' . strlen($jsonpayload))
492
+ );
493
+ //curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($userInfo));
494
+
495
+ $response = curl_exec($ch);
496
+
497
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
498
+ Mage::Log("Clm24 [getMyIDSession]: " . print_r($response, true));
499
+ }
500
+
501
+ if ($response) {
502
+ $_objResponse = Zend_Json::decode($response);
503
+ $_session = $_objResponse["Session"]["access_token"];
504
+ }
505
+
506
+ // Close handle
507
+ curl_close($ch);
508
+
509
+ return $_session;
510
+ }
511
+
512
+ /* public function getMyIDSession() {
513
+ $_session = null;
514
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session/signin?";
515
+ $merchantCode = Mage::getStoreConfig('clm24core/shippings/merchantID');
516
+ $password = Mage::helper('core')->decrypt(Mage::getStoreConfig('clm24core/shippings/merchantPassword'));
517
+ $userInfo = array(
518
+ "username" => $merchantCode,
519
+ "password" => $password
520
+ );
521
+ $_requestUrl = $url . "username=" . $userInfo["username"] . "&password=" . $userInfo["password"];
522
+
523
+ $ch = curl_init($_requestUrl);
524
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
525
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
526
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
527
+ $response = curl_exec($ch);
528
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
529
+ Mage::Log("Clm24 [getMyIDSession URL]: " . print_r($_requestUrl, true));
530
+ Mage::Log("Clm24 [getMyIDSession]: " . print_r($response, true));
531
+ }
532
+
533
+ if ($response) {
534
+ $_objResponse = Zend_Json::decode($response);
535
+ $_session = $_objResponse["Session"]["access_token"];
536
+ }
537
+ curl_close($ch);
538
+ return $_session;
539
+ } */
540
+
541
+ /**
542
+ * Get Access Token From Ship2Myd Server For User
543
+ *
544
+ * @param String $username
545
+ * @param String $password
546
+ * @return Array $_session
547
+ */
548
+
549
+ public function getMyIDUserSession($username, $password)
550
+ {
551
+ $_session = null;
552
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session/signin";
553
+
554
+ // Form the Url Request
555
+ //$_requestUrl = $url . "username=" . $username . "&password=" . $password;
556
+
557
+ $userInfo = array(
558
+ "username" => base64_encode($username),
559
+ "password" => base64_encode($password)
560
+ );
561
+
562
+ $jsondata = Zend_Json::encode($userInfo);
563
+ $payload['signin_details'] = base64_encode($jsondata);
564
+ $jsonpayload = Zend_Json::encode($payload);
565
+ $_requestUrl = $url;
566
+
567
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
568
+ Mage::Log(" Login Step : ");
569
+ Mage::Log("Clm24 [ requestUrl]: " . print_r($_requestUrl, true));
570
+ Mage::Log("Clm24 [payload]: " . print_r($jsonpayload, true));
571
+ }
572
+
573
+
574
+ //Mage::log($_requestUrl);
575
+ $ch = curl_init($_requestUrl);
576
+
577
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
578
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
579
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonpayload);
580
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
581
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
582
+ 'Content-Type: application/json',
583
+ 'Content-Length: ' . strlen($jsonpayload))
584
+ );
585
+
586
+
587
+ $response = curl_exec($ch);
588
+
589
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
590
+ Mage::Log("Clm24 [getMyIDUserSession]: " . print_r($response, true));
591
+ }
592
+
593
+ if ($response) {
594
+ $_objResponse = Zend_Json::decode($response);
595
+ $checkoutsession = Mage::getSingleton('checkout/session');
596
+ $checkoutsession->unsetData('clm24contacts');
597
+ $checkoutsession->unsetData('clm24recemails');
598
+ $checkoutsession->unsetData('clm24Token');
599
+ if (isset($_objResponse['Error']) && $_objResponse['Error']['status'] == 401) {
600
+ $checkoutsession->unsetData('clm24Token');
601
+ return array('error' => 1, 'message' => $_objResponse['Error']['message']);
602
+ } else {
603
+ $_userToken = $_objResponse["Session"]["access_token"];
604
+ $checkoutsession->setData('clm24Token', $_userToken);
605
+ }
606
+ }
607
+
608
+ // Close handle
609
+ curl_close($ch);
610
+
611
+ return $_userToken;
612
+ }
613
+
614
+ /* public function getMyIDUserSession($username, $password) {
615
+ $_session = null;
616
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session/signin?";
617
+ $_requestUrl = $url . "username=" . $username . "&password=" . $password;
618
+ $ch = curl_init($_requestUrl);
619
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
620
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
621
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
622
+ $response = curl_exec($ch);
623
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
624
+ Mage::Log("Clm24 [getMyIDUserSession]: " . print_r($response, true));
625
+ }
626
+ if ($response) {
627
+ $_objResponse = Zend_Json::decode($response);
628
+ $checkoutsession = Mage::getSingleton('checkout/session');
629
+ $checkoutsession->unsetData('clm24contacts');
630
+ $checkoutsession->unsetData('clm24recemails');
631
+ $checkoutsession->unsetData('clm24Token');
632
+ if (isset($_objResponse['Error']) && $_objResponse['Error']['status'] == 401) {
633
+ $checkoutsession->unsetData('clm24Token');
634
+ return array(
635
+ 'error' => 1,
636
+ 'message' => $_objResponse['Error']['message']
637
+ );
638
+ } else {
639
+ $_userToken = $_objResponse["Session"]["access_token"];
640
+ $checkoutsession->setData('clm24Token', $_userToken);
641
+ }
642
+ }
643
+ curl_close($ch);
644
+ return $_userToken;
645
+ } */
646
+
647
+ /**
648
+ * Zip code detials for perticuar sender and receiver
649
+ *
650
+ * @param String $_clm24Session (Access Token)
651
+ * @param String $_sender_email_address
652
+ * @param String $_receiver_email_address
653
+ *
654
+ * @return Array $_zipcode
655
+ */
656
+
657
+ public function getMyIDShippingSafeRecipientZipcode($_clm24Session, $_sender_email_address, $_receiver_email_address)
658
+ {
659
+ $_zipcode = null;
660
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/safe_recipient_zipcode?";
661
+ $_requestUrl = $url . "access_token=" . $_clm24Session . "&sender_email_address=" . $_sender_email_address . "&receiver_email_address=" . $_receiver_email_address;
662
+ $ch = curl_init($_requestUrl);
663
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
664
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
665
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
666
+ $response = curl_exec($ch);
667
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
668
+ Mage::Log("Clm24 [getMyIDShippingSafeRecipientZipcode]: " . print_r($response, true));
669
+ }
670
+ if ($response) {
671
+ $_objResponse = Zend_Json::decode($response);
672
+ if (isset($_objResponse["Address"])) {
673
+ $_zipcode = $_objResponse["Address"]["zipcode"];
674
+ } else {
675
+ $_zipcode = array(
676
+ "status" => $_objResponse["Error"]["status"],
677
+ "message" => isset($_objResponse["Error"]["message"])?$_objResponse["Error"]["message"]:"Error By Server for ".__FUNCTION__
678
+ );
679
+ }
680
+ }
681
+ curl_close($ch);
682
+ return $_zipcode;
683
+ }
684
+
685
+ /**
686
+ * Recipient Address detials for receiver
687
+ *
688
+ * @param String $_clm24Session (Access Token)
689
+ * @param String $_sender_email_address
690
+ * @param String $_receiver_email_address
691
+ * @param String $receiver_type ( email | facebook | linkedin )
692
+ * @param String $receiver_linkedin_id
693
+ * @param String $receiver_facebook_id
694
+ *
695
+ * @return Array $_zipcode
696
+ */
697
+
698
+ public function getMyIDShippingSafeRecipientAddress($_clm24Session, $_sender_email_address, $_receiver_email_address , $receiver_type = 'email',$receiver_linkedin_id = '',$receiver_facebook_id = '')
699
+ {
700
+ $_zipcode = null;
701
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/order/zipcode_state?";
702
+ $_requestUrl = $url . "access_token=" . $_clm24Session. "&receiver_type=" . $receiver_type;
703
+
704
+ if($receiver_type == 'email'){
705
+ $_requestUrl .= "&receiver_email_address=".$_receiver_email_address;
706
+ }elseif($receiver_type == 'facebook'){
707
+ $_requestUrl .= "&receiver_facebook_id=".$receiver_facebook_id;
708
+ }elseif($receiver_type == 'linkedin'){
709
+ $_requestUrl .= "&receiver_linkedin_id=".$receiver_linkedin_id;
710
+ }else{
711
+ $_requestUrl .= "&receiver_email_address=".$_receiver_email_address;
712
+ }
713
+
714
+ $ch = curl_init($_requestUrl);
715
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
716
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
717
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
718
+ $response = curl_exec($ch);
719
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
720
+ Mage::Log("Clm24 [getMyIDShippingSafeRecipientZipcode URL]: " . print_r($_requestUrl, true));
721
+ Mage::Log("Clm24 [getMyIDShippingSafeRecipientZipcode]: " . print_r($response, true));
722
+ }
723
+ if ($response) {
724
+ $_objResponse = Zend_Json::decode($response);
725
+ if (isset($_objResponse["Address"])) {
726
+ $_zipcode = array(
727
+ "zipcode" => $_objResponse["Address"]["zipcode"],
728
+ "state" => $_objResponse["Address"]["state_code"],
729
+ "country" => $_objResponse["Address"]["country_code"]
730
+ );
731
+ } else {
732
+ $_zipcode = array(
733
+ "status" => $_objResponse["Error"]["status"],
734
+ "message" => isset($_objResponse["Error"]["message"])?$_objResponse["Error"]["message"]:"Error By Server for ".__FUNCTION__
735
+ );
736
+ }
737
+ }
738
+ curl_close($ch);
739
+ return $_zipcode;
740
+ }
741
+
742
+ /**
743
+ * Return YouTube Video Link
744
+ *
745
+ * @return String
746
+ */
747
+
748
+ public function getYtVideoUrl()
749
+ {
750
+ return 'http://www.youtube.com/v/' . Mage::getStoreConfig('clm24core/shippings/ytvideoid') . '?autoplay=1';
751
+ }
752
+
753
+ /**
754
+ * Check PayPal Payment method
755
+ *
756
+ * @return Boolean
757
+ */
758
+
759
+ public function showPayPalNotice() {
760
+ $payments = Mage::getSingleton('payment/config')->getActiveMethods();
761
+ $methods = array();
762
+ foreach ($payments as $_code => $paymentModel) {
763
+ $methods[] = $_code;
764
+ if (((stripos($_code, "paypal") !== false && stripos($_code, "express") !== false) || stripos($_code, "payflow") !== false || stripos($_code, "verisign") !== false || stripos($_code, "paypaluk_direct") !== false)) {
765
+ return true;
766
+ }
767
+ }
768
+ return false;
769
+ }
770
+
771
+ /**
772
+ * Prepear Mask Address for Ship2MyId Order's
773
+ *
774
+ * @param String $firstname (Access Token)
775
+ * @param String $lastname
776
+ * @param String $_zipcode
777
+ * @param String $city
778
+ * @param Int $region_id
779
+ * @param String $region_name
780
+ * @param String $countryCode
781
+ * @param String $receiver_type
782
+ * @param String $receiver_linkedin_id
783
+ * @param String $receiver_facebook_id
784
+ *
785
+ * @return Array $_shipping
786
+ */
787
+
788
+ public function formatShippingData($firstname, $lastname, $_zipcode, $city, $region_id, $region_name, $countryCode, $receiver_type, $receiver_linkedin_id, $receiver_facebook_id)
789
+ {
790
+ if (!empty($region_id)) {
791
+ $regionModel = Mage::getModel("directory/region")->load($region_id);
792
+ $region_name = $regionModel->getName();
793
+ }
794
+ $_confir_ship2 = Mage::getStoreConfig('clm24core/shippings/ship2myid_label');
795
+ $_shipping = Array(
796
+ "firstname" => $_confir_ship2,
797
+ "lastname" => "service",
798
+ "company" => "",
799
+ "street" => Array(
800
+ Mage::getStoreConfig('clm24core/shippings/street_line1'),
801
+ Mage::getStoreConfig('clm24core/shippings/street_line2')
802
+ ),
803
+ "city" => $city,
804
+ "region_id" => $region_id,
805
+ "region" => $region_name,
806
+ "postcode" => ((isset($_zipcode) && $_zipcode <> '') ? $_zipcode : Mage::getStoreConfig('clm24core/shippings/defaultZipCode')),
807
+ "receiver_type",
808
+ $receiver_type,
809
+ "receiver_linkedin_id" => $receiver_linkedin_id,
810
+ "receiver_facebook_id" => $receiver_facebook_id,
811
+ "country_id" => $countryCode,
812
+ "telephone" => Mage::getStoreConfig('clm24core/shippings/telephone'),
813
+ "fax" => "",
814
+ "save_in_address_book" => 0
815
+ );
816
+ return $_shipping;
817
+ }
818
+
819
+ /**
820
+ * Return Ship2MyId Session Data
821
+ *
822
+ * @return Array
823
+ */
824
+
825
+ protected function _getPopupdata()
826
+ {
827
+ $session = Mage::getSingleton('checkout/session');
828
+ return $session->getData('ship2myid');
829
+ }
830
+
831
+ /**
832
+ * Save Ship2MyId Data to Order
833
+ *
834
+ */
835
+
836
+ public function saveMyidshipping()
837
+ {
838
+ $_quote = Mage::getModel('checkout/cart')->getQuote();
839
+
840
+ //Mage::Log("Clm24 [Quote Before Update]: " . print_r($_quote->getData(), true));
841
+ $data = $this->_getPopupdata();
842
+ //Mage::Log("Clm24 [Quote After Update]: " . print_r($_quote->getData(), true));
843
+
844
+ $_cml24Helper = Mage::Helper('myidshipping');
845
+ $_clm24Session = $_cml24Helper->getMyIDSession();
846
+ $_sender_email_address = $_quote->getData("customer_email");
847
+ $_receiver_email_address = $data["email"];
848
+
849
+ $receiver_type = $data['receiver_type'];
850
+ $receiver_linkedin_id = ((isset($data['receiver_linkedin_id']) && $data['receiver_linkedin_id'] != "") ? $data['receiver_linkedin_id'] : "-");
851
+ $receiver_facebook_id = ((isset($data['receiver_facebook_id']) && $data['receiver_facebook_id'] != "") ? $data['receiver_facebook_id'] : '-');
852
+
853
+ $_zipcodeAndState = $_cml24Helper->getMyIDShippingSafeRecipientAddress($_clm24Session, $_sender_email_address, $_receiver_email_address,$receiver_type,$receiver_linkedin_id,$receiver_facebook_id);
854
+ $temp_arr['max_shipping'] = '';
855
+ if (is_array($_zipcodeAndState) && !isset($_zipcodeAndState['zipcode'])) {
856
+ if (isset($_zipcodeAndState["status"]) && ($_zipcodeAndState["status"] == "520" || $_zipcodeAndState["status"] == "521")) {
857
+ $_zipcodeAndState = null;
858
+ } /* else {
859
+ $result['error'] = $_zipcodeAndState["status"];
860
+ throw new Exception("Invalid MyID Recipient");
861
+ } */
862
+ }
863
+ $resource = Mage::getSingleton('core/resource');
864
+ $readConnection = $resource->getConnection('core_read');
865
+ $writeConnection = $resource->getConnection('core_write');
866
+
867
+ $city = ((isset($data['city']) && $data['city'] <> '') ? $data['city'] : Mage::getStoreConfig('clm24core/shippings/city'));
868
+
869
+
870
+ $firstname = $data['firstname'];
871
+ $lastname = $data['lastname'];
872
+ //Mage::Log("Clm24 [Name ]: " . $firstname . ' ' . $lastname);
873
+
874
+ $country_code = ((isset($data['country_id']) && $data['country_id'] <> '') ? $data['country_id'] : Mage::getStoreConfig('clm24core/shippings/country_id'));
875
+
876
+ if (empty($_zipcodeAndState)) {
877
+ if (isset($data['postcode']) && $data['postcode'] != "") {
878
+ $_zipcode = $data['postcode'];
879
+ $session = Mage::getSingleton('checkout/session');
880
+ $session->unsetData('ship2myid_maxship');
881
+ } else {
882
+ $_zipcode = Mage::getStoreConfig('clm24core/shippings/defaultZipCode');
883
+ $session = Mage::getSingleton('checkout/session');
884
+ $temp_arr['max_shipping'] = 1;
885
+ $session->setData('ship2myid_maxship', $temp_arr);
886
+ }
887
+ } else {
888
+ if (is_array($_zipcodeAndState) && isset($_zipcodeAndState['zipcode'])) {
889
+ $_zipcode = $data['postcode'] = $_zipcodeAndState['zipcode'];
890
+ } else {
891
+ if (isset($data['postcode']) && $data['postcode'] != "") {
892
+ $_zipcode = $data['postcode'];
893
+ } else {
894
+ $_zipcode = Mage::getStoreConfig('clm24core/shippings/defaultZipCode');
895
+ }
896
+ }
897
+ $region_name = $data['region'] = $_zipcodeAndState['state'];
898
+ $country_code = $data['country_id'] = $_zipcodeAndState['country'];
899
+ $session = Mage::getSingleton('checkout/session');
900
+ $session->unsetData('ship2myid_maxship');
901
+ }
902
+
903
+ if (isset($region_name) && $region_name != "") {
904
+ $query = "SELECT region_id FROM directory_country_region_name WHERE name ='" . $region_name . "'";
905
+ $regionid = $readConnection->fetchOne($query);
906
+ if (isset($regionid) && $regionid != "") {
907
+ $region_id = $regionid;
908
+ } else {
909
+ $region_name = $region_name;
910
+ }
911
+ } elseif (isset($data['region']) && $data['region'] != "") {
912
+ $query = "SELECT region_id FROM directory_country_region_name WHERE name ='" . $data['region'] . "'";
913
+ $regionid = $readConnection->fetchOne($query);
914
+ if (isset($regionid) && $regionid != "") {
915
+ $region_id = $regionid;
916
+ } else {
917
+ $region_name = $data['region'];
918
+ }
919
+ } else {
920
+ $region_id = Mage::getStoreConfig('clm24core/shippings/region_id');
921
+ }
922
+ foreach ($data as $key => $value) {
923
+ $_quote->setData($key, $value);
924
+ }
925
+ $address = $_quote->getShippingAddress();
926
+ //$addressdata = $address->getData();
927
+ //Mage::Log("Clm24 [Quote Shipping Address]: City : " . $addressdata['city'] . ' @ Postcode : ' . $addressdata['postcode'] . ' @ region : ' . $addressdata['region']);
928
+
929
+ $addressForm = Mage::getModel('customer/form');
930
+ $addressForm->setFormCode('customer_address_edit')->setEntity($address)->setEntityType('customer_address')->setIsAjaxRequest(Mage::app()->getRequest()->isAjax());
931
+ $shippingaddr_data = $_cml24Helper->formatShippingData($firstname, $lastname, $_zipcode, $city, $region_id, $region_name, $country_code, $receiver_type, $receiver_linkedin_id, $receiver_facebook_id);
932
+ $addressData = $addressForm->extractData($addressForm->prepareRequest($shippingaddr_data));
933
+ $addressErrors = $addressForm->validateData($addressData);
934
+ //Mage::Log("Clm24 [Address]: " . print_r($addressData, true));
935
+ $addressForm->compactData($addressData);
936
+ $address->implodeStreetAddress();
937
+ $address->setCollectShippingRates(true);
938
+ if (($validateRes = $address->validate()) !== true) {
939
+ $result = array(
940
+ 'error' => 1,
941
+ 'message' => $validateRes
942
+ );
943
+ }
944
+ $_quote->collectTotals()->save();
945
+
946
+ //$address = $_quote->getShippingAddress();
947
+ //$addressdata = $address->getData();
948
+ //Mage::Log("Clm24 [Quote Shipping Address]: City : " . $addressdata['city'] . ' @ Postcode : ' . $addressdata['postcode'] . ' @ region : ' . $addressdata['region']);
949
+ //Mage::Log("Clm24 [Quote After Update]: " . print_r($_quote->getData(), true));
950
+ $_cml24Helper->closeMyIDSession($_clm24Session);
951
+ }
952
+
953
+ }
app/code/local/Xclm24/Myidshipping/LICENSE.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Open Software License ("OSL") v. 3.0
3
+
4
+ This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
+
6
+ Licensed under the Open Software License version 3.0
7
+
8
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
+
10
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11
+
12
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
+
14
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
15
+
16
+ 4. to perform the Original Work publicly; and
17
+
18
+ 5. to display the Original Work publicly.
19
+
20
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
+
22
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
+
24
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
+
26
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
+
28
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
+
30
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
+
32
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
+
34
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
+
36
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
+
38
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
+
40
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
+
42
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
+
44
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
+
46
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
+
48
+ 16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
app/code/local/Xclm24/Myidshipping/Model/Api/Nvp.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping PayPal NVP API Model
23
+ *
24
+ */
25
+ class Xclm24_Myidshipping_Model_Api_Nvp extends Mage_Paypal_Model_Api_Nvp {
26
+
27
+ /**
28
+ * call express checkout
29
+ *
30
+ */
31
+
32
+ public function callSetExpressCheckout()
33
+ {
34
+ $this->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest);
35
+ $request = $this->_exportToRequest($this->_setExpressCheckoutRequest);
36
+ $this->_exportLineItems($request);
37
+
38
+ // import/suppress shipping address, if any
39
+ $options = $this->getShippingOptions();
40
+ if ($this->getAddress()) {
41
+ $request = $this->_importAddresses($request);
42
+ //paypal fix
43
+ $request['ADDROVERRIDE'] = 0;
44
+ } elseif ($options && (count($options) <= 10)) { // doesn't support more than 10 shipping options
45
+ $request['CALLBACK'] = $this->getShippingOptionsCallbackUrl();
46
+ $request['CALLBACKTIMEOUT'] = 6; // max value
47
+ $request['MAXAMT'] = $request['AMT'] + 999.00; // it is impossible to calculate max amount
48
+ $this->_exportShippingOptions($request);
49
+ }
50
+
51
+ // add recurring profiles information
52
+ $i = 0;
53
+ foreach ($this->_recurringPaymentProfiles as $profile) {
54
+ $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments';
55
+ $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $profile->getScheduleDescription();
56
+ $i++;
57
+ }
58
+
59
+ $response = $this->call(self::SET_EXPRESS_CHECKOUT, $request);
60
+ $this->_importFromResponse($this->_setExpressCheckoutResponse, $response);
61
+
62
+ }
63
+
64
+ }
app/code/local/Xclm24/Myidshipping/Model/Api/Standard.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping PayPal Standard API Model
23
+ *
24
+ */
25
+ class Xclm24_Myidshipping_Model_Api_Standard extends Mage_Paypal_Model_Api_Standard
26
+ {
27
+
28
+ /**
29
+ * Import Address
30
+ * @param Array Reference
31
+ *
32
+ */
33
+ protected function _importAddress(&$request)
34
+ {
35
+ $address = $this->getAddress();
36
+ if (!$address) {
37
+ if ($this->getNoShipping()) {
38
+ $request['no_shipping'] = 1;
39
+ }
40
+ return;
41
+ }
42
+
43
+ $request = Varien_Object_Mapper::accumulateByMap($address, $request, array_flip($this->_addressMap));
44
+
45
+ // Address may come without email info (user is not always required to enter it), so add email from order
46
+ if (!$request['email']) {
47
+ $order = $this->getOrder();
48
+ if ($order) {
49
+ $request['email'] = $order->getCustomerEmail();
50
+ }
51
+ }
52
+
53
+ $regionCode = $this->_lookupRegionCodeFromAddress($address);
54
+ if ($regionCode) {
55
+ $request['state'] = $regionCode;
56
+ }
57
+ $this->_importStreetFromAddress($address, $request, 'address1', 'address2');
58
+ $this->_applyCountryWorkarounds($request);
59
+
60
+ //paypal fix for standard paypal options.
61
+ $request['address_override'] = 0;
62
+ //no need for shipping address
63
+ $request['no_shipping'] = 1;
64
+ }
65
+
66
+ }
app/code/local/Xclm24/Myidshipping/Model/Coupon.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping Coupon Model
23
+ *
24
+ */
25
+ class Xclm24_Myidshipping_Model_Coupon extends Mage_SalesRule_Model_Coupon
26
+ {
27
+ /**
28
+ * Constructor for Coupon model
29
+ *
30
+ */
31
+ public function _construct()
32
+ {
33
+ parent::_construct();
34
+ $this->_init('myidshipping/coupon');
35
+ }
36
+
37
+ /**
38
+ * Load Model By Rule Id
39
+ * @param Strinng $rule_entity_id
40
+ * @return Xclm24_Myidshipping_Model_Shipping
41
+ *
42
+ */
43
+ public function loadByRuleId($rule_entity_id)
44
+ {
45
+ $this->_getResource()->loadByRuleId($this, $rule_entity_id);
46
+ return $this;
47
+ }
48
+ }
app/code/local/Xclm24/Myidshipping/Model/Cron.php ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping CRON Model
23
+ *
24
+ */
25
+
26
+ class Xclm24_Myidshipping_Model_Cron extends Mage_Core_Model_Abstract
27
+ {
28
+
29
+ /**
30
+ * Constructor for Cron
31
+ *
32
+ */
33
+
34
+ protected function _construct() {
35
+ parent::_construct();
36
+ $this->_init('myidshipping/cron');
37
+ }
38
+
39
+ /**
40
+ * Get Order updates from Ship2MyId Server for pending orders
41
+ *
42
+ */
43
+
44
+ public function scheduler() {
45
+ $_cml24Helper = Mage::Helper('myidshipping');
46
+ $clm24_token = $_cml24Helper->getMyIDSession();
47
+
48
+ // 0: Pending, 1: Accepted, 2: Rejected, 3: Completed
49
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
50
+ ->addFieldToFilter('main_table.order_status_id', array('eq' => 0));
51
+
52
+ $orderData = $clm24_model->getData();
53
+ foreach ($orderData as $result) {
54
+ $entityId = $result['entity_id'];
55
+ $orderId = $result['order_id'];
56
+ //$customerId = $result['customer_id'];
57
+ $realorderId = $result['real_order_id'];
58
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
59
+ Mage::log('orderid:' . $orderId);
60
+ Mage::log('orderid:' . $realorderId);
61
+ }
62
+ if (!empty($realorderId)) {
63
+ $_clm24Order = $_cml24Helper->checkOrder($clm24_token, $realorderId);
64
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
65
+ Mage::log('realorderId:');
66
+ Mage::log('$realorderId: ' . implode(',', $_clm24Order));
67
+ Mage::log('clmorder array:' . zend_debug::dump($_clm24Order));
68
+ }
69
+ $tele = "NIL";
70
+ if (isset($_clm24Order["status"])) {
71
+ $_message = $_clm24Order["message"];
72
+ Mage::Log(__METHOD__ . ' :: ' . __LINE__ . " " . $_message);
73
+ } else {
74
+ // Prepare the Order Object
75
+ // Load the Order
76
+ $order = Mage::getModel('sales/order')
77
+ ->getCollection()
78
+ ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
79
+ ->addAttributeToFilter('increment_id', $orderId)
80
+ ->getFirstItem();
81
+
82
+ $_order_status_id = 0;
83
+
84
+ // Do we have any response
85
+ if ($order->getId()):
86
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
87
+ Mage::log('Order found: ' . $order->getId());
88
+ }
89
+ if ($_clm24Order["is_order_accepted"] == "true") {
90
+ $_order_status_id = 1;
91
+ $newOrderStatus = Mage::getStoreConfig('clm24core/shippings/order_status');
92
+ if ($newOrderStatus == 'processing') {
93
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
94
+ }
95
+ // We need to update the ship to Address too
96
+ $clm24_shippingmodel = Mage::getModel('sales/order_address')->load($order->getShippingAddressId());
97
+ $regionModel = Mage::getModel('directory/region')->loadByCode($_clm24Order["state"], $_clm24Order["countryCode"]);
98
+ $regionId = $regionModel->getId();
99
+
100
+ if ($_clm24Order["phoneNumber"])
101
+ $tele = $_clm24Order["phoneNumber"];
102
+ else
103
+ $tele = "NIL";
104
+
105
+ $_shipping = Array
106
+ (
107
+ // [address_id] => 0
108
+ "entity_id" => $order->getShippingAddressId(),
109
+ "parent_id" => $clm24_shippingmodel->getData("parent_id"),
110
+ "firstname" => ($_clm24Order["receiver_first_name"] ? $_clm24Order["receiver_first_name"] : '' ),
111
+ "lastname" => ($_clm24Order["receiver_last_name"] ? $_clm24Order["receiver_last_name"] : ''),
112
+ "company" => "",
113
+ "street" => $_clm24Order["address_1"] . ' ' . $_clm24Order["address_2"],
114
+ "city" => $_clm24Order["city"],
115
+ "region_id" => $regionId,
116
+ "region" => $_clm24Order["stateName"],
117
+ "postcode" => $_clm24Order["zipcode"],
118
+ "country_id" => $_clm24Order["countryCode"],
119
+ "telephone" => $_clm24Order["receiver_telephone"],
120
+ "fax" => "",
121
+ "address_type" => "shipping"
122
+ );
123
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
124
+ Mage::log('shipping array:' . $_shipping);
125
+ }
126
+ $clm24_shippingmodel->setData($_shipping)->save();
127
+
128
+ $resource = Mage::getSingleton('core/resource');
129
+ $writeConnection = $resource->getConnection('core_write');
130
+ $table = $resource->getTableName('myidshipping/shipping');
131
+
132
+ $queryfirst = "Update " . $table . " set value='" . $_clm24Order["receiver_first_name"] . "' where order_grid_id ='" . $entityId . "' and (attribute ='firstname' or attribute ='receiver_first_name')";
133
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
134
+ Mage::log('update_first:' . $queryfirst);
135
+ }
136
+ $writeConnection->query($queryfirst);
137
+
138
+ $querylast = "Update " . $table . " set value='" . $_clm24Order["receiver_last_name"] . "' where order_grid_id ='" . $entityId . "' and (attribute ='lastname' or attribute ='receiver_last_name')";
139
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
140
+ Mage::log('update_last:' . $querylast);
141
+ }
142
+ $writeConnection->query($querylast);
143
+
144
+ $query = "Update " . $table . " set value='" . $tele . "' where order_grid_id ='" . $entityId . "' and attribute ='r_telephone' ";
145
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
146
+ Mage::log('update_telephone:' . $query);
147
+ }
148
+ $writeConnection->query($query);
149
+ }
150
+
151
+ if ($_clm24Order["is_order_rejected"] == "true") {
152
+ $_order_status_id = 2;
153
+ /**
154
+ * change order status to 'Holded' or 'Canceled' according to config
155
+ */
156
+ $rejectedOrderStatus = Mage::getStoreConfig('clm24core/shippings/rejected_order_status');
157
+ if ($rejectedOrderStatus == 'canceled') {
158
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, $_clm24Order["receiver_rejected_note"])->save();
159
+ } else {
160
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true, $_clm24Order["receiver_rejected_note"])->save();
161
+ }
162
+ }
163
+
164
+ // Save the data
165
+ $_data = array(
166
+ "entity_id" => $entityId,
167
+ "order_status_id" => $_order_status_id,
168
+ /* "receiver_telephone"=> $tele, */
169
+ "updated_at" => date('Y-m-d H:i:s')
170
+ );
171
+
172
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")
173
+ ->setData($_data)
174
+ ->save();
175
+ else:
176
+ Mage::log('order not found');
177
+ endif;
178
+ }
179
+ } else {
180
+
181
+ }
182
+ }
183
+
184
+ $_cml24Helper->closeMyIDSession($clm24_token);
185
+ }
186
+
187
+ /**
188
+ * Cancel Order at Ship2MyId Server
189
+ *
190
+ */
191
+ public function croncancelorder() {
192
+ $_cml24Helper = Mage::Helper('myidshipping');
193
+ $clm24_token = $_cml24Helper->getMyIDSession();
194
+
195
+ // 0: Pending, 1: Accepted, 2: Rejected, 3: Completed , 4: Canceled, 100:cancel_failed
196
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
197
+ ->addFieldToFilter('main_table.order_status_id', array('eq' => 100));
198
+
199
+ $orderData = $clm24_model->getData();
200
+ foreach ($orderData as $result) {
201
+ $entityId = $result['entity_id'];
202
+ $orderId = $result['order_id'];
203
+ // $customerId = $result['customer_id'];
204
+ $realorderId = $result['real_order_id'];
205
+
206
+ $_clm24Order = $_cml24Helper->cancelOrder($clm24_token, $orderId);
207
+ }
208
+ $_cml24Helper->closeMyIDSession($clm24_token);
209
+ }
210
+
211
+ /**
212
+ * Get Order updates from Ship2MyId Server for pending orders with batch
213
+ *
214
+ */
215
+
216
+ public function batchscheduler() {
217
+
218
+ $_cml24Helper = Mage::Helper('myidshipping');
219
+ $clm24_token = $_cml24Helper->getMyIDSession();
220
+ // 0: Pending, 1: Accepted, 2: Rejected, 3: Completed
221
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
222
+ ->addFieldToFilter('main_table.order_status_id', array('eq' => 0))
223
+ ->addFieldToFilter('main_table.real_order_id', array('neq' => ''));
224
+
225
+ $orderData = $clm24_model->getData();
226
+
227
+ $real_order_ids = array();
228
+ $process_orders = array();
229
+ if (count($orderData)) {
230
+ foreach ($orderData as $k => $oData) {
231
+ if ($oData['real_order_id'] != '') {
232
+ $real_order_ids[] = $oData['real_order_id']; //['order_id_list']
233
+ $process_orders[$oData['real_order_id']] = $oData;
234
+ unset($orderData[$k]);
235
+ }
236
+ }
237
+ }
238
+ $orderData = null;
239
+
240
+ if (count($real_order_ids)) {
241
+ $batch_real_order_ids = array_chunk($real_order_ids, 50);
242
+ }
243
+
244
+ if (count($batch_real_order_ids)) {
245
+ foreach ($batch_real_order_ids as $order_ids) {
246
+ if (count($order_ids)) {
247
+ $_orderStatus = $_cml24Helper->checkOrderStatus($clm24_token, array('order_id_list' => $order_ids), 'both');
248
+ if (!empty($_orderStatus) && is_array($_orderStatus)) {
249
+ if (isset($_orderStatus['accepted_order']) && is_array($_orderStatus['accepted_order']) && count($_orderStatus['accepted_order'])) {
250
+ foreach ($_orderStatus['accepted_order'] as $_oid) {
251
+ if (isset($process_orders[$_oid])) {
252
+
253
+ $_accp_order = $process_orders[$_oid];
254
+ $entityId = $_accp_order['entity_id'];
255
+ $orderId = $_accp_order['order_id'];
256
+ $realorderId = $_accp_order['real_order_id'];
257
+ if (!empty($realorderId)) {
258
+ $_clm24Order = $_cml24Helper->checkOrder($clm24_token, $realorderId);
259
+ $tele = "NIL";
260
+ if (isset($_clm24Order["status"])) {
261
+ $_message = $_clm24Order["message"];
262
+ Mage::Log(__METHOD__ . ' :: ' . __LINE__ . " " . $_message);
263
+ } else {
264
+ $order = Mage::getModel('sales/order')
265
+ ->getCollection()
266
+ ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
267
+ ->addAttributeToFilter('increment_id', $orderId)
268
+ ->getFirstItem();
269
+ $_order_status_id = 0;
270
+ // Do we have any response
271
+ if ($order->getId()) {
272
+ if ($_clm24Order["is_order_accepted"] == "true") {
273
+ $_order_status_id = 1;
274
+ $newOrderStatus = Mage::getStoreConfig('clm24core/shippings/order_status');
275
+ if ($newOrderStatus == 'processing') {
276
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
277
+ }
278
+ // We need to update the ship to Address too
279
+ $clm24_shippingmodel = Mage::getModel('sales/order_address')->load($order->getShippingAddressId());
280
+ $regionModel = Mage::getModel('directory/region')->loadByCode($_clm24Order["state"], $_clm24Order["countryCode"]);
281
+ $regionId = $regionModel->getId();
282
+
283
+ if ($_clm24Order["phoneNumber"])
284
+ $tele = $_clm24Order["phoneNumber"];
285
+ else
286
+ $tele = "NIL";
287
+
288
+ $_shipping = Array
289
+ (
290
+ // [address_id] => 0
291
+ "entity_id" => $order->getShippingAddressId(),
292
+ "parent_id" => $clm24_shippingmodel->getData("parent_id"),
293
+ "firstname" => ($_clm24Order["receiver_first_name"] ? $_clm24Order["receiver_first_name"] : '' ),
294
+ "lastname" => ($_clm24Order["receiver_last_name"] ? $_clm24Order["receiver_last_name"] : ''),
295
+ "company" => "",
296
+ "street" => $_clm24Order["address_1"] . ' ' . $_clm24Order["address_2"],
297
+ "city" => $_clm24Order["city"],
298
+ "region_id" => $regionId,
299
+ "region" => $_clm24Order["stateName"],
300
+ "postcode" => $_clm24Order["zipcode"],
301
+ "country_id" => $_clm24Order["countryCode"],
302
+ "telephone" => $_clm24Order["receiver_telephone"],
303
+ "fax" => "",
304
+ "address_type" => "shipping"
305
+ );
306
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
307
+ Mage::log('shipping array:' . $_shipping);
308
+ }
309
+ $clm24_shippingmodel->setData($_shipping)->save();
310
+
311
+ $resource = Mage::getSingleton('core/resource');
312
+ $writeConnection = $resource->getConnection('core_write');
313
+ $table = $resource->getTableName('myidshipping/shipping');
314
+
315
+ $queryfirst = "Update " . $table . " set value='" . $_clm24Order["receiver_first_name"] . "' where order_grid_id ='" . $entityId . "' and (attribute ='firstname' or attribute ='receiver_first_name')";
316
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
317
+ Mage::log('update_first:' . $queryfirst);
318
+ }
319
+ $writeConnection->query($queryfirst);
320
+
321
+ $querylast = "Update " . $table . " set value='" . $_clm24Order["receiver_last_name"] . "' where order_grid_id ='" . $entityId . "' and (attribute ='lastname' or attribute ='receiver_last_name')";
322
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
323
+ Mage::log('update_last:' . $querylast);
324
+ }
325
+ $writeConnection->query($querylast);
326
+
327
+ $query = "Update " . $table . " set value='" . $tele . "' where order_grid_id ='" . $entityId . "' and attribute ='r_telephone' ";
328
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
329
+ Mage::log('update_telephone:' . $query);
330
+ }
331
+ $writeConnection->query($query);
332
+
333
+ // Save the data
334
+ $_data = array(
335
+ "entity_id" => $entityId,
336
+ "order_status_id" => $_order_status_id,
337
+ /* "receiver_telephone"=> $tele, */
338
+ "updated_at" => date('Y-m-d H:i:s')
339
+ );
340
+
341
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")
342
+ ->setData($_data)
343
+ ->save();
344
+ }
345
+ }else {
346
+ Mage::log('order not found');
347
+ }
348
+ $order = null;
349
+ }
350
+ $_clm24Order = null;
351
+ }
352
+ } else {
353
+ continue;
354
+ }
355
+ }
356
+ }
357
+ if (isset($_orderStatus['rejected_order']) && is_array($_orderStatus['rejected_order']) && count($_orderStatus['rejected_order'])) {
358
+ foreach ($_orderStatus['rejected_order'] as $_oid) {
359
+ if (isset($process_orders[$_oid['order_id']])) {
360
+ $_rej_order = $process_orders[$_oid['order_id']];
361
+ $entityId = $_rej_order['entity_id'];
362
+ $orderId = $_rej_order['order_id'];
363
+ $realorderId = $_rej_order['real_order_id'];
364
+ if (!empty($realorderId)) {
365
+ $_order_status_id = 2;
366
+ $order = Mage::getModel('sales/order')->load()
367
+ ->getCollection()
368
+ ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
369
+ ->addAttributeToFilter('increment_id', $orderId)
370
+ ->getFirstItem();
371
+
372
+ if ($order->getId()) {
373
+ $rejectedOrderStatus = Mage::getStoreConfig('clm24core/shippings/rejected_order_status');
374
+ if ($rejectedOrderStatus == 'canceled') {
375
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, $_clm24Order["receiver_rejected_note"])->save();
376
+ } else {
377
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true, $_clm24Order["receiver_rejected_note"])->save();
378
+ }
379
+
380
+ $_data = array(
381
+ "entity_id" => $entityId,
382
+ "order_status_id" => $_order_status_id,
383
+ /* "receiver_telephone"=> $tele, */
384
+ "updated_at" => date('Y-m-d H:i:s')
385
+ );
386
+
387
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")
388
+ ->setData($_data)
389
+ ->save();
390
+ }
391
+ }
392
+ } else {
393
+ continue;
394
+ }
395
+ }
396
+ }
397
+ }
398
+ }
399
+ }
400
+ }
401
+ $_cml24Helper->closeMyIDSession($clm24_token);
402
+ }
403
+
404
+ }
app/code/local/Xclm24/Myidshipping/Model/Mysql4/Coupon.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Mysql4_Coupon extends Mage_Core_Model_Mysql4_Abstract
22
+ {
23
+ /**
24
+ * Constructor for Shipping Model
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/coupon', 'entity_id');
30
+ }
31
+
32
+
33
+
34
+
35
+ }
app/code/local/Xclm24/Myidshipping/Model/Mysql4/Coupon/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Coupon Data Collection
23
+ *
24
+ */
25
+ class Xclm24_Myidshipping_Model_Mysql4_Coupon_Collection extends Mage_GiftMessage_Model_Resource_Message_Collection
26
+ {
27
+ }
app/code/local/Xclm24/Myidshipping/Model/Mysql4/Ordergrid.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ class Xclm24_Myidshipping_Model_Mysql4_Ordergrid extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ /**
23
+ * Constructor for Ordergird Model
24
+ *
25
+ */
26
+ protected function _construct()
27
+ {
28
+ $this->_init('myidshipping/ordergrid', 'entity_id');
29
+ }
30
+
31
+
32
+
33
+
34
+ }
app/code/local/Xclm24/Myidshipping/Model/Mysql4/Ordergrid/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Order Grid Data Collection
23
+ *
24
+ */
25
+ class Xclm24_Myidshipping_Model_Mysql4_Ordergrid_Collection extends Mage_GiftMessage_Model_Resource_Message_Collection
26
+ {
27
+ }
app/code/local/Xclm24/Myidshipping/Model/Mysql4/Shipping.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ class Xclm24_Myidshipping_Model_Mysql4_Shipping extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ /**
23
+ * Constructor for Shipping Model
24
+ *
25
+ */
26
+ protected function _construct()
27
+ {
28
+ $this->_init('myidshipping/shipping', 'entity_id');
29
+ }
30
+
31
+
32
+
33
+
34
+ }
app/code/local/Xclm24/Myidshipping/Model/Mysql4/Shipping/Collection.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * shipping Data Collection
23
+ *
24
+ */
25
+ class Xclm24_Myidshipping_Model_Mysql4_Shipping_Collection extends Mage_GiftMessage_Model_Resource_Message_Collection
26
+ {
27
+ }
app/code/local/Xclm24/Myidshipping/Model/Observer.php ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping Observer Model
23
+ *
24
+ */
25
+
26
+ class Xclm24_Myidshipping_Model_Observer
27
+ {
28
+
29
+ /**
30
+ * After Submiting Billing Data, This Method called
31
+ * to set the Shipping Details
32
+ *
33
+ * @param Varien_Event_Observer $observer
34
+ * @return Varien_Event_Observer $observer
35
+ */
36
+
37
+ public function billingPostDispatch($observer)
38
+ {
39
+ if ($observer->getEvent()->getControllerAction()->getFullActionName() == "checkout_onepage_saveBilling") {
40
+ $session = Mage::getSingleton('checkout/session');
41
+ $sdata = $session->getData('ship2myid');
42
+ $billingpostdata = $observer->getEvent()->getControllerAction()->getRequest()->getPost('billing', array());
43
+ $is_ship2myid_order_flag = $observer->getEvent()->getControllerAction()->getRequest()->getPost('is_ship2myid_order_flag');
44
+
45
+ if (isset($sdata) && $sdata != "NULL" && $is_ship2myid_order_flag == 1) {
46
+ $session = Mage::getSingleton('checkout/session');
47
+ $session->setData('use_mapmyid', 1);
48
+ /* $checkout = Mage::getSingleton('checkout/session')->getQuote();
49
+ $billAddress = $checkout->getBillingAddress();
50
+ $billAddress->setData('use_for_shipping',1);
51
+ $billAddress->save(); */
52
+ $controller = $observer->getControllerAction();
53
+ $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
54
+ $_cml24Helper = Mage::Helper('myidshipping');
55
+ $_cml24Helper->saveMyidshipping();
56
+ $result['goto_section'] = 'shipping_method';
57
+ $result['update_section'] = array(
58
+ 'name' => 'shipping-method',
59
+ 'html' => $this->_getShippingMethodsHtml()
60
+ );
61
+ $result['allow_sections'] = array('shipping');
62
+ $result['duplicateBillingInfo'] = 'true';
63
+ $controller->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
64
+ } else {
65
+ $session = Mage::getSingleton('checkout/session');
66
+ $session->setData('use_mapmyid', 0);
67
+ $session->unsShip2myid();
68
+ }
69
+ /*
70
+ $checkout = Mage::getSingleton('checkout/session')->getQuote();
71
+ $billAddress = $checkout->getShippingAddress();
72
+ Zend_Debug::dump($billAddress->getData());
73
+ exit;
74
+ */
75
+ }
76
+ return $observer;
77
+ }
78
+
79
+ /**
80
+ * Return the Shipping Method HTML
81
+ *
82
+ * @return String
83
+ */
84
+
85
+ public function _getShippingMethodsHtml() {
86
+ $layout = Mage::app()->getLayout();
87
+ $update = $layout->getUpdate();
88
+ $update->load('checkout_onepage_shippingmethod');
89
+ $layout->generateXml();
90
+ $layout->generateBlocks();
91
+ $output = $layout->getOutput();
92
+ return $output;
93
+ }
94
+
95
+ //Ship2myid only rule saving to db
96
+
97
+ /**
98
+ * This Event call after applying Coupon code
99
+ * Only for Ship2MyId Coupon code
100
+ *
101
+ * @param Varien_Event_Observer $observer
102
+ */
103
+
104
+ public function setShip2myidOnlyCoupon(Varien_Event_Observer $observer) {
105
+ $salesruleSaveRequest = $observer->getEvent()->getRequest();
106
+ $salerulePostData = $observer->getEvent()->getData();
107
+ $salerulePostData = $salerulePostData['data_object']->getdata();
108
+ /* zend_debug::dump($salerulePostData['data_object']->getdata());
109
+ exit; */
110
+ $clm24myidCouponModel = Mage::getModel('myidshipping/coupon')->loadByRuleId($salerulePostData['rule_id']);
111
+ if ($clm24myidCouponModel->getData()) {
112
+ $clm24myidCouponModel->setShip2myidOnly($salerulePostData['ship2myid_only'])->save();
113
+ } else {
114
+ $clm24RuleData = array(
115
+ "rule_id" => $salerulePostData['rule_id'],
116
+ "ship2myid_only" => $salerulePostData['ship2myid_only']
117
+ );
118
+ //zend_debug::dump($clm24RuleData);
119
+ //exit;
120
+ $clm24myidCouponModel->setData($clm24RuleData)->save();
121
+ }
122
+ }
123
+
124
+ //paypal fix - order status for ship2myid orders
125
+
126
+ /**
127
+ * After Order Save this event get called
128
+ *
129
+ * @param Varien_Event_Observer $observer
130
+ */
131
+
132
+ public function salesOrderSaveAfter(Varien_Event_Observer $observer) {
133
+ $order = $observer->getEvent()->getOrder(); // get order data
134
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
135
+ ->addFieldToFilter('main_table.order_id', array('eq' => $order->getIncrementId()));
136
+ $orderData = $clm24_model->getData();
137
+ $_code = $order->getPayment()->getMethodInstance()->getCode();
138
+ if (count($orderData) > 0 && (stripos($_code, "paypal") !== false || stripos($_code, "payflow") !== false || stripos($_code, "verisign") !== false || stripos($_code, "paypaluk") !== false )) {
139
+ $clm24_modelData = $orderData[0];
140
+ $rejectedOrderStatus = Mage::getStoreConfig('clm24core/shippings/rejected_order_status');
141
+ if ($rejectedOrderStatus != 'canceled') {
142
+ $rejectedOrderStatus = 'holded';
143
+ }
144
+ if (($clm24_modelData['order_status_id'] == 2 || $clm24_modelData['order_status_id'] == 4 || $clm24_modelData['order_status_id'] == 100) && $order->getState() != $rejectedOrderStatus) {
145
+ if ($rejectedOrderStatus == 'canceled') {
146
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
147
+ } else {
148
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)->save();
149
+ }
150
+ }
151
+ // Enforce Pending order status for Ship2MyID orders before accept/reject
152
+ if ($clm24_modelData['order_status_id'] == 0 && $order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING && Mage::getStoreConfig('clm24core/shippings/ship2myid_order_status')) {
153
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
154
+ }
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Check Payment Methods
160
+ *
161
+ * @param Varien_Event_Observer $observer
162
+ */
163
+
164
+ public function paymentMethodCheck(Varien_Event_Observer $observer) {
165
+ if (Mage::getStoreConfig('clm24core/shippings/enabled')) {
166
+
167
+ $event = $observer->getEvent();
168
+ $method = $event->getMethodInstance();
169
+ $result = $event->getResult();
170
+ $session = Mage::getSingleton('checkout/session');
171
+ $_clm24Data = $session->getData('ship2myid');
172
+ $use_mapmyid = $session->getData('use_mapmyid');
173
+ if (!empty($_clm24Data) && isset($_clm24Data['email']) && $_clm24Data['email'] <> '' && $use_mapmyid) {
174
+ if ($method->getCode() == 'paypal_express') {
175
+ $result->isAvailable = false;
176
+ }
177
+ }
178
+ }
179
+ }
180
+
181
+ /**
182
+ * After Order Place this event get called
183
+ *
184
+ * @param Varien_Event_Observer $observer
185
+ */
186
+
187
+ public function salesOrderPlaceAfter($observer) {
188
+ if (Mage::getStoreConfig('clm24core/shippings/enabled')) {
189
+ //get the event and pull the URL object and the storeId from the event.
190
+ $_event = $observer->getEvent();
191
+ $_urlObject = $_event->getUrlObject();
192
+ $_storeId = $_event->getStoreId();
193
+
194
+ $order = $observer->getOrder();
195
+ // Get session data
196
+ $session = Mage::getSingleton('checkout/session');
197
+ $_clm24Data = $session->getData('ship2myid');
198
+ Mage::getSingleton('core/session')->setShip2myid($_clm24Data);
199
+ if (!empty($_clm24Data) && isset($_clm24Data['email']) && $_clm24Data['email'] <> '') {
200
+ // Now we need to get the order_id, customer_id, store_id, clm24_token, real_order_id, order_status_id
201
+ $_order_id = $order->getRealOrderId();
202
+ $_customer_id = $order->getCustomerId();
203
+ if (empty($_customer_id)) {
204
+ // We have guest
205
+ $_customer_id = NULL;
206
+ }
207
+ $_store_id = $order->getStoreId();
208
+ // Set the Order Status ID
209
+ // 0: Pending, 1: Accepted, 2: Rejected, 3: Completed 4:Canceled
210
+ $_order_status_id = 0;
211
+ // change status for ship2myid orders when used credit card
212
+ if (Mage::getStoreConfig('clm24core/shippings/ship2myid_order_status')) {
213
+ $order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
214
+ }
215
+ // Now get the Clm24 Token and submit the order
216
+ $_cml24Helper = Mage::Helper('myidshipping');
217
+ $clm24_token = $_cml24Helper->getMyIDSession();
218
+ $_clm24Order = $_cml24Helper->submitOrder($clm24_token, $order, $_clm24Data);
219
+ //zend_debug::dump($_clm24Order);
220
+ //zend_debug::dump($_clm24Data);
221
+ //exit;
222
+ $_cml24Helper->closeMyIDSession($clm24_token);
223
+ //Zend_debug::Dump($_clm24Order);
224
+ //exit;
225
+ if (isset($_clm24Order["status"])) {
226
+ $_message = $_clm24Order["message"];
227
+ Mage::throwException($_message);
228
+ } else {
229
+ // Do we have any response
230
+ if ($_clm24Order["is_order_accepted"] == "true") {
231
+ $_order_status_id = 1;
232
+ $newOrderStatus = Mage::getStoreConfig('clm24core/shippings/order_status');
233
+ if ($newOrderStatus == 'processing') {
234
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
235
+ }
236
+ // We need to update the ship to Address too
237
+ // "receiver_first_name":"John ","receiver_last_name":"Lee","address_1":"2367 Magnolia Bridge Dr","city":"San Ramon","state":"CA","country":"US","zipcode":"94582"
238
+ // Update the shipping address
239
+ $clm24_shippingmodel = Mage::getModel('sales/order_address')->load($order->getShippingAddressId());
240
+ $regionModel = Mage::getModel('directory/region')->loadByCode($_clm24Order["state"], $_clm24Order["countryCode"]);
241
+ $regionId = $regionModel->getId();
242
+ if ($_clm24Order["phoneNumber"])
243
+ $tele = $_clm24Order["phoneNumber"];
244
+ else
245
+ $tele = "NIL";
246
+ $_confir_ship2 = Mage::getStoreConfig('clm24core/shippings/ship2myid_label');
247
+ $_shipping = Array
248
+ (
249
+ // [address_id] => 0
250
+ "entity_id" => $order->getShippingAddressId(),
251
+ "parent_id" => $clm24_shippingmodel->getData("parent_id"),
252
+ "firstname" => $_clm24Order["receiver_first_name"],
253
+ "lastname" => $_clm24Order["receiver_last_name"],
254
+ "company" => "",
255
+ "street" => $_clm24Order["address_1"] . " " . $_clm24Order["address_2"],
256
+ "city" => $_clm24Order["city"],
257
+ "region_id" => $regionId,
258
+ "region" => $_clm24Order["stateName"],
259
+ "postcode" => $_clm24Order["zipcode"],
260
+ "country_id" => $_clm24Order["countryCode"],
261
+ "telephone" => $_clm24Data["telephone"],
262
+ "fax" => "",
263
+ "address_type" => "shipping"
264
+ );
265
+ $clm24_shippingmodel->setData($_shipping)->save();
266
+ //set Max shipping flag for guest users
267
+ // Get session data
268
+ $session = Mage::getSingleton('checkout/session');
269
+ $_clm24Data_max = $session->getData('ship2myid_maxship');
270
+ //Zend_Debug::Dump($_clm24Data_max);
271
+ //exit;
272
+ $maindata = array();
273
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
274
+ Mage::Log("Clm24 [Observer_max_shipping]: " . print_r($_clm24Data_max, true));
275
+ }
276
+ if ($_clm24Data_max['max_shipping']) {
277
+ $_datagrid = array(
278
+ "order_id" => $_order_id,
279
+ "real_order_id" => $_clm24Order["id"],
280
+ "max_shipment" => 1,
281
+ "order_group_id" => $_clm24Order["external_order_group_id"],
282
+ "order_status_id" => $_order_status_id,
283
+ "created_at" => date('Y-m-d H:i:s'),
284
+ "updated_at" => date('Y-m-d H:i:s')
285
+ );
286
+ } else {
287
+ $_datagrid = array(
288
+ "order_id" => $_order_id,
289
+ "real_order_id" => $_clm24Order["id"],
290
+ "max_shipment" => 0,
291
+ "order_group_id" => $_clm24Order["external_order_group_id"],
292
+ "order_status_id" => $_order_status_id,
293
+ "created_at" => date('Y-m-d H:i:s'),
294
+ "updated_at" => date('Y-m-d H:i:s')
295
+ );
296
+ }
297
+ $clm24_model_grid = Mage::getModel("myidshipping/ordergrid")->setData($_datagrid)
298
+ ->save();
299
+ foreach ($_clm24Order as $key => $value) {
300
+ $_data = array(
301
+ "order_grid_id" => $clm24_model_grid->getEntityId(),
302
+ "attribute" => $key,
303
+ "value" => $value,
304
+ );
305
+ array_push($maindata, $_data);
306
+ }
307
+ $_data = array(
308
+ "order_grid_id" => $clm24_model_grid->getEntityId(),
309
+ "attribute" => 'r_telephone',
310
+ "value" => $tele,
311
+ );
312
+ array_push($maindata, $_data);
313
+ $clm24_model = Mage::getModel("myidshipping/shipping");
314
+ foreach ($maindata as $data) {
315
+ $clm24_model->setData($data)
316
+ ->save();
317
+ }
318
+ }
319
+ if ($_clm24Order["is_order_rejected"] == "true") {
320
+ $_order_status_id = 2;
321
+ /**
322
+ * change order status to 'Holded' or 'Canceled' according to config
323
+ */
324
+ $rejectedOrderStatus = Mage::getStoreConfig('clm24core/shippings/rejected_order_status');
325
+ if ($rejectedOrderStatus == 'canceled') {
326
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, $_clm24Order["receiver_rejected_note"])->save();
327
+ } else {
328
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true, $_clm24Order["receiver_rejected_note"])->save();
329
+ }
330
+ $_cml24Helper->cancelOrder($clm24_token, $order->getIncrementId());
331
+ }
332
+ if ($_clm24Order["is_order_accepted"] == "false") {
333
+ //our popup data saved to table
334
+ //set Max shipping flag for guest users
335
+ // Get session data
336
+ $session = Mage::getSingleton('checkout/session');
337
+ $_clm24Data_max = $session->getData('ship2myid_maxship');
338
+ //Zend_Debug::Dump($_clm24Data_max);
339
+ //exit;
340
+ if ($_clm24Order["phoneNumber"])
341
+ $tele = $_clm24Order["phoneNumber"];
342
+ else
343
+ $tele = "NIL";
344
+
345
+ $maindata = array();
346
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
347
+ Mage::Log("Clm24 [Observer_max_shipping]: " . print_r($_clm24Data_max, true));
348
+ }
349
+ if ($_clm24Data_max['max_shipping']) {
350
+ $_datagrid = array(
351
+ "order_id" => $_order_id,
352
+ "real_order_id" => $_clm24Order["id"],
353
+ "max_shipment" => 1,
354
+ "order_group_id" => $_clm24Order["external_order_group_id"],
355
+ "order_status_id" => $_order_status_id,
356
+ "created_at" => date('Y-m-d H:i:s'),
357
+ "updated_at" => date('Y-m-d H:i:s')
358
+ );
359
+ } else {
360
+ $_datagrid = array(
361
+ "order_id" => $_order_id,
362
+ "real_order_id" => $_clm24Order["id"],
363
+ "max_shipment" => 0,
364
+ "order_group_id" => $_clm24Order["external_order_group_id"],
365
+ "order_status_id" => $_order_status_id,
366
+ "created_at" => date('Y-m-d H:i:s'),
367
+ "updated_at" => date('Y-m-d H:i:s')
368
+ );
369
+ }
370
+ $clm24_model_grid = Mage::getModel("myidshipping/ordergrid")->setData($_datagrid)
371
+ ->save();
372
+ foreach ($_clm24Data as $key => $value) {
373
+ $_data = array(
374
+ "order_grid_id" => $clm24_model_grid->getEntityId(),
375
+ "attribute" => $key,
376
+ "value" => $value,
377
+ );
378
+
379
+ array_push($maindata, $_data);
380
+ }
381
+ $_data = array(
382
+ "order_grid_id" => $clm24_model_grid->getEntityId(),
383
+ "attribute" => 'r_telephone',
384
+ "value" => $tele,
385
+ );
386
+ array_push($maindata, $_data);
387
+ $clm24_model = Mage::getModel("myidshipping/shipping");
388
+ foreach ($maindata as $data) {
389
+ $clm24_model->setData($data)
390
+ ->save();
391
+ }
392
+ }
393
+ }
394
+ // Reset Sessions
395
+ $session->setData('ship2myid', null);
396
+ $session->setData('ship2myid_maxship', null);
397
+ }
398
+ }
399
+ }
400
+
401
+ /**
402
+ * Change order grid collection for ship2myID status
403
+ *
404
+ * @param Varien_Event_Observer $observer
405
+ */
406
+
407
+
408
+ public function salesOrderGridCollectionLoadBefore($observer) {
409
+ if (Mage::getStoreConfig('clm24core/shippings/enabled')) {
410
+ $collection = $observer->getOrderGridCollection();
411
+ $select = $collection->getSelect();
412
+ $clm24Table = Mage::getSingleton('core/resource')->getTableName('clm24_myidshipping_ordergrid');
413
+ $clm24MyShipping = Mage::getSingleton('core/resource')->getTableName('clm24_myidshipping');
414
+
415
+ $select->joinLeft($clm24Table, 'main_table.increment_id = ' . $clm24Table . '.order_id', array('order_group_id', 'order_status_id', 'max_shipment'));
416
+ $select->joinLeft(array('clm1' => $clm24MyShipping), $clm24Table . '.entity_id = clm1.order_grid_id AND clm1.attribute = "email" ', array('clm1.value as rec_email'));
417
+ //$select->joinLeft(array('clm2' => $clm24MyShipping), $clm24Table . '.entity_id = clm2.order_grid_id AND clm2.attribute = "firstname" ', array('clm2.value as rec_firstname'));
418
+ //$select->joinLeft(array('clm3' => $clm24MyShipping), $clm24Table . '.entity_id = clm3.order_grid_id AND clm3.attribute = "lastname" ', array( ' CONCAT_WS(" ", clm2.`value` , clm3.`value`) as shipping_name' ));
419
+
420
+ if ($where = $select->getPart('where')) {
421
+ foreach ($where as $key => $condition) {
422
+ $new_condition = $condition;
423
+ if (strpos($condition, 'created_at')) {
424
+ $new_condition = str_replace("created_at", "main_table.created_at", $condition);
425
+ $where[$key] = $new_condition;
426
+ }
427
+ if (strpos($new_condition, 'store_id')) {
428
+ $new_condition = str_replace("store_id", "main_table.store_id", $new_condition);
429
+ $where[$key] = $new_condition;
430
+ }
431
+
432
+ /* if (strpos($new_condition, 'shipping_name')) {
433
+ $new_condition = str_replace("shipping_name", " CONCAT_WS( ' ', clm2.`value` , clm3.`value` )", $new_condition);
434
+ $where[$key] = $new_condition;
435
+ } */
436
+ }
437
+ $select->setPart('where', $where);
438
+ }
439
+
440
+ //die;
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Add column to sales orders grid
446
+ *
447
+ * @param Varien_Event_Observer $observer
448
+ * @return Varien_Event_Observer $observer
449
+ */
450
+
451
+
452
+ public function addColumn($observer) {
453
+ if (Mage::getStoreConfig('clm24core/shippings/enabled')) {
454
+ $block = $observer->getEvent()->getBlock();
455
+ $clm24Table = Mage::getSingleton('core/resource')->getTableName('clm24_myidshipping_ordergrid');
456
+ $clm24MyShipping = Mage::getSingleton('core/resource')->getTableName('clm24_myidshipping');
457
+ if (strpos((get_class($block)), 'Sales_Order_Grid')) {
458
+ $block->removeColumn('created_at');
459
+ $block->addColumnAfter('created_at', array(
460
+ 'header' => Mage::helper('sales')->__('Purchased On'),
461
+ 'index' => 'created_at',
462
+ 'type' => 'datetime',
463
+ 'filter_index' => 'main_table.created_at',
464
+ 'width' => '100px',
465
+ ), 'store_id');
466
+ $block->addColumnAfter('value', array(
467
+ 'header' => Mage::helper('sales')->__('Rec. Email '),
468
+ 'index' => 'rec_email',
469
+ 'width' => '150px',
470
+ 'filter_index' => 'clm1.value',
471
+ ), 'shipping_name');
472
+
473
+ $block->addColumnAfter('order_status_id', array(
474
+ 'header' => Mage::helper('sales')->__('Ship2MyID Status'),
475
+ 'index' => 'order_status_id',
476
+ 'width' => '70px',
477
+ 'type' => 'options',
478
+ 'filter_index' => $clm24Table . '.order_status_id',
479
+ // '0: Pending, 1: Accepted, 2: Rejected, 3: Completed, 4: Canceled', 100:Need to cancel at ship2myid
480
+ 'options' => array('' => 'Not Applicable', '0' => 'Pending', '1' => 'Accepted', '2' => 'Rejected', '3' => 'Completed', '4' => 'Canceled', '100' => 'Cancel_Failed'),
481
+ ), 'status');
482
+ $block->addColumnAfter('max_shipment', array(
483
+ 'header' => Mage::helper('sales')->__('Ship2MyID Max Shipment'),
484
+ 'index' => 'max_shipment',
485
+ 'width' => '70px',
486
+ 'type' => 'options',
487
+ 'filter_index' => $clm24Table . '.max_shipment',
488
+ // '0: Pending, 1: Accepted, 2: Rejected, 3: Completed, 4: Canceled', 100:Need to cancel at ship2myid
489
+ 'options' => array('' => 'Not Applicable', '0' => 'No', '1' => 'Yes'),
490
+ ), 'order_status_id');
491
+
492
+ $block->addColumnAfter('order_group_id', array(
493
+ 'header' => Mage::helper('sales')->__('Ship2MyID Group #'),
494
+ 'index' => 'order_group_id',
495
+ 'type' => 'text',
496
+ 'filter_index' => $clm24Table . '.order_group_id',
497
+ 'width' => '80px',
498
+ ), 'real_order_id');
499
+ }
500
+ }
501
+ }
502
+
503
+ }
app/code/local/Xclm24/Myidshipping/Model/Order.php ADDED
@@ -0,0 +1,506 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping Order Model
23
+ *
24
+ */
25
+ ini_set('memory_limit', '1024M');
26
+ class Xclm24_Myidshipping_Model_Order extends Mage_Sales_Model_Order
27
+ {
28
+
29
+ /**
30
+ * Ship2MyId Email Template Path
31
+ *
32
+ */
33
+
34
+ const XML_PATH_EMAIL_TEMPLATE = 'clm24_email/order/template';
35
+
36
+ /**
37
+ * Ship2MyId Email Template Path for Guest Order
38
+ *
39
+ */
40
+
41
+ const XML_PATH_EMAIL_GUEST_TEMPLATE = 'clm24_email/order/guest_template';
42
+
43
+ /**
44
+ * Ship2MyId Order Data
45
+ *
46
+ */
47
+
48
+ protected $_clm24OrderData = null;
49
+
50
+ /**
51
+ * Send email with order data
52
+ *
53
+ * @return Mage_Sales_Model_Order
54
+ */
55
+
56
+ public function sendNewOrderEmail()
57
+ {
58
+
59
+ $storeId = $this->getStore()->getId();
60
+
61
+ if (!Mage::helper('sales')->canSendNewOrderEmail($storeId)) {
62
+ return $this;
63
+ }
64
+ // Get the destination email addresses to send copies to
65
+ $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
66
+ $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
67
+
68
+ // Start store emulation process
69
+ $appEmulation = Mage::getSingleton('core/app_emulation');
70
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
71
+
72
+ try {
73
+ // Retrieve specified view block from appropriate design package (depends on emulated store)
74
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($this->getPayment())
75
+ ->setIsSecureMode(true);
76
+ $paymentBlock->getMethod()->setStore($storeId);
77
+ $paymentBlockHtml = $paymentBlock->toHtml();
78
+ } catch (Exception $exception) {
79
+ // Stop store emulation process
80
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
81
+ throw $exception;
82
+ }
83
+
84
+ // Stop store emulation process
85
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
86
+
87
+ // Retrieve corresponding email template id and customer name
88
+ if ($this->getCustomerIsGuest()) {
89
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
90
+ $customerName = $this->getBillingAddress()->getName();
91
+ } else {
92
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
93
+ $customerName = $this->getCustomerName();
94
+ }
95
+
96
+ $mailer = Mage::getModel('core/email_template_mailer');
97
+ $emailInfo = Mage::getModel('core/email_info');
98
+ $emailInfo->addTo($this->getCustomerEmail(), $customerName);
99
+ if ($copyTo && $copyMethod == 'bcc') {
100
+ // Add bcc to customer email
101
+ foreach ($copyTo as $email) {
102
+ $emailInfo->addBcc($email);
103
+ }
104
+ }
105
+ $mailer->addEmailInfo($emailInfo);
106
+
107
+ // Email copies are sent as separated emails if their copy method is 'copy'
108
+ if ($copyTo && $copyMethod == 'copy') {
109
+ foreach ($copyTo as $email) {
110
+ $emailInfo = Mage::getModel('core/email_info');
111
+ $emailInfo->addTo($email);
112
+ $mailer->addEmailInfo($emailInfo);
113
+ }
114
+ }
115
+
116
+ // Set all required params and send emails
117
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
118
+ $mailer->setStoreId($storeId);
119
+ $mailer->setTemplateId($templateId);
120
+
121
+ //ship2myid Email Hide
122
+ $order_id = $this->getIncrementId();
123
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
124
+ Mage::Log("Clm24 [Order_id]: ".print_r($order_id, true));
125
+
126
+
127
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
128
+ ->addFieldToFilter('main_table.order_id', array('eq' => $order_id));
129
+ $orderData = $clm24_model->getData();
130
+ //zend_debug::dump($orderData);
131
+
132
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
133
+ Mage::Log("Clm24 [ship2myid_order_data]: ".print_r($order_id, true));
134
+
135
+ $cnt = count($orderData);
136
+
137
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
138
+ Mage::Log("Clm24 [ship2myid_order_data_counter]: ".print_r($cnt, true));
139
+
140
+ $clm24shipping_address = '';
141
+ $flag_ship2myid = 0;
142
+
143
+ $shipingAddress = $this->getShippingAddress();
144
+
145
+
146
+ if($shipingAddress->getFirstname() == Mage::getStoreConfig('clm24core/shippings/ship2myid_label')){
147
+ //$quote = $this->getQuote();
148
+ $quote = Mage::getModel('sales/quote')->load($this->getQuoteId());
149
+ $isMultishippingShip2myid = false;
150
+ if($quote->getIsMultiShipping()){
151
+ $isMultishippingShip2myid = true;
152
+ }
153
+ }
154
+
155
+
156
+ if($cnt > 0){
157
+
158
+ $resource = Mage::getSingleton('core/resource');
159
+ $readConnection = $resource->getConnection('core_read');
160
+ $writeConnection = $resource->getConnection('core_write');
161
+ $table = $resource->getTableName('myidshipping/shipping');
162
+ $query = "select value from ".$table." where order_grid_id ='".$orderData[0]["entity_id"]."' and (attribute ='postcode' or attribute ='zipcode')";
163
+ $postcode = $readConnection->fetchOne($query);
164
+ $postcode = ( !is_null($postcode) && !empty($postcode))? $postcode : Mage::getStoreConfig('clm24core/shippings/defaultZipCode');
165
+
166
+ $querynew = "select value from ".$table." where order_grid_id ='".$orderData[0]["entity_id"]."' and (attribute ='country_id' or attribute ='countryCode')";
167
+ $country_id = $readConnection->fetchOne($querynew);
168
+ $country_id = ( !is_null($country_id) && !empty($country_id))? $country_id : Mage::getStoreConfig('clm24core/shippings/country_id');
169
+
170
+ $countryModel = Mage::getModel('directory/country')->loadByCode($country_id);
171
+
172
+ $countryName = $countryModel->getName();
173
+
174
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/ship2myid_label') . "<br>";
175
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/street_line1') . "<br>";
176
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/street_line2') . "<br>";
177
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/city') . "<br>";
178
+ $clm24shipping_address = $clm24shipping_address . $postcode . "<br>";
179
+ $clm24shipping_address = $clm24shipping_address . $countryName . "<br>";
180
+
181
+ $flag_ship2myid = 1;
182
+
183
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
184
+ Mage::Log("Clm24 [ship2myid-address]: ".print_r($clm24shipping_address, true));
185
+ }
186
+ else{
187
+
188
+ $countryModel = Mage::getModel('directory/country')->loadByCode($shipingAddress->getCountry_id());
189
+
190
+ $countryName = $countryModel->getName();
191
+
192
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getName() . "<br>";
193
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getStreetFull() . "<br>";
194
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getCity(). "<br>";
195
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getRegion() . "<br>";
196
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getPostcode() . "<br>";
197
+ $clm24shipping_address = $clm24shipping_address . $countryName . "<br>";
198
+ $clm24shipping_address = $clm24shipping_address . "T : " .$shipingAddress->getTelephone() . "<br>";
199
+ }
200
+
201
+ $mailer->setTemplateParams(array(
202
+ 'order' => $this,
203
+ 'billing' => $this->getBillingAddress(),
204
+ 'payment_html' => $paymentBlockHtml,
205
+ 'shipping' => $clm24shipping_address,
206
+ 'isship2myid' => $flag_ship2myid
207
+ )
208
+ );
209
+ $mailer->send();
210
+
211
+ $this->setEmailSent(true);
212
+ $this->_getResource()->saveAttribute($this, 'email_sent');
213
+
214
+ return $this;
215
+ }
216
+
217
+ /**
218
+ * Retrieve order shipping address
219
+ *
220
+ * @return Mage_Sales_Model_Order_Address
221
+ */
222
+ public function getShippingAddress()
223
+ {
224
+ foreach ($this->getAddressesCollection() as $address) {
225
+ if ($address->getAddressType()=='shipping' && !$address->isDeleted()) {
226
+ return $address;
227
+ }
228
+ }
229
+ return false;
230
+ }
231
+
232
+
233
+ /**
234
+ * Order state protected setter.
235
+ * By default allows to set any state. Can also update status to default or specified value
236
+ * Сomplete and closed states are encapsulated intentionally, see the _checkState()
237
+ *
238
+ * @param string $state
239
+ * @param string|bool $status
240
+ * @param string $comment
241
+ * @param bool $isCustomerNotified
242
+ * @param $shouldProtectState
243
+ * @return Mage_Sales_Model_Order
244
+ */
245
+ protected function _setState($state, $status = false, $comment = '',
246
+ $isCustomerNotified = null, $shouldProtectState = false)
247
+ {
248
+ // attempt to set the specified state
249
+ if ($shouldProtectState) {
250
+ if ($this->isStateProtected($state)) {
251
+ Mage::throwException(
252
+ Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state)
253
+ );
254
+ }
255
+ }
256
+ $this->setData('state', $state);
257
+
258
+ // add status history
259
+ if ($status) {
260
+ if ($status === true) {
261
+ $status = $this->getConfig()->getStateDefaultStatus($state);
262
+ }
263
+ $this->setStatus($status);
264
+ $history = $this->addStatusHistoryComment($comment, false); // no sense to set $status again
265
+ $history->setIsCustomerNotified($isCustomerNotified); // for backwards compatibility
266
+
267
+ /*
268
+ * const STATE_COMPLETE = 'complete';
269
+ const STATE_CLOSED = 'closed';
270
+ const STATE_CANCELED = 'canceled';
271
+ */
272
+ switch ($state)
273
+ {
274
+ case 'complete':
275
+ case 'closed':
276
+ {
277
+ $_cml24Helper = Mage::Helper('myidshipping');
278
+ $clm24_token = $_cml24Helper->getMyIDSession();
279
+ $_clm24Order = $_cml24Helper->completeOrder($clm24_token, $this->getIncrementId());
280
+ $_cml24Helper->closeMyIDSession($clm24_token);
281
+ }
282
+ break;
283
+ case 'canceled':
284
+ {
285
+ $_cml24Helper = Mage::Helper('myidshipping');
286
+ $clm24_token = $_cml24Helper->getMyIDSession();
287
+ $_clm24Order = $_cml24Helper->cancelOrder($clm24_token, $this->getIncrementId());
288
+ $_cml24Helper->closeMyIDSession($clm24_token);
289
+ }
290
+ break;
291
+ default:
292
+ {}
293
+ break;
294
+ }
295
+ }
296
+ return $this;
297
+ }
298
+
299
+ /**
300
+ * Check whether Order is Ship2MyId Order or Not
301
+ *
302
+ * @return boolean
303
+ */
304
+
305
+ public function isShip2myid()
306
+ {
307
+
308
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
309
+ ->addFieldToFilter('main_table.order_id', array('eq' => $this->getIncrementId()));
310
+
311
+ $orderData = $clm24_model->getData();
312
+
313
+ if (count($orderData) > 0) {
314
+
315
+ $this->_clm24OrderData = $orderData[0];
316
+ return true;
317
+ } else {
318
+
319
+ $shipingAddress = $this->getShippingAddress();
320
+
321
+ if ($shipingAddress->getFirstname() == Mage::getStoreConfig('clm24core/shippings/ship2myid_label')) {
322
+
323
+ //$quote = $this->getQuote();
324
+ $quote = Mage::getModel('sales/quote')->load($this->getQuoteId());
325
+ if ($quote->getIsMultiShipping()) {
326
+ $session = Mage::getSingleton('checkout/session');
327
+ $receiverData = $session->getData('ship2myidReceiver');
328
+ $_clm24Data = $receiverData[$shipingAddress->getEmail()];
329
+ $this->_clm24OrderData = array('rec_fname_by_sender' => $_clm24Data['firstname'], 'rec_email_by_sender' => $_clm24Data['email'], 'rec_lname_by_sender' => $_clm24Data['lastname']);
330
+ return true;
331
+ }
332
+ }
333
+ }
334
+ return false;
335
+ }
336
+
337
+ /**
338
+ * Retun Ship2MyId Order firstname
339
+ *
340
+ * @return String
341
+ */
342
+
343
+ public function get_ship2myid_order_firstname()
344
+ {
345
+ if ($arr_ship2myid = Mage::getSingleton('core/session')->getShip2myid() && isset($arr_ship2myid['firstname']) && $arr_ship2myid['firstname'] != '') {
346
+ return $arr_ship2myid['firstname'];
347
+ } else {
348
+ $clm24orderData = $this->_clm24OrderData;
349
+ $resource = Mage::getSingleton('core/resource');
350
+ $readConnection = $resource->getConnection('core_read');
351
+ $writeConnection = $resource->getConnection('core_write');
352
+ $table = $resource->getTableName('myidshipping/shipping');
353
+ $query = "select value from " . $table . " where order_grid_id ='" . $clm24orderData["entity_id"] . "' and (attribute ='firstname' or attribute ='receiver_first_name')";
354
+ $firstname = $readConnection->fetchOne($query);
355
+ return $firstname;
356
+ }
357
+ }
358
+
359
+ /**
360
+ * Retun Ship2MyId Order email
361
+ *
362
+ * @return String
363
+ */
364
+
365
+ public function get_ship2myid_order_email()
366
+ {
367
+ if ($arr_ship2myid = Mage::getSingleton('core/session')->getShip2myid() && isset($arr_ship2myid['email']) && $arr_ship2myid['email'] != '') {
368
+ return $arr_ship2myid['email'];
369
+ } else {
370
+
371
+ $clm24orderData = $this->_clm24OrderData;
372
+ $resource = Mage::getSingleton('core/resource');
373
+ $readConnection = $resource->getConnection('core_read');
374
+ $writeConnection = $resource->getConnection('core_write');
375
+ $table = $resource->getTableName('myidshipping/shipping');
376
+
377
+ $query = "select value from " . $table . " where order_grid_id ='" . $clm24orderData["entity_id"] . "' and (attribute ='email' or attribute ='receiver_email_address')";
378
+
379
+ $email = $readConnection->fetchOne($query);
380
+ return $email;
381
+ }
382
+ }
383
+
384
+ /**
385
+ * Retun Ship2MyId Order Lastname
386
+ *
387
+ * @return String
388
+ */
389
+
390
+ public function get_ship2myid_order_lastname()
391
+ {
392
+ if ($arr_ship2myid = Mage::getSingleton('core/session')->getShip2myid() && isset($arr_ship2myid['lastname']) && $arr_ship2myid['lastname'] != '') {
393
+ return $arr_ship2myid['lastname'];
394
+ } else {
395
+ $clm24orderData = $this->_clm24OrderData;
396
+ $resource = Mage::getSingleton('core/resource');
397
+ $readConnection = $resource->getConnection('core_read');
398
+ $writeConnection = $resource->getConnection('core_write');
399
+ $table = $resource->getTableName('myidshipping/shipping');
400
+
401
+ $query = "select value from " . $table . " where order_grid_id ='" . $clm24orderData["entity_id"] . "' and (attribute ='lastname' or attribute ='receiver_last_name')";
402
+ $lastname = $readConnection->fetchOne($query);
403
+ return $lastname;
404
+ }
405
+ }
406
+
407
+ /**
408
+ * Retun Ship2MyId Order PostCode
409
+ *
410
+ * @return String
411
+ */
412
+
413
+ public function get_ship2myid_order_postcode()
414
+ {
415
+
416
+ $clm24orderData = $this->_clm24OrderData;
417
+ $resource = Mage::getSingleton('core/resource');
418
+ $readConnection = $resource->getConnection('core_read');
419
+ $writeConnection = $resource->getConnection('core_write');
420
+ $table = $resource->getTableName('myidshipping/shipping');
421
+
422
+ $query = "select value from " . $table . " where order_grid_id ='" . $clm24orderData["entity_id"] . "' and (attribute ='postcode' or attribute ='zipcode')";
423
+ $postcode = $readConnection->fetchOne($query);
424
+ return $postcode;
425
+ }
426
+
427
+ /**
428
+ * Retun Ship2MyId Order Country
429
+ *
430
+ * @return String
431
+ */
432
+
433
+ public function get_ship2myid_order_country()
434
+ {
435
+
436
+ $clm24orderData = $this->_clm24OrderData;
437
+ $resource = Mage::getSingleton('core/resource');
438
+ $readConnection = $resource->getConnection('core_read');
439
+ $writeConnection = $resource->getConnection('core_write');
440
+ $table = $resource->getTableName('myidshipping/shipping');
441
+
442
+ $query = "select value from " . $table . " where order_grid_id ='" . $clm24orderData["entity_id"] . "' and (attribute ='country_id' or attribute ='countryCode')";
443
+ $country_id = $readConnection->fetchOne($query);
444
+ $countryModel = Mage::getModel('directory/country')->loadByCode($country_id);
445
+
446
+ $countryName = $countryModel->getName();
447
+ return $countryName;
448
+ }
449
+
450
+ /**
451
+ * Retun Ship2MyId Order Original Shipping Address
452
+ *
453
+ * @return String
454
+ */
455
+
456
+ public function get_original_shipping_address()
457
+ {
458
+ $clm24shipping_address = '';
459
+ $shipingAddress = $this->getShippingAddress();
460
+ $countryModel = Mage::getModel('directory/country')->loadByCode($shipingAddress->getCountry_id());
461
+
462
+ $countryName = $countryModel->getName();
463
+
464
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getName() . "<br>";
465
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getStreetFull() . "<br>";
466
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getCity() . "<br>";
467
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getRegion() . "<br>";
468
+ $clm24shipping_address = $clm24shipping_address . $shipingAddress->getPostcode() . "<br>";
469
+ $clm24shipping_address = $clm24shipping_address . $countryName . "<br>";
470
+ $clm24shipping_address = $clm24shipping_address . "T : " . $shipingAddress->getTelephone() . "<br>";
471
+ return $clm24shipping_address;
472
+ }
473
+
474
+ /**
475
+ * Retun Ship2MyId Order Receiver FirstName
476
+ *
477
+ * @return String
478
+ */
479
+
480
+ public function get_ship2myid_firstname()
481
+ {
482
+ $clm24orderData = $this->_clm24OrderData;
483
+ if (isset($clm24orderData['rec_fname_by_sender']) && $clm24orderData['rec_fname_by_sender'] != NULL && $clm24orderData['rec_fname_by_sender'] != '') {
484
+ return $clm24orderData['rec_fname_by_sender'];
485
+ } else {
486
+ return $this->getShippingAddress()->getFirstname();
487
+ }
488
+ }
489
+
490
+ /**
491
+ * Retun Ship2MyId Order Receiver LastName
492
+ *
493
+ * @return String
494
+ */
495
+
496
+ public function get_ship2myid_lastname()
497
+ {
498
+ $clm24orderData = $this->_clm24OrderData;
499
+ if (isset($clm24orderData['rec_lname_by_sender']) && $clm24orderData['rec_lname_by_sender'] != NULL && $clm24orderData['rec_lname_by_sender'] != '') {
500
+ return $clm24orderData['rec_lname_by_sender'];
501
+ } else {
502
+ return $this->getShippingAddress()->getLastname();
503
+ }
504
+ }
505
+
506
+ }
app/code/local/Xclm24/Myidshipping/Model/Order/Creditmemo.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+
22
+ /**
23
+ * Order creditmemo model
24
+ */
25
+
26
+ class Xclm24_Myidshipping_Model_Order_Creditmemo extends Mage_Sales_Model_Order_Creditmemo
27
+ {
28
+ const XML_PATH_EMAIL_TEMPLATE = 'clm24_email/creditmemo/template';
29
+ const XML_PATH_EMAIL_GUEST_TEMPLATE = 'clm24_email/creditmemo/guest_template';
30
+
31
+ /**
32
+ * re-writed to change email template
33
+ */
34
+ public function sendEmail($notifyCustomer = true, $comment = '')
35
+ {
36
+ $order = $this->getOrder();
37
+ $storeId = $order->getStore()->getId();
38
+
39
+ if (!Mage::helper('sales')->canSendNewCreditmemoEmail($storeId)) {
40
+ return $this;
41
+ }
42
+ // Get the destination email addresses to send copies to
43
+ $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
44
+ $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
45
+ // Check if at least one recepient is found
46
+ if (!$notifyCustomer && !$copyTo) {
47
+ return $this;
48
+ }
49
+
50
+ // Start store emulation process
51
+ $appEmulation = Mage::getSingleton('core/app_emulation');
52
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
53
+
54
+ try {
55
+ // Retrieve specified view block from appropriate design package (depends on emulated store)
56
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())
57
+ ->setIsSecureMode(true);
58
+ $paymentBlock->getMethod()->setStore($storeId);
59
+ $paymentBlockHtml = $paymentBlock->toHtml();
60
+ } catch (Exception $exception) {
61
+ // Stop store emulation process
62
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
63
+ throw $exception;
64
+ }
65
+
66
+ // Stop store emulation process
67
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
68
+
69
+ // Retrieve corresponding email template id and customer name
70
+ if ($order->getCustomerIsGuest()) {
71
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
72
+ $customerName = $order->getBillingAddress()->getName();
73
+ } else {
74
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
75
+ $customerName = $order->getCustomerName();
76
+ }
77
+
78
+ $mailer = Mage::getModel('core/email_template_mailer');
79
+ if ($notifyCustomer) {
80
+ $emailInfo = Mage::getModel('core/email_info');
81
+ $emailInfo->addTo($order->getCustomerEmail(), $customerName);
82
+ if ($copyTo && $copyMethod == 'bcc') {
83
+ // Add bcc to customer email
84
+ foreach ($copyTo as $email) {
85
+ $emailInfo->addBcc($email);
86
+ }
87
+ }
88
+ $mailer->addEmailInfo($emailInfo);
89
+ }
90
+
91
+ // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
92
+ if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
93
+ foreach ($copyTo as $email) {
94
+ $emailInfo = Mage::getModel('core/email_info');
95
+ $emailInfo->addTo($email);
96
+ $mailer->addEmailInfo($emailInfo);
97
+ }
98
+ }
99
+
100
+ // Set all required params and send emails
101
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
102
+ $mailer->setStoreId($storeId);
103
+ $mailer->setTemplateId($templateId);
104
+ $mailer->setTemplateParams(array(
105
+ 'order' => $order,
106
+ 'creditmemo' => $this,
107
+ 'comment' => $comment,
108
+ 'billing' => $order->getBillingAddress(),
109
+ 'payment_html' => $paymentBlockHtml
110
+ )
111
+ );
112
+ $mailer->send();
113
+ $this->setEmailSent(true);
114
+ $this->_getResource()->saveAttribute($this, 'email_sent');
115
+
116
+ return $this;
117
+ }
118
+ }
app/code/local/Xclm24/Myidshipping/Model/Order/Invoice.php ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Order_Invoice extends Mage_Sales_Model_Order_Invoice
22
+ {
23
+ const XML_PATH_EMAIL_TEMPLATE = 'clm24_email/invoice/template';
24
+ const XML_PATH_EMAIL_GUEST_TEMPLATE = 'clm24_email/invoice/guest_template';
25
+
26
+ public function sendEmail($notifyCustomer = true, $comment = '')
27
+ {
28
+ $order = $this->getOrder();
29
+ $storeId = $order->getStore()->getId();
30
+
31
+ if (!Mage::helper('sales')->canSendNewInvoiceEmail($storeId)) {
32
+ return $this;
33
+ }
34
+ // Get the destination email addresses to send copies to
35
+ $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
36
+ $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
37
+ // Check if at least one recepient is found
38
+ if (!$notifyCustomer && !$copyTo) {
39
+ return $this;
40
+ }
41
+
42
+ // Start store emulation process
43
+ $appEmulation = Mage::getSingleton('core/app_emulation');
44
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
45
+
46
+ try {
47
+ // Retrieve specified view block from appropriate design package (depends on emulated store)
48
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())
49
+ ->setIsSecureMode(true);
50
+ $paymentBlock->getMethod()->setStore($storeId);
51
+ $paymentBlockHtml = $paymentBlock->toHtml();
52
+ } catch (Exception $exception) {
53
+ // Stop store emulation process
54
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
55
+ throw $exception;
56
+ }
57
+
58
+ // Stop store emulation process
59
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
60
+
61
+ // Retrieve corresponding email template id and customer name
62
+ if ($order->getCustomerIsGuest()) {
63
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
64
+ $customerName = $order->getBillingAddress()->getName();
65
+ } else {
66
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
67
+ $customerName = $order->getCustomerName();
68
+ }
69
+
70
+ $mailer = Mage::getModel('core/email_template_mailer');
71
+ if ($notifyCustomer) {
72
+ $emailInfo = Mage::getModel('core/email_info');
73
+ $emailInfo->addTo($order->getCustomerEmail(), $customerName);
74
+ if ($copyTo && $copyMethod == 'bcc') {
75
+ // Add bcc to customer email
76
+ foreach ($copyTo as $email) {
77
+ $emailInfo->addBcc($email);
78
+ }
79
+ }
80
+ $mailer->addEmailInfo($emailInfo);
81
+ }
82
+
83
+ // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
84
+ if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
85
+ foreach ($copyTo as $email) {
86
+ $emailInfo = Mage::getModel('core/email_info');
87
+ $emailInfo->addTo($email);
88
+ $mailer->addEmailInfo($emailInfo);
89
+ }
90
+ }
91
+
92
+ // Set all required params and send emails
93
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
94
+ $mailer->setStoreId($storeId);
95
+ $mailer->setTemplateId($templateId);
96
+
97
+ //ship2myid Email Hide
98
+ $order_id = $order->getIncrementId();
99
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
100
+ Mage::Log("Clm24 [Order_id]: ".print_r($order_id, true));
101
+
102
+
103
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
104
+ ->addFieldToFilter('main_table.order_id', array('eq' => $order_id));
105
+ $orderData = $clm24_model->getData();
106
+
107
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
108
+ Mage::Log("Clm24 [ship2myid_order_data]: ".print_r($order_id, true));
109
+
110
+ $cnt = count($orderData);
111
+
112
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
113
+ Mage::Log("Clm24 [ship2myid_order_data_counter]: ".print_r($cnt, true));
114
+
115
+ $flag_ship2myid = 0;
116
+
117
+ if($cnt > 0){
118
+ $flag_ship2myid = 1;
119
+
120
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
121
+ Mage::Log("Clm24 [ship2myid-address]: ".print_r($clm24shipping_address, true));
122
+ }
123
+ $mailer->setTemplateParams(array(
124
+ 'order' => $order,
125
+ 'invoice' => $this,
126
+ 'comment' => $comment,
127
+ 'billing' => $order->getBillingAddress(),
128
+ 'payment_html' => $paymentBlockHtml,
129
+ 'isship2myid' => $flag_ship2myid
130
+ )
131
+ );
132
+ $mailer->send();
133
+ $this->setEmailSent(true);
134
+ $this->_getResource()->saveAttribute($this, 'email_sent');
135
+
136
+ return $this;
137
+ }
138
+
139
+ public function sendUpdateEmail($notifyCustomer = true, $comment = '')
140
+ {
141
+ $order = $this->getOrder();
142
+ $storeId = $order->getStore()->getId();
143
+
144
+ if (!Mage::helper('sales')->canSendInvoiceCommentEmail($storeId)) {
145
+ return $this;
146
+ }
147
+ // Get the destination email addresses to send copies to
148
+ $copyTo = $this->_getEmails(self::XML_PATH_UPDATE_EMAIL_COPY_TO);
149
+ $copyMethod = Mage::getStoreConfig(self::XML_PATH_UPDATE_EMAIL_COPY_METHOD, $storeId);
150
+ // Check if at least one recepient is found
151
+ if (!$notifyCustomer && !$copyTo) {
152
+ return $this;
153
+ }
154
+
155
+ // Retrieve corresponding email template id and customer name
156
+ if ($order->getCustomerIsGuest()) {
157
+ $templateId = Mage::getStoreConfig(self::XML_PATH_UPDATE_EMAIL_GUEST_TEMPLATE, $storeId);
158
+ $customerName = $order->getBillingAddress()->getName();
159
+ } else {
160
+ $templateId = Mage::getStoreConfig(self::XML_PATH_UPDATE_EMAIL_TEMPLATE, $storeId);
161
+ $customerName = $order->getCustomerName();
162
+ }
163
+
164
+ $mailer = Mage::getModel('core/email_template_mailer');
165
+ if ($notifyCustomer) {
166
+ $emailInfo = Mage::getModel('core/email_info');
167
+ $emailInfo->addTo($order->getCustomerEmail(), $customerName);
168
+ if ($copyTo && $copyMethod == 'bcc') {
169
+ // Add bcc to customer email
170
+ foreach ($copyTo as $email) {
171
+ $emailInfo->addBcc($email);
172
+ }
173
+ }
174
+ $mailer->addEmailInfo($emailInfo);
175
+ }
176
+
177
+ // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
178
+ if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
179
+ foreach ($copyTo as $email) {
180
+ $emailInfo = Mage::getModel('core/email_info');
181
+ $emailInfo->addTo($email);
182
+ $mailer->addEmailInfo($emailInfo);
183
+ }
184
+ }
185
+
186
+ // Set all required params and send emails
187
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_UPDATE_EMAIL_IDENTITY, $storeId));
188
+ $mailer->setStoreId($storeId);
189
+ $mailer->setTemplateId($templateId);
190
+
191
+ //ship2myid Email Hide
192
+ $order_id = $order->getIncrementId();
193
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
194
+ Mage::Log("Clm24 [Order_id]: ".print_r($order_id, true));
195
+
196
+
197
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
198
+ ->addFieldToFilter('main_table.order_id', array('eq' => $order_id));
199
+ $orderData = $clm24_model->getData();
200
+
201
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
202
+ Mage::Log("Clm24 [ship2myid_order_data]: ".print_r($order_id, true));
203
+
204
+ $cnt = count($orderData);
205
+
206
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
207
+ Mage::Log("Clm24 [ship2myid_order_data_counter]: ".print_r($cnt, true));
208
+
209
+ $clm24shipping_address = '';
210
+ $flag_ship2myid = 0;
211
+
212
+ if($cnt > 0){
213
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/ship2myid_label') . "<br>";
214
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/street_line1') . "<br>";
215
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/street_line2') . "<br>";
216
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/city') . "<br>";
217
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/defaultZipCode') . "<br>";
218
+ $clm24shipping_address = $clm24shipping_address . Mage::getStoreConfig('clm24core/shippings/country_id') . "<br>";
219
+ $flag_ship2myid = 1;
220
+
221
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1)
222
+ Mage::Log("Clm24 [ship2myid-address]: ".print_r($clm24shipping_address, true));
223
+ }
224
+
225
+ $mailer->setTemplateParams(array(
226
+ 'order' => $order,
227
+ 'invoice' => $this,
228
+ 'comment' => $comment,
229
+ 'billing' => $order->getBillingAddress(),
230
+ 'shipping' => $clm24shipping_address,
231
+ 'isship2myid' => $flag_ship2myid
232
+ )
233
+ );
234
+ $mailer->send();
235
+
236
+ return $this;
237
+ }
238
+
239
+ }
app/code/local/Xclm24/Myidshipping/Model/Order/Shipment.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+
22
+ /**
23
+ * Sales order shipment model
24
+ *
25
+ */
26
+ class Xclm24_Myidshipping_Model_Order_Shipment extends Mage_Sales_Model_Order_Shipment
27
+ {
28
+ const XML_PATH_EMAIL_TEMPLATE = 'clm24_email/shipment/template';
29
+ const XML_PATH_EMAIL_GUEST_TEMPLATE = 'clm24_email/shipment/guest_template';
30
+
31
+ /**
32
+ * re-writed to change email template
33
+ */
34
+ public function sendEmail($notifyCustomer = true, $comment = '')
35
+ {
36
+ $order = $this->getOrder();
37
+ $storeId = $order->getStore()->getId();
38
+
39
+ if (!Mage::helper('sales')->canSendNewShipmentEmail($storeId)) {
40
+ return $this;
41
+ }
42
+ // Get the destination email addresses to send copies to
43
+ $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
44
+ $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
45
+ // Check if at least one recepient is found
46
+ if (!$notifyCustomer && !$copyTo) {
47
+ return $this;
48
+ }
49
+
50
+ // Start store emulation process
51
+ $appEmulation = Mage::getSingleton('core/app_emulation');
52
+ $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
53
+
54
+ try {
55
+ // Retrieve specified view block from appropriate design package (depends on emulated store)
56
+ $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())
57
+ ->setIsSecureMode(true);
58
+ $paymentBlock->getMethod()->setStore($storeId);
59
+ $paymentBlockHtml = $paymentBlock->toHtml();
60
+ } catch (Exception $exception) {
61
+ // Stop store emulation process
62
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
63
+ throw $exception;
64
+ }
65
+
66
+ // Stop store emulation process
67
+ $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
68
+
69
+ // Retrieve corresponding email template id and customer name
70
+ if ($order->getCustomerIsGuest()) {
71
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
72
+ $customerName = $order->getBillingAddress()->getName();
73
+ } else {
74
+ $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
75
+ $customerName = $order->getCustomerName();
76
+ }
77
+
78
+ $mailer = Mage::getModel('core/email_template_mailer');
79
+ if ($notifyCustomer) {
80
+ $emailInfo = Mage::getModel('core/email_info');
81
+ $emailInfo->addTo($order->getCustomerEmail(), $customerName);
82
+ if ($copyTo && $copyMethod == 'bcc') {
83
+ // Add bcc to customer email
84
+ foreach ($copyTo as $email) {
85
+ $emailInfo->addBcc($email);
86
+ }
87
+ }
88
+ $mailer->addEmailInfo($emailInfo);
89
+ }
90
+
91
+ // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
92
+ if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
93
+ foreach ($copyTo as $email) {
94
+ $emailInfo = Mage::getModel('core/email_info');
95
+ $emailInfo->addTo($email);
96
+ $mailer->addEmailInfo($emailInfo);
97
+ }
98
+ }
99
+
100
+ // Set all required params and send emails
101
+ $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
102
+ $mailer->setStoreId($storeId);
103
+ $mailer->setTemplateId($templateId);
104
+ $mailer->setTemplateParams(array(
105
+ 'order' => $order,
106
+ 'shipment' => $this,
107
+ 'comment' => $comment,
108
+ 'billing' => $order->getBillingAddress(),
109
+ 'payment_html' => $paymentBlockHtml
110
+ )
111
+ );
112
+ $mailer->send();
113
+
114
+ return $this;
115
+ }
116
+ }
app/code/local/Xclm24/Myidshipping/Model/Ordergrid.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Order Grid Model
23
+ */
24
+
25
+ class Xclm24_Myidshipping_Model_Ordergrid extends Mage_Core_Model_Abstract
26
+ {
27
+ /**
28
+ * Constructor for Ordergrid
29
+ *
30
+ */
31
+
32
+ public function _construct()
33
+ {
34
+ parent::_construct();
35
+ $this->_init('myidshipping/ordergrid');
36
+ }
37
+
38
+ /**
39
+ * Load Model By Order Id
40
+ * @param Strinng $order_entity_id
41
+ *
42
+ */
43
+
44
+ public function loadByOrderId($order_entity_id)
45
+ {
46
+
47
+ $this->_getResource()->loadByOrderId($this, $order_entity_id);
48
+ return $this;
49
+ }
50
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Coupon.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Resource_Coupon extends Mage_Core_Model_Resource_Db_Abstract
22
+ {
23
+ /**
24
+ * Define main table
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/coupon', 'entity_id');
30
+ }
31
+
32
+ public function loadByRuleId(Xclm24_Myidshipping_Model_Coupon $myidcoupon, $rule_entity_id)
33
+ {
34
+ $adapter = $this->_getReadAdapter();
35
+
36
+ $select = $adapter->select()
37
+ ->from($this->getMainTable())
38
+ ->where($this->getMainTable().".rule_id=?", $rule_entity_id);
39
+
40
+ $mycoupon_id = $adapter->fetchOne($select);
41
+ if ($mycoupon_id) {
42
+ $this->load($myidcoupon, $mycoupon_id);
43
+ }
44
+
45
+ return $this;
46
+ }
47
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Coupon/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Resource_Coupon_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
22
+ {
23
+ /**
24
+ * Initialize resource model
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/coupon');
30
+ }
31
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Eav/Mysql4/Setup.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ class Xclm24_Myidshipping_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
21
+ {
22
+ // TODO: Add any required Attributes here
23
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Ordergrid.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Resource_Ordergrid extends Mage_Core_Model_Resource_Db_Abstract
22
+ {
23
+ /**
24
+ * Define main table
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/ordergrid', 'entity_id');
30
+ }
31
+
32
+ public function loadByOrderId(Xclm24_Myidshipping_Model_Ordergrid $myidshipping, $order_entity_id)
33
+ {
34
+ $adapter = $this->_getReadAdapter();
35
+
36
+ $select = $adapter->select()
37
+ ->from($this->getMainTable())
38
+ ->where($this->getMainTable().".order_id=?", $order_entity_id);
39
+
40
+ $myshipping_id = $adapter->fetchOne($select);
41
+ if ($myshipping_id) {
42
+ $this->load($myidshipping, $myshipping_id);
43
+ }
44
+
45
+ return $this;
46
+ }
47
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Ordergrid/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Resource_Ordergrid_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
22
+ {
23
+ /**
24
+ * Initialize resource model
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/ordergrid');
30
+ }
31
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Shipping.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Resource_Shipping extends Mage_Core_Model_Resource_Db_Abstract
22
+ {
23
+ /**
24
+ * Define main table
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/shipping', 'entity_id');
30
+ }
31
+
32
+ public function loadByOrderId(Xclm24_Myidshipping_Model_Shipping $myidshipping, $order_entity_id)
33
+ {
34
+ $adapter = $this->_getReadAdapter();
35
+
36
+ $select = $adapter->select()
37
+ ->from($this->getMainTable())
38
+ ->where($this->getMainTable().".order_id=?", $order_entity_id);
39
+
40
+ $myshipping_id = $adapter->fetchOne($select);
41
+ if ($myshipping_id) {
42
+ $this->load($myidshipping, $myshipping_id);
43
+ }
44
+
45
+ return $this;
46
+ }
47
+ }
app/code/local/Xclm24/Myidshipping/Model/Resource/Shipping/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ class Xclm24_Myidshipping_Model_Resource_Shipping_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
22
+ {
23
+ /**
24
+ * Initialize resource model
25
+ *
26
+ */
27
+ protected function _construct()
28
+ {
29
+ $this->_init('myidshipping/shipping');
30
+ }
31
+ }
app/code/local/Xclm24/Myidshipping/Model/Shipping.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Myidshipping Shipping Model
23
+ */
24
+
25
+ class Xclm24_Myidshipping_Model_Shipping extends Mage_Core_Model_Abstract
26
+ {
27
+ /**
28
+ * Constructor for Shipping Model
29
+ *
30
+ */
31
+
32
+ public function _construct()
33
+ {
34
+ parent::_construct();
35
+ $this->_init('myidshipping/shipping');
36
+ }
37
+
38
+ /**
39
+ * Load Model By Order Id
40
+ * @param Strinng $order_entity_id
41
+ * @return Xclm24_Myidshipping_Model_Shipping
42
+ *
43
+ */
44
+
45
+ public function loadByOrderId($order_entity_id)
46
+ {
47
+ $this->_getResource()->loadByOrderId($this, $order_entity_id);
48
+ return $this;
49
+ }
50
+ }
app/code/local/Xclm24/Myidshipping/Model/System/Config/Source/Order/Status/New.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Order Statuses source model
23
+ */
24
+ class Xclm24_Myidshipping_Model_System_Config_Source_Order_Status_New extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
25
+ {
26
+ protected $_stateStatuses = array(
27
+ Mage_Sales_Model_Order::STATE_NEW,
28
+ Mage_Sales_Model_Order::STATE_PROCESSING
29
+ );
30
+ }
app/code/local/Xclm24/Myidshipping/Model/System/Config/Source/Order/Status/Rejected.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Order Statuses source model
23
+ */
24
+ class Xclm24_Myidshipping_Model_System_Config_Source_Order_Status_Rejected extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
25
+ {
26
+ protected $_stateStatuses = array(
27
+ Mage_Sales_Model_Order::STATE_HOLDED,
28
+ Mage_Sales_Model_Order::STATE_CANCELED
29
+ );
30
+ }
app/code/local/Xclm24/Myidshipping/controllers/CronController.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Cron controller for Myidshipping
23
+ */
24
+
25
+ class Xclm24_Myidshipping_CronController extends Mage_Core_Controller_Front_Action
26
+ {
27
+
28
+ /**
29
+ * This function is used to run CRON
30
+ * to check the Ship2MyId Order Status
31
+ *
32
+ * @return
33
+ */
34
+ public function schedulerAction()
35
+ {
36
+
37
+ $_cml24Helper = Mage::Helper('myidshipping');
38
+ $clm24_token = $_cml24Helper->getMyIDSession();
39
+ $order_status_id = $_REQUEST['order_status'];
40
+ $username = $_REQUEST['username'];
41
+ $password = $_REQUEST['password'];
42
+ $order_details = $_REQUEST['order_details'];
43
+ $access_token = $_REQUEST['access_token'];
44
+
45
+ // Get username and password
46
+
47
+ $merchantCode = Mage::getStoreConfig('clm24core/shippings/merchantID');
48
+
49
+ $mpassword = md5(Mage::helper('core')->decrypt(Mage::getStoreConfig('clm24core/shippings/merchantPassword')));
50
+
51
+ if ($merchantCode == $username && $password == $mpassword) {
52
+
53
+ $url = Mage::getStoreConfig('clm24core/shippings/clm24Url') . "/session/?";
54
+ $_requestUrl = $url . "access_token=" . $access_token;
55
+
56
+
57
+ $ch = curl_init($_requestUrl);
58
+ $headers = array("Content-Type: application/json");
59
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
60
+
61
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
62
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
63
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
64
+
65
+ $response = curl_exec($ch);
66
+
67
+ if ($response) {
68
+ $_objResponse = Zend_Json::decode($response);
69
+ if (isset($_objResponse["Session"])) {
70
+
71
+ } else {
72
+
73
+ $_result = array("status" => $_objResponse["Error"]["status"], "message" => $_objResponse["Error"]["message"]);
74
+ }
75
+ }
76
+ } else {
77
+ $result['error'] = 1;
78
+ $result['message'] = $this->__('username and password does not match');
79
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
80
+ }
81
+
82
+ if ($order_status_id == "0") {
83
+ // 0: Pending, 1: Accepted, 2: Rejected, 3: Completed
84
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
85
+ ->addFieldToFilter('main_table.order_status_id', array('eq' => 0));
86
+
87
+
88
+
89
+ $orderData = $clm24_model->getData();
90
+ foreach ($orderData as $result) {
91
+ $entityId = $result['entity_id'];
92
+ $orderId = $result['order_id'];
93
+ $customerId = $result['customer_id'];
94
+ $realorderId = $result['real_order_id'];
95
+
96
+ if (!empty($realorderId)) {
97
+
98
+ $_clm24Order = $_cml24Helper->checkOrder($clm24_token, $realorderId);
99
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
100
+ Mage::log('$realorderId: ' . implode(',', $_clm24Order));
101
+ }
102
+ $tele = "NIL";
103
+ if (isset($_clm24Order["status"])) {
104
+
105
+ $_message = $_clm24Order["message"];
106
+ Mage::Log(__METHOD__ . ' :: ' . __LINE__ . " " . $_message);
107
+ } else {
108
+
109
+ // Prepare the Order Object
110
+ // Load the Order
111
+ $order = Mage::getModel('sales/order')
112
+ ->getCollection()
113
+ ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
114
+ ->addAttributeToFilter('increment_id', $orderId)
115
+ ->getFirstItem();
116
+
117
+ $_order_status_id = 0;
118
+
119
+ // Do we have any response
120
+ if ($order->getId()):
121
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
122
+ Mage::log('Order found: ' . $order->getId());
123
+ }
124
+ if ($_clm24Order["is_order_accepted"] == "true") {
125
+
126
+ $_order_status_id = 1;
127
+ $newOrderStatus = Mage::getStoreConfig('clm24core/shippings/order_status');
128
+ if ($newOrderStatus == 'processing') {
129
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
130
+ }
131
+ // We need to update the ship to Address too
132
+ $clm24_shippingmodel = Mage::getModel('sales/order_address')->load($order->getShippingAddressId());
133
+ $regionModel = Mage::getModel('directory/region')->loadByCode($_clm24Order["state"], $_clm24Order["countryCode"]);
134
+ $regionId = $regionModel->getId();
135
+
136
+ if ($_clm24Order["phoneNumber"])
137
+ $tele = $_clm24Order["phoneNumber"];
138
+ else
139
+ $tele = "NIL";
140
+
141
+ $_shipping = Array
142
+ (
143
+ // [address_id] => 0
144
+ "entity_id" => $order->getShippingAddressId(),
145
+ "parent_id" => $clm24_shippingmodel->getData("parent_id"),
146
+ "firstname" => ($_clm24Order["receiver_first_name"] ? $_clm24Order["receiver_first_name"] : '' ),
147
+ "lastname" => ($_clm24Order["receiver_last_name"] ? $_clm24Order["receiver_last_name"] : ''),
148
+ "company" => "",
149
+ "street" => $_clm24Order["address_1"] . ' ' . $_clm24Order["address_2"],
150
+ "city" => $_clm24Order["city"],
151
+ "region_id" => $regionId,
152
+ "region" => $_clm24Order["stateName"],
153
+ "postcode" => $_clm24Order["zipcode"],
154
+ "country_id" => $_clm24Order["countryCode"],
155
+ "telephone" => $_clm24Order["receiver_telephone"],
156
+ "fax" => "",
157
+ "address_type" => "shipping"
158
+ );
159
+
160
+ $clm24_shippingmodel->setData($_shipping)->save();
161
+ }
162
+
163
+ if ($_clm24Order["is_order_rejected"] == "true") {
164
+
165
+ $_order_status_id = 2;
166
+ /**
167
+ * change order status to 'Holded' or 'Canceled' according to config
168
+ */
169
+ $rejectedOrderStatus = Mage::getStoreConfig('clm24core/shippings/rejected_order_status');
170
+ if ($rejectedOrderStatus == 'canceled') {
171
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, $_clm24Order["receiver_rejected_note"])->save();
172
+ } else {
173
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true, $_clm24Order["receiver_rejected_note"])->save();
174
+ }
175
+ }
176
+
177
+
178
+
179
+ // Save the data
180
+ $_data = array(
181
+ "entity_id" => $entityId,
182
+ "order_status_id" => $_order_status_id,
183
+ "receiver_telephone" => $tele,
184
+ "updated_at" => date('Y-m-d H:i:s')
185
+ );
186
+
187
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")
188
+ ->setData($_data)
189
+ ->save();
190
+
191
+
192
+
193
+ $clm24_model_tel = Mage::getModel("myidshipping/shipping")->getCollection()->addFieldToFilter('main_table.entity_id', $clm24_model->getEntityId())->addFieldToFilter('main_table.attribute', array('eq' => 'telephone'));
194
+
195
+ $orderDatatel = $clm24_model_tel->getData();
196
+ foreach ($orderDatatel as $resulttel) {
197
+ $entityIdtel = $result['entity_id'];
198
+
199
+
200
+ $_data_tel = array(
201
+ "entity_id" => $entityIdtel,
202
+ "value" => $tele
203
+ );
204
+ }
205
+ $clm24_model_tel = Mage::getModel("myidshipping/shipping")
206
+ ->setData($_data_tel)
207
+ ->save();
208
+
209
+ else:
210
+ Mage::log('order not found');
211
+ endif;
212
+ }
213
+ } else {
214
+
215
+ }
216
+ }
217
+
218
+ $_cml24Helper->closeMyIDSession($clm24_token);
219
+ }
220
+ if ($order_status_id == "100") {
221
+ $_cml24Helper = Mage::Helper('myidshipping');
222
+ $clm24_token = $_cml24Helper->getMyIDSession();
223
+
224
+ // 0: Pending, 1: Accepted, 2: Rejected, 3: Completed , 4: Canceled, 100:cancel_failed
225
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
226
+ ->addFieldToFilter('main_table.order_status_id', array('eq' => 100));
227
+
228
+ $orderData = $clm24_model->getData();
229
+
230
+ foreach ($orderData as $result) {
231
+ $entityId = $result['entity_id'];
232
+ $orderId = $result['order_id'];
233
+ $customerId = $result['customer_id'];
234
+ $realorderId = $result['real_order_id'];
235
+
236
+ $_clm24Order = $_cml24Helper->cancelOrder($clm24_token, $orderId);
237
+ }
238
+ $_cml24Helper->closeMyIDSession($clm24_token);
239
+ }
240
+ }
241
+
242
+ }
app/code/local/Xclm24/Myidshipping/controllers/IndexController.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ /**
22
+ * Index controller for Myidshipping
23
+ */
24
+
25
+ class Xclm24_Myidshipping_IndexController extends Mage_Core_Controller_Front_Action
26
+ {
27
+
28
+ /**
29
+ * Return Session MyidPopHandlerData
30
+ *
31
+ * @return array()
32
+ */
33
+
34
+ protected function _getPopupdata()
35
+ {
36
+ return Mage::getSingleton('core/session')->getMyidPopHandlerData();
37
+ }
38
+
39
+ /**
40
+ * Get Popup handler html
41
+ *
42
+ * @return String
43
+ */
44
+
45
+ protected function _getMyidPopHandlerHtml()
46
+ {
47
+
48
+ $layout = $this->getLayout();
49
+ $update = $layout->getUpdate();
50
+ $update->load('midshipping_myid_popuphandler');
51
+ $layout->generateXml();
52
+ $layout->generateBlocks();
53
+ $output = $layout->getOutput();
54
+
55
+ return $output;
56
+ }
57
+
58
+ /**
59
+ * This function is called from the Ship2MyId Server
60
+ * to send receiver data to magento which is fill be
61
+ * sender on popup page.
62
+ * Save the data in session
63
+ *
64
+ * @return string
65
+ */
66
+
67
+ public function postbackAction()
68
+ {
69
+ /* if($_POST['receiver_linkedin_id']!=""){
70
+ $_POST['receiver_type']='linkedin';
71
+ }elseif($_POST['receiver_facebook_id']!=""){
72
+ $_POST['receiver_type']='facebook';
73
+ }else{
74
+ $_POST['receiver_type']='email';
75
+ } */
76
+
77
+ $post_data = $_POST;
78
+ $post_data['firstname_by_server'] = $post_data['firstname'];
79
+ $post_data['lastname_by_server'] = $post_data['lastname'];
80
+ $post_data['username_by_server'] = $post_data['username'];
81
+
82
+ $name = explode(' ', $post_data['firstname']);
83
+
84
+ if (is_array($name) && !empty($name)) {
85
+ $post_data['firstname'] = $name[0];
86
+ $post_data['lastname'] = isset($name[1]) && !empty($name[1]) ? $name[1] : $name[0];
87
+ $post_data['username'] = $post_data['firstname']. ' ' . $post_data['lastname'];
88
+ }else{
89
+ $post_data['firstname'] = $post_data['firstname'];
90
+ $post_data['lastname'] = $post_data['lastname'];
91
+ }
92
+
93
+
94
+ $session = Mage::getSingleton('checkout/session');
95
+ $session->setData('ship2myid', $post_data);
96
+ if (Mage::getStoreConfig('clm24core/shippings/debug') == 1) {
97
+ Mage::log('Ship2MyId Post Back Log'. print_r($post_data,TRUE));
98
+ }
99
+ //Mage::getSingleton('core/session')->setMyidPopHandlerData($_POST);
100
+ echo $this->_getMyidPopHandlerHtml();
101
+ }
102
+
103
+ /**
104
+ * This function is use to apply ship2myid
105
+ * specific coupon to cart
106
+ *
107
+ * @return string
108
+ */
109
+
110
+ public function checkcouponAction()
111
+ {
112
+
113
+ $couponCodealready = Mage::getSingleton('checkout/cart')->getQuote()->getCouponCode();
114
+ if ($couponCodealready == "") {
115
+ $couponCode = (string) $_POST['coupon_code'];
116
+ if (isset($couponCode) && $couponCode != "") {
117
+ $oCoupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
118
+ $oRule = Mage::getModel('salesrule/rule')->load($oCoupon->getRuleId());
119
+ $ruledata = $oRule->getData();
120
+
121
+ if (isset($ruledata['rule_id']) && $ruledata['rule_id'] != "") {
122
+ $clm24myidCouponModel = Mage::getModel('myidshipping/coupon')->loadByRuleId($ruledata['rule_id']);
123
+ if ($clm24myidCouponModel->getShip2myidOnly() == 1) {
124
+
125
+ $result['error'] = 0;
126
+ $result['message'] = $this->__('coupon code is valid for shim2myid');
127
+ } else {
128
+ $result['error'] = 1;
129
+ $result['message'] = $this->__('coupon code is invalid for shim2myid');
130
+ $couponmsg = "this coupon code is invalid for shim2myid";
131
+ }
132
+ //zend_debug::Dump($clm24myidCouponModel->getShip2myidOnly());
133
+ } else {
134
+ $result['error'] = 1;
135
+ $result['message'] = $this->__('coupon code is not valid');
136
+ }
137
+ } else {
138
+
139
+ $result['error'] = 1;
140
+
141
+ $result['message'] = $this->__('you have already applied a coupon code for this order');
142
+ }
143
+ }
144
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
145
+ }
146
+
147
+ }
app/code/local/Xclm24/Myidshipping/etc/adminhtml.xml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <acl>
24
+ <resources>
25
+ <admin>
26
+ <children>
27
+ <system>
28
+ <children>
29
+ <config>
30
+ <children>
31
+ <clm24core>
32
+ <title>CLM24</title>
33
+ </clm24core>
34
+ <clm24_email>
35
+ <title>Ship2MyID Email Templates</title>
36
+ </clm24_email>
37
+ </children>
38
+ </config>
39
+ </children>
40
+ </system>
41
+ </children>
42
+ </admin>
43
+ </resources>
44
+ </acl>
45
+ </config>
app/code/local/Xclm24/Myidshipping/etc/config.xml ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Xclm24_Myidshipping>
25
+ <version>1.3</version>
26
+ </Xclm24_Myidshipping>
27
+ </modules>
28
+
29
+ <global>
30
+ <blocks>
31
+ <myidshipping>
32
+ <class>Xclm24_Myidshipping_Block</class>
33
+ </myidshipping>
34
+ <adminhtml>
35
+ <rewrite>
36
+ <promo_quote_edit_tab_main>Xclm24_Myidshipping_Block_Adminhtml_Promo_Quote_Edit_Tab_Main</promo_quote_edit_tab_main>
37
+ </rewrite>
38
+ </adminhtml>
39
+ <giftmessage>
40
+ <rewrite>
41
+ <message_inline>Xclm24_Myidshipping_Block_GiftMessage_Message_Inline</message_inline>
42
+ </rewrite>
43
+ </giftmessage>
44
+ </blocks>
45
+
46
+ <models>
47
+ <myidshipping>
48
+ <class>Xclm24_Myidshipping_Model</class>
49
+ <resourceModel>myidshipping_resource</resourceModel>
50
+ </myidshipping>
51
+ <myidshipping_resource>
52
+ <class>Xclm24_Myidshipping_Model_Resource</class>
53
+ <entities>
54
+ <shipping>
55
+ <table>clm24_myidshipping</table>
56
+ </shipping>
57
+ <ordergrid>
58
+ <table>clm24_myidshipping_ordergrid</table>
59
+ </ordergrid>
60
+ <coupon>
61
+ <table>clm24_myidcoupon</table>
62
+ </coupon>
63
+ </entities>
64
+ </myidshipping_resource>
65
+ <paypal>
66
+ <rewrite>
67
+ <api_standard>Xclm24_Myidshipping_Model_Api_Standard</api_standard>
68
+ <api_nvp>Xclm24_Myidshipping_Model_Api_Nvp</api_nvp>
69
+ </rewrite>
70
+ </paypal>
71
+ <sales>
72
+ <rewrite>
73
+ <order>Xclm24_Myidshipping_Model_Order</order>
74
+ <order_invoice>Xclm24_Myidshipping_Model_Order_Invoice</order_invoice>
75
+ <order_shipment>Xclm24_Myidshipping_Model_Order_Shipment</order_shipment>
76
+ <order_creditmemo>Xclm24_Myidshipping_Model_Order_Creditmemo</order_creditmemo>
77
+ </rewrite>
78
+ </sales>
79
+ </models>
80
+
81
+ <helpers>
82
+ <myidshipping>
83
+ <class>Xclm24_Myidshipping_Helper</class>
84
+ </myidshipping>
85
+ </helpers>
86
+
87
+ <resources>
88
+ <myidshipping_setup>
89
+ <setup>
90
+ <module>Xclm24_Myidshipping</module>
91
+ <class>Xclm24_Myidshipping_Model_Resource_Eav_Mysql4_Setup</class>
92
+ </setup>
93
+ <connection>
94
+ <use>core_setup</use>
95
+ </connection>
96
+ </myidshipping_setup>
97
+ <myidshipping_write>
98
+ <connection>
99
+ <use>core_write</use>
100
+ </connection>
101
+ </myidshipping_write>
102
+ <myidshipping_read>
103
+ <connection>
104
+ <use>core_read</use>
105
+ </connection>
106
+ </myidshipping_read>
107
+ </resources>
108
+
109
+ <events>
110
+ <controller_action_postdispatch>
111
+ <observers>
112
+ <controller_action_after>
113
+ <class>myidshipping/observer</class>
114
+ <method>billingPostDispatch</method>
115
+ </controller_action_after>
116
+ </observers>
117
+ </controller_action_postdispatch>
118
+ <payment_method_is_active>
119
+ <observers>
120
+ <clm24_myidshipping_observer>
121
+ <type>singleton</type>
122
+ <class>myidshipping/observer</class>
123
+ <method>paymentMethodCheck</method>
124
+ </clm24_myidshipping_observer>
125
+ </observers>
126
+ </payment_method_is_active>
127
+
128
+ <sales_order_place_after>
129
+ <observers>
130
+ <clm24_myidshipping_observer>
131
+ <type>singleton</type>
132
+ <class>myidshipping/observer</class>
133
+ <method>salesOrderPlaceAfter</method>
134
+ </clm24_myidshipping_observer>
135
+ </observers>
136
+ </sales_order_place_after>
137
+
138
+ <sales_order_save_after>
139
+ <observers>
140
+ <clm24_myidshipping_observer>
141
+ <type>singleton</type>
142
+ <class>myidshipping/observer</class>
143
+ <method>salesOrderSaveAfter</method>
144
+ </clm24_myidshipping_observer>
145
+ </observers>
146
+ </sales_order_save_after>
147
+
148
+ </events>
149
+
150
+ <template>
151
+ <email>
152
+ <clm24_email_order_template translate="label" module="myidshipping">
153
+ <label>New Ship2MyID Order</label>
154
+ <file>sales/clm24/order_new.html</file>
155
+ <type>html</type>
156
+ </clm24_email_order_template>
157
+ <clm24_email_order_guest_template translate="label" module="myidshipping">
158
+ <label>New Ship2MyID Order for Guest</label>
159
+ <file>sales/clm24/order_new_guest.html</file>
160
+ <type>html</type>
161
+ </clm24_email_order_guest_template>
162
+ <clm24_email_invoice_template translate="label" module="myidshipping">
163
+ <label>New Ship2MyID Invoice</label>
164
+ <file>sales/clm24/invoice_new.html</file>
165
+ <type>html</type>
166
+ </clm24_email_invoice_template>
167
+ <clm24_email_invoice_guest_template translate="label" module="myidshipping">
168
+ <label>New Ship2MyID Invoice for Guest</label>
169
+ <file>sales/clm24/invoice_new_guest.html</file>
170
+ <type>html</type>
171
+ </clm24_email_invoice_guest_template>
172
+ <clm24_email_creditmemo_template translate="label" module="myidshipping">
173
+ <label>New Ship2MyID Credit Memo</label>
174
+ <file>sales/clm24/creditmemo_new.html</file>
175
+ <type>html</type>
176
+ </clm24_email_creditmemo_template>
177
+ <clm24_email_creditmemo_guest_template translate="label" module="myidshipping">
178
+ <label>New Ship2MyID Credit Memo for Guest</label>
179
+ <file>sales/clm24/creditmemo_new_guest.html</file>
180
+ <type>html</type>
181
+ </clm24_email_creditmemo_guest_template>
182
+ <clm24_email_shipment_template translate="label" module="myidshipping">
183
+ <label>New Ship2MyID Shipment</label>
184
+ <file>sales/clm24/shipment_new.html</file>
185
+ <type>html</type>
186
+ </clm24_email_shipment_template>
187
+ <clm24_email_shipment_guest_template translate="label" module="myidshipping">
188
+ <label>New Ship2MyID Shipment for Guest</label>
189
+ <file>sales/clm24/shipment_new_guest.html</file>
190
+ <type>html</type>
191
+ </clm24_email_shipment_guest_template>
192
+ </email>
193
+ </template>
194
+ </global>
195
+
196
+ <frontend>
197
+ <routers>
198
+ <myidshipping>
199
+ <use>standard</use>
200
+ <args>
201
+ <module>Xclm24_Myidshipping</module>
202
+ <frontName>myidshipping</frontName>
203
+ </args>
204
+ </myidshipping>
205
+ </routers>
206
+
207
+ <layout>
208
+ <updates>
209
+ <custom>
210
+ <file>myidshipping.xml</file>
211
+ </custom>
212
+ </updates>
213
+ </layout>
214
+ </frontend>
215
+
216
+ <adminhtml>
217
+ <events>
218
+ <sales_order_grid_collection_load_before>
219
+ <observers>
220
+ <clm24_myidshipping_observer>
221
+ <model>myidshipping/observer</model>
222
+ <method>salesOrderGridCollectionLoadBefore</method>
223
+ </clm24_myidshipping_observer>
224
+ </observers>
225
+ </sales_order_grid_collection_load_before>
226
+ <core_block_abstract_prepare_layout_before>
227
+ <observers>
228
+ <clm24_myidshipping_observer>
229
+ <type>model</type>
230
+ <class>myidshipping/observer</class>
231
+ <method>addColumn</method>
232
+ </clm24_myidshipping_observer>
233
+ </observers>
234
+ </core_block_abstract_prepare_layout_before>
235
+ <salesrule_rule_save_after>
236
+ <observers>
237
+ <clm24_myidshipping_observer>
238
+ <model>myidshipping/observer</model>
239
+ <method>setShip2myidOnlyCoupon</method>
240
+ </clm24_myidshipping_observer>
241
+ </observers>
242
+ </salesrule_rule_save_after>
243
+ </events>
244
+ <layout>
245
+ <updates>
246
+ <custom>
247
+ <file>myidshipping.xml</file>
248
+ </custom>
249
+ </updates>
250
+ </layout>
251
+ </adminhtml>
252
+ <default>
253
+ <clm24core>
254
+ <shippings>
255
+ <clm24Url>https://hotfix-app.ship2myid.com/ship2myid/rest</clm24Url>
256
+ <clm24TermsUrl>https://www.ship2myid.com/terms-of-use</clm24TermsUrl>
257
+ <clm24PrivacyUrl>https://www.ship2myid.com/privacy</clm24PrivacyUrl>
258
+ <street_line1>The shipping address is protected by Ship2MyID.</street_line1>
259
+ <street_line2>X</street_line2>
260
+ <city>X</city>
261
+ <region_id>12</region_id>
262
+ <defaultZipCode>98004</defaultZipCode>
263
+ <country_id>US</country_id>
264
+ <telephone>X</telephone>
265
+ <ship2myid_label>shiptomyid</ship2myid_label>
266
+ <ytvideoid>_4yvWDuyCis</ytvideoid>
267
+ <clm24popurl>https://hotfix-app.ship2myid.com/ship2myid/shopping_cart_popup/index.jsp?plateform=magento</clm24popurl>
268
+ <clm24popwidth>600</clm24popwidth>
269
+ <clm24popheight>590</clm24popheight>
270
+ <order_status>processing</order_status>
271
+ <rejected_order_status>canceled</rejected_order_status>
272
+ </shippings>
273
+ </clm24core>
274
+ <clm24_email>
275
+ <order>
276
+ <template>clm24_email_order_template</template>
277
+ <guest_template>clm24_email_order_guest_template</guest_template>
278
+ </order>
279
+ <invoice>
280
+ <template>clm24_email_invoice_template</template>
281
+ <guest_template>clm24_email_invoice_guest_template</guest_template>
282
+ </invoice>
283
+ <shipment>
284
+ <template>clm24_email_shipment_template</template>
285
+ <guest_template>clm24_email_shipment_guest_template</guest_template>
286
+ </shipment>
287
+ <creditmemo>
288
+ <template>clm24_email_creditmemo_template</template>
289
+ <guest_template>clm24_email_creditmemo_guest_template</guest_template>
290
+ </creditmemo>
291
+ </clm24_email>
292
+ </default>
293
+
294
+ <crontab>
295
+ <jobs>
296
+ <clm24core_scheduler>
297
+ <schedule>
298
+ <cron_expr>*/5 * * * *</cron_expr>
299
+ </schedule>
300
+ <run>
301
+ <model>myidshipping/cron::scheduler</model>
302
+ </run>
303
+ </clm24core_scheduler>
304
+ <clm24core_scheduler_cancel>
305
+ <schedule>
306
+ <cron_expr>*/10 * * * *</cron_expr>
307
+ </schedule>
308
+ <run>
309
+ <model>myidshipping/cron::croncancelorder</model>
310
+ </run>
311
+ </clm24core_scheduler_cancel>
312
+ </jobs>
313
+ </crontab>
314
+
315
+ </config>
app/code/local/Xclm24/Myidshipping/etc/system.xml ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <tabs>
24
+ <clm24>
25
+ <label>Ship2MyID</label>
26
+ <sort_order>195</sort_order>
27
+ </clm24>
28
+ </tabs>
29
+ <sections>
30
+ <clm24core>
31
+ <label>Settings</label>
32
+ <tab>clm24</tab>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>9</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ <groups>
39
+ <clm24_notice translate="label" module="myidshipping">
40
+ <frontend_model>myidshipping/adminhtml_system_config_fieldset_hint</frontend_model>
41
+ <help_link>http://www.mapmyid.com/ship2myid-howitworks</help_link>
42
+ <sort_order>0</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </clm24_notice>
47
+ <shippings translate="label" module="myidshipping">
48
+ <label>Ship2MyID API</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>30</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <fields>
55
+ <enabled translate="label comment">
56
+ <label>Enable</label>
57
+ <frontend_type>select</frontend_type>
58
+ <source_model>adminhtml/system_config_source_yesno</source_model>
59
+ <sort_order>1</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </enabled>
64
+ <merchantID translate="label">
65
+ <label>Merchant's ID</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>2</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </merchantID>
72
+ <merchantPassword translate="label">
73
+ <label>Merchant's Password</label>
74
+ <frontend_type>obscure</frontend_type>
75
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
76
+ <sort_order>3</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </merchantPassword>
81
+
82
+ <clm24Url translate="label">
83
+ <label>Webservice URL</label>
84
+ <frontend_type>text</frontend_type>
85
+ <sort_order>4</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </clm24Url>
90
+
91
+ <clm24TermsUrl translate="label">
92
+ <label>Terms URL</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>5</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </clm24TermsUrl>
99
+ <clm24PrivacyUrl translate="label">
100
+ <label>Privacy policy URL</label>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>6</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </clm24PrivacyUrl>
107
+ <ytvideoid translate="label">
108
+ <label>Ship2MyID video link</label>
109
+ <frontend_type>text</frontend_type>
110
+ <sort_order>7</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ </ytvideoid>
115
+ <street_line1 translate="label">
116
+ <label>Default Street Address</label>
117
+ <frontend_type>text</frontend_type>
118
+ <sort_order>50</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ </street_line1>
123
+ <street_line2 translate="label">
124
+ <label>Default Street Address Line 2</label>
125
+ <frontend_type>text</frontend_type>
126
+ <sort_order>51</sort_order>
127
+ <show_in_default>1</show_in_default>
128
+ <show_in_website>1</show_in_website>
129
+ <show_in_store>1</show_in_store>
130
+ </street_line2>
131
+ <city translate="label">
132
+ <label>Default City</label>
133
+ <frontend_type>text</frontend_type>
134
+ <sort_order>52</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
+ </city>
139
+ <region_id translate="label">
140
+ <label>Default Region/State</label>
141
+ <frontend_type>text</frontend_type>
142
+ <sort_order>53</sort_order>
143
+ <show_in_default>1</show_in_default>
144
+ <show_in_website>1</show_in_website>
145
+ <show_in_store>1</show_in_store>
146
+ </region_id>
147
+ <defaultZipCode translate="label">
148
+ <label>Default ZIP/Postal Code</label>
149
+ <frontend_type>text</frontend_type>
150
+ <sort_order>54</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ </defaultZipCode>
155
+ <country_id translate="label">
156
+ <label>Default Country</label>
157
+ <frontend_type>select</frontend_type>
158
+ <frontend_class>countries</frontend_class>
159
+ <source_model>adminhtml/system_config_source_country</source_model>
160
+ <sort_order>55</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ </country_id>
165
+ <telephone translate="label">
166
+ <label>Default Phone Number</label>
167
+ <frontend_type>text</frontend_type>
168
+ <sort_order>56</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </telephone>
173
+
174
+ <ship2myid_label translate="label">
175
+ <label>Ship2MyID Label</label>
176
+ <comment>Please enter string value which does not have number and special characters.</comment>
177
+ <validate>required-entry validate-alpha</validate>
178
+ <frontend_type>text</frontend_type>
179
+ <sort_order>57</sort_order>
180
+ <show_in_default>1</show_in_default>
181
+ <show_in_website>1</show_in_website>
182
+ <show_in_store>1</show_in_store>
183
+ </ship2myid_label>
184
+ <clm24popurl translate="label">
185
+ <label>Webservice Popup URL</label>
186
+ <frontend_type>text</frontend_type>
187
+ <sort_order>58</sort_order>
188
+ <show_in_default>1</show_in_default>
189
+ <show_in_website>1</show_in_website>
190
+ <show_in_store>1</show_in_store>
191
+ </clm24popurl>
192
+ <clm24popwidth translate="label">
193
+ <label>Webservice Popup Width</label>
194
+ <frontend_type>text</frontend_type>
195
+ <sort_order>59</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ </clm24popwidth>
200
+ <clm24popheight translate="label">
201
+ <label>Webservice Popup Height</label>
202
+ <frontend_type>text</frontend_type>
203
+ <sort_order>60</sort_order>
204
+ <show_in_default>1</show_in_default>
205
+ <show_in_website>1</show_in_website>
206
+ <show_in_store>1</show_in_store>
207
+ </clm24popheight>
208
+ <debug translate="label">
209
+ <label>Debug</label>
210
+ <frontend_type>select</frontend_type>
211
+ <source_model>adminhtml/system_config_source_yesno</source_model>
212
+ <sort_order>900</sort_order>
213
+ <show_in_default>1</show_in_default>
214
+ <show_in_website>1</show_in_website>
215
+ <show_in_store>1</show_in_store>
216
+ </debug>
217
+ <order_status translate="label">
218
+ <label>New Order Status</label>
219
+ <comment>New order status for orders with ship2myID accepted status.</comment>
220
+ <frontend_type>select</frontend_type>
221
+ <source_model>myidshipping/system_config_source_order_status_new</source_model>
222
+ <sort_order>1000</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>0</show_in_store>
226
+ </order_status>
227
+ <rejected_order_status translate="label">
228
+ <label>Rejected Order Status</label>
229
+ <comment>Order status for orders with ship2myID rejected status.</comment>
230
+ <frontend_type>select</frontend_type>
231
+ <source_model>myidshipping/system_config_source_order_status_rejected</source_model>
232
+ <sort_order>1001</sort_order>
233
+ <show_in_default>1</show_in_default>
234
+ <show_in_website>1</show_in_website>
235
+ <show_in_store>0</show_in_store>
236
+ </rejected_order_status>
237
+ <ship2myid_order_status translate="label">
238
+ <label>Enforce Pending order status for Ship2MyID orders</label>
239
+ <comment>When credit card payment configuration set order status to "processing". Enable this option to enforce "Pending" as order status only for Ship2MyID orders. Ship2myid orders should only be processed when accepted.</comment>
240
+ <frontend_type>select</frontend_type>
241
+ <source_model>adminhtml/system_config_source_yesno</source_model>
242
+ <sort_order>1002</sort_order>
243
+ <show_in_default>1</show_in_default>
244
+ <show_in_website>1</show_in_website>
245
+ <show_in_store>0</show_in_store>
246
+ </ship2myid_order_status>
247
+ </fields>
248
+ </shippings>
249
+ </groups>
250
+ </clm24core>
251
+ <clm24_email translate="label" module="myidshipping">
252
+ <label>Email Templates</label>
253
+ <tab>clm24</tab>
254
+ <frontend_type>text</frontend_type>
255
+ <sort_order>301</sort_order>
256
+ <show_in_default>1</show_in_default>
257
+ <show_in_website>1</show_in_website>
258
+ <show_in_store>1</show_in_store>
259
+ <groups>
260
+ <order translate="label">
261
+ <label>Order</label>
262
+ <frontend_type>text</frontend_type>
263
+ <sort_order>1</sort_order>
264
+ <show_in_default>1</show_in_default>
265
+ <show_in_website>1</show_in_website>
266
+ <show_in_store>1</show_in_store>
267
+ <fields>
268
+ <template translate="label">
269
+ <label>New Order Confirmation Template</label>
270
+ <frontend_type>select</frontend_type>
271
+ <source_model>adminhtml/system_config_source_email_template</source_model>
272
+ <sort_order>2</sort_order>
273
+ <show_in_default>1</show_in_default>
274
+ <show_in_website>1</show_in_website>
275
+ <show_in_store>1</show_in_store>
276
+ </template>
277
+ <guest_template translate="label">
278
+ <label>New Order Confirmation Template for Guest</label>
279
+ <frontend_type>select</frontend_type>
280
+ <source_model>adminhtml/system_config_source_email_template</source_model>
281
+ <sort_order>3</sort_order>
282
+ <show_in_default>1</show_in_default>
283
+ <show_in_website>1</show_in_website>
284
+ <show_in_store>1</show_in_store>
285
+ </guest_template>
286
+ </fields>
287
+ </order>
288
+
289
+ <invoice translate="label">
290
+ <label>Invoice</label>
291
+ <frontend_type>text</frontend_type>
292
+ <sort_order>3</sort_order>
293
+ <show_in_default>1</show_in_default>
294
+ <show_in_website>1</show_in_website>
295
+ <show_in_store>1</show_in_store>
296
+ <fields>
297
+ <template translate="label">
298
+ <label>Invoice Email Template</label>
299
+ <frontend_type>select</frontend_type>
300
+ <source_model>adminhtml/system_config_source_email_template</source_model>
301
+ <sort_order>2</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
+ </template>
306
+ <guest_template translate="label">
307
+ <label>Invoice Email Template for Guest</label>
308
+ <frontend_type>select</frontend_type>
309
+ <source_model>adminhtml/system_config_source_email_template</source_model>
310
+ <sort_order>3</sort_order>
311
+ <show_in_default>1</show_in_default>
312
+ <show_in_website>1</show_in_website>
313
+ <show_in_store>1</show_in_store>
314
+ </guest_template>
315
+ </fields>
316
+ </invoice>
317
+
318
+ <shipment translate="label">
319
+ <label>Shipment</label>
320
+ <frontend_type>text</frontend_type>
321
+ <sort_order>5</sort_order>
322
+ <show_in_default>1</show_in_default>
323
+ <show_in_website>1</show_in_website>
324
+ <show_in_store>1</show_in_store>
325
+ <fields>
326
+ <template translate="label">
327
+ <label>Shipment Email Template</label>
328
+ <frontend_type>select</frontend_type>
329
+ <source_model>adminhtml/system_config_source_email_template</source_model>
330
+ <sort_order>2</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>1</show_in_website>
333
+ <show_in_store>1</show_in_store>
334
+ </template>
335
+ <guest_template translate="label">
336
+ <label>Shipment Email Template for Guest</label>
337
+ <frontend_type>select</frontend_type>
338
+ <source_model>adminhtml/system_config_source_email_template</source_model>
339
+ <sort_order>3</sort_order>
340
+ <show_in_default>1</show_in_default>
341
+ <show_in_website>1</show_in_website>
342
+ <show_in_store>1</show_in_store>
343
+ </guest_template>
344
+ </fields>
345
+ </shipment>
346
+ <creditmemo translate="label">
347
+ <label>Credit Memo</label>
348
+ <frontend_type>text</frontend_type>
349
+ <sort_order>7</sort_order>
350
+ <show_in_default>1</show_in_default>
351
+ <show_in_website>1</show_in_website>
352
+ <show_in_store>1</show_in_store>
353
+ <fields>
354
+ <template translate="label">
355
+ <label>Credit Memo Email Template</label>
356
+ <frontend_type>select</frontend_type>
357
+ <source_model>adminhtml/system_config_source_email_template</source_model>
358
+ <sort_order>2</sort_order>
359
+ <show_in_default>1</show_in_default>
360
+ <show_in_website>1</show_in_website>
361
+ <show_in_store>1</show_in_store>
362
+ </template>
363
+ <guest_template translate="label">
364
+ <label>Credit Memo Email Template for Guest</label>
365
+ <frontend_type>select</frontend_type>
366
+ <source_model>adminhtml/system_config_source_email_template</source_model>
367
+ <sort_order>3</sort_order>
368
+ <show_in_default>1</show_in_default>
369
+ <show_in_website>1</show_in_website>
370
+ <show_in_store>1</show_in_store>
371
+ </guest_template>
372
+ </fields>
373
+ </creditmemo>
374
+ </groups>
375
+ </clm24_email>
376
+ </sections>
377
+ </config>
app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/install-1.0.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ $installer = $this;
22
+ /* @var $installer Mage_Core_Model_Resource_Setup */
23
+ $this->startSetup()->run("
24
+ CREATE TABLE {$this->getTable('clm24_myidshipping')} (
25
+ `entity_id` int(10) unsigned NOT NULL auto_increment,
26
+ `order_grid_id` int(10) unsigned NOT NULL COMMENT 'Order grid Id',
27
+ `attribute` varchar(255) DEFAULT NULL,
28
+ `value` TEXT DEFAULT NULL,
29
+ PRIMARY KEY (`entity_id`)
30
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
31
+ ")->endSetup();
32
+
app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/upgrade-1.0-1.1.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ $installer = $this;
22
+ /* @var $installer Mage_Core_Model_Resource_Setup */
23
+ $this->startSetup()->run("
24
+ CREATE TABLE {$this->getTable('clm24_myidshipping_ordergrid')} (
25
+ `entity_id` int(10) unsigned NOT NULL auto_increment,
26
+ `order_id` int(10) unsigned NOT NULL COMMENT 'Order Id',
27
+ `real_order_id` varchar(255) DEFAULT NULL,
28
+ `order_status_id` int(11) DEFAULT NULL COMMENT '0: Pending, 1: Accepted, 2: Rejected, 3: Completed',
29
+ `order_group_id` varchar(255) DEFAULT NULL,
30
+ `max_shipment` int(10) unsigned NOT NULL,
31
+ `created_at` timestamp NULL DEFAULT NULL COMMENT 'Created At',
32
+ `updated_at` timestamp NULL DEFAULT NULL COMMENT 'Updated At',
33
+ PRIMARY KEY (`entity_id`)
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
35
+ ")->endSetup();
36
+
app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/upgrade-1.1-1.2.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ $installer = $this;
22
+ /* @var $installer Mage_Core_Model_Resource_Setup */
23
+
24
+ $this->startSetup()->run("
25
+ DROP TABLE IF EXISTS {$this->getTable('clm24_myidshipping')};
26
+ ")->endSetup();
27
+
28
+ $this->startSetup()->run("
29
+ CREATE TABLE {$this->getTable('clm24_myidshipping')} (
30
+ `entity_id` int(10) unsigned NOT NULL auto_increment,
31
+ `order_grid_id` int(10) unsigned NOT NULL COMMENT 'Order grid Id',
32
+ `attribute` varchar(255) DEFAULT NULL,
33
+ `value` TEXT DEFAULT NULL,
34
+ PRIMARY KEY (`entity_id`)
35
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
36
+ ")->endSetup();
37
+
app/code/local/Xclm24/Myidshipping/sql/myidshipping_setup/upgrade-1.2-1.3.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ $installer = $this;
22
+ /* @var $installer Mage_Core_Model_Resource_Setup */
23
+ $this->startSetup()->run("
24
+ CREATE TABLE {$this->getTable('clm24_myidcoupon')} (
25
+ `entity_id` int(10) unsigned NOT NULL auto_increment,
26
+ `rule_id` int(10) unsigned NOT NULL COMMENT 'Rule Id fo salesrule',
27
+ `ship2myid_only` smallint(6) unsigned DEFAULT NULL COMMENT 'For ship2myid only',
28
+ PRIMARY KEY (`entity_id`)
29
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8
30
+ ")->endSetup();
31
+
app/design/adminhtml/default/default/layout/myidshipping.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <layout version="0.1.0">
23
+ <adminhtml_sales_order_view>
24
+ <reference name="order_info">
25
+ <action ifconfig="clm24core/shippings/enabled" method='setTemplate'>
26
+ <template>myidshipping/sales/order/view/info.phtml</template>
27
+ </action>
28
+ </reference>
29
+ </adminhtml_sales_order_view>
30
+ <adminhtml_sales_order_index>
31
+ <reference name="head">
32
+ <action ifconfig="clm24core/shippings/enabled" method="addCss"><name>myidshipping.css</name></action>
33
+ </reference>
34
+ </adminhtml_sales_order_index>
35
+ </layout>
app/design/adminhtml/default/default/template/myidshipping/sales/order/view/info.phtml ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ ?>
21
+ <?php $_order = $this->getOrder() ?>
22
+ <?php
23
+ $orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true);
24
+ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
25
+ ?>
26
+ <div class="box-left">
27
+ <!--Order Information-->
28
+ <div class="entry-edit">
29
+ <?php if ($_order->getEmailSent()):
30
+ $_email = Mage::helper('sales')->__('the order confirmation email was sent');
31
+ else:
32
+ $_email = Mage::helper('sales')->__('the order confirmation email is not sent');
33
+ endif; ?>
34
+ <div class="entry-edit-head">
35
+ <?php if ($this->getNoUseOrderLink()): ?>
36
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4>
37
+ <?php else: ?>
38
+ <a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a>
39
+ <strong>(<?php echo $_email ?>)</strong>
40
+ <?php endif; ?>
41
+ </div>
42
+ <div class="fieldset">
43
+ <table cellspacing="0" class="form-list">
44
+ <tr>
45
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date') ?></label></td>
46
+ <td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
47
+ </tr>
48
+ <?php if ($orderAdminDate != $orderStoreDate):?>
49
+ <tr>
50
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
51
+ <td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
52
+ </tr>
53
+ <?php endif;?>
54
+ <tr>
55
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
56
+ <td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
57
+ </tr>
58
+ <tr>
59
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
60
+ <td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td>
61
+ </tr>
62
+ <?php if($_order->getRelationChildId()): ?>
63
+ <tr>
64
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the New Order') ?></label></td>
65
+ <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationChildId()) ?>">
66
+ <?php echo $_order->getRelationChildRealId() ?>
67
+ </a></td>
68
+ </tr>
69
+ <?php endif; ?>
70
+ <?php if($_order->getRelationParentId()): ?>
71
+ <tr>
72
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the Previous Order') ?></label></td>
73
+ <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationParentId()) ?>">
74
+ <?php echo $_order->getRelationParentRealId() ?>
75
+ </a></td>
76
+ </tr>
77
+ <?php endif; ?>
78
+ <?php if (version_compare(Mage::getVersion(), '1.7.0.0') >= 0) {
79
+ if($_order->getRemoteIp() && $this->shouldDisplayCustomerIp()): ?>
80
+ <tr>
81
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
82
+ <td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $this->escapeHtml($_order->getXForwardedFor()) . ')':''; ?></strong></td>
83
+ </tr>
84
+ <?php endif;
85
+ } elseif (version_compare(Mage::getVersion(), '1.7.0.0', "<")) {
86
+ if($_order->getRemoteIp()): ?>
87
+ <tr>
88
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
89
+ <td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $_order->getXForwardedFor() . ')':''; ?></strong></td>
90
+ </tr>
91
+ <?php endif;
92
+ } ?>
93
+
94
+ <?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
95
+ <tr>
96
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
97
+ <td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
98
+ </tr>
99
+ <?php endif; ?>
100
+ <?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
101
+ <tr>
102
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
103
+ <td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
104
+ </tr>
105
+ <?php endif; ?>
106
+ </table>
107
+ </div>
108
+ </div>
109
+ </div>
110
+ <div class="box-right">
111
+ <!--Account Information-->
112
+ <div class="entry-edit">
113
+ <div class="entry-edit-head">
114
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
115
+ <div class="tools"><?php echo $this->getAccountEditLink()?></div>
116
+ </div>
117
+ <div class="fieldset">
118
+ <div class="hor-scroll">
119
+ <table cellspacing="0" class="form-list">
120
+ <tr>
121
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
122
+ <td class="value">
123
+ <?php if ($_customerUrl=$this->getCustomerViewUrl()) : ?>
124
+ <a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong></a>
125
+ <?php else: ?>
126
+ <strong><?php echo $this->htmlEscape($_order->getCustomerName()) ?></strong>
127
+ <?php endif; ?>
128
+ </td>
129
+ </tr>
130
+ <tr>
131
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
132
+ <td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td>
133
+ </tr>
134
+ <?php if ($_groupName = $this->getCustomerGroupName()) : ?>
135
+ <tr>
136
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
137
+ <td class="value"><strong><?php echo $_groupName ?></strong></td>
138
+ </tr>
139
+ <?php endif; ?>
140
+ <?php foreach ($this->getCustomerAccountData() as $data):?>
141
+ <tr>
142
+ <td class="label"><label><?php echo $data['label'] ?></label></td>
143
+ <td class="value"><strong><?php echo $data['value'] ?></strong></td>
144
+ </tr>
145
+ <?php endforeach;?>
146
+ </table>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </div>
151
+ <div class="clear"></div>
152
+
153
+ <div class="box-left">
154
+ <!--Billing Address-->
155
+ <div class="entry-edit">
156
+ <div class="entry-edit-head">
157
+ <h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
158
+ <div class="tools"><?php echo $this->getAddressEditLink($_order->getBillingAddress())?></div>
159
+ </div>
160
+ <fieldset>
161
+ <address><?php echo $_order->getBillingAddress()->getFormated(true) ?></address>
162
+ </fieldset>
163
+ </div>
164
+ </div>
165
+ <?php if (!$this->getOrder()->getIsVirtual()): ?>
166
+ <div class="box-right">
167
+ <!--Shipping Address-->
168
+ <div class="entry-edit">
169
+ <div class="entry-edit-head">
170
+ <h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
171
+ <div class="tools"><?php echo $this->getAddressEditLink($_order->getShippingAddress())?></div>
172
+ </div>
173
+ <fieldset>
174
+ <address>
175
+ <?php $_shippinng_address = $_order->getShippingAddress()->getFormated(true) ?>
176
+ <?php
177
+ $clm24_model = Mage::getModel("myidshipping/ordergrid");
178
+ $orderClm24Data = $clm24_model->getCollection()->addFieldToFilter('order_id',$_order->getRealOrderId())->getFirstItem();
179
+ $orderData = $orderClm24Data->getEntityId();
180
+ $resource = Mage::getSingleton('core/resource');
181
+ $readConnection = $resource->getConnection('core_read');
182
+ $writeConnection = $resource->getConnection('core_write');
183
+ $table = $resource->getTableName('myidshipping/shipping');
184
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='r_telephone'";
185
+ $receivertel = $readConnection->fetchOne($query);
186
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='firstname'";
187
+ $firstname = $readConnection->fetchOne($query);
188
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='lastname'";
189
+ $lastname = $readConnection->fetchOne($query);
190
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='email'";
191
+ $email = $readConnection->fetchOne($query);
192
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='telephone_no'";
193
+ $telephone_no = $readConnection->fetchOne($query);
194
+ $name = $firstname . ' ' . $lastname . '<br/>' .$email;
195
+
196
+ $_shippinng_address = str_ireplace('ShipToMyID Service', $name, $_shippinng_address);
197
+ $_shippinng_address = str_ireplace('Ship2MyId Service', $name, $_shippinng_address);
198
+ $_shippinng_address = str_ireplace('T: X', 'T: '.$telephone_no, $_shippinng_address);
199
+ echo $_shippinng_address;
200
+ if(!empty($receivertel)){
201
+ ?>
202
+ <br/>T (Provided by Receiver): <?php echo $receivertel; ?>
203
+
204
+ <?php } ?>
205
+ </address>
206
+ </fieldset>
207
+ </div>
208
+ </div>
209
+ <div class="clear"></div>
210
+ <?php endif; ?>
app/design/adminhtml/default/default/template/myidshipping/system/config/fieldset/hint.phtml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ ?>
21
+ <?php
22
+ if ($this->getHelpLink()):
23
+ ?>
24
+ <div class="myidshipping-notice">
25
+ <?php echo Mage::helper('myidshipping')->__('To learn more about Ship2MyID, please click <a href="%s" target="_blank">here</a>.', $this->getHelpLink()); ?>
26
+ </div>
27
+ <?php
28
+ endif;
29
+ ?>
30
+
app/design/frontend/base/default/layout/myidshipping.xml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <layout version="0.1.0">
23
+ <checkout_onepage_index>
24
+ <reference name="head">
25
+
26
+ <action method="addItem" ifconfig="clm24core/shippings/enabled"><type>skin_css</type><name>css/myshipping/lightwindow.css</name></action>
27
+
28
+ <action method="addItem" ifconfig="clm24core/shippings/enabled"><type>skin_js</type><name>js/myshipping/lightwindow.js</name></action>
29
+ <action method="addItem" ifconfig="clm24core/shippings/enabled"><type>skin_js</type><name>js/myshipping/inline.js</name></action>
30
+
31
+ </reference>
32
+
33
+ <reference name="content">
34
+ <reference name="checkout.onepage.billing">
35
+ <block type="core/template" name="myidshipping" as="myidshipping" template="myidshipping/myidshipping.phtml"/>
36
+ </reference>
37
+ </reference>
38
+
39
+ </checkout_onepage_index>
40
+
41
+ <midshipping_myid_popuphandler>
42
+ <remove name="right"/>
43
+ <remove name="left"/>
44
+
45
+ <block type="myidshipping/myidpopup" name="root" output="toHtml" template="myidshipping/myidpopup.phtml"/>
46
+
47
+ </midshipping_myid_popuphandler>
48
+
49
+ <checkout_onepage_shippingmethod>
50
+ <!-- Mage_Checkout -->
51
+ <remove name="right"/>
52
+ <remove name="left"/>
53
+
54
+ <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="checkout/onepage/shipping_method/available.phtml"/>
55
+ </checkout_onepage_shippingmethod>
56
+
57
+ <checkout_onepage_progress_shipping>
58
+ <!-- Mage_Checkout -->
59
+ <remove name="right"/>
60
+ <remove name="left"/>
61
+
62
+ <block type="checkout/onepage_progress" name="root" output="toHtml" template="myidshipping/progress/shipping.phtml">
63
+ <action method="setInfoTemplate"><method></method><template></template></action>
64
+ </block>
65
+ </checkout_onepage_progress_shipping>
66
+
67
+ <!-- This block is depricated in new versions -->
68
+ <checkout_onepage_progress>
69
+ <!-- Mage_Checkout -->
70
+ <remove name="right"/>
71
+ <remove name="left"/>
72
+
73
+ <block type="checkout/onepage_progress" name="root" output="toHtml" template="myidshipping/progress/progress.phtml">
74
+ <block type="checkout/onepage_payment_info" name="payment_info">
75
+ <action method="setInfoTemplate"><method></method><template></template></action>
76
+ </block>
77
+ </block>
78
+ </checkout_onepage_progress>
79
+
80
+
81
+ <sales_order_view>
82
+ <label>Customer My Account Order View</label>
83
+
84
+ <reference name="my.account.wrapper">
85
+ <block type="sales/order_info" as="info" name="sales.order.info" template="myidshipping/sales/order/info.phtml">
86
+ <block type="sales/order_info_buttons" as="buttons" name="sales.order.info.buttons" />
87
+ </block>
88
+ <block type="sales/order_view" name="sales.order.view">
89
+ <block type="sales/order_items" name="order_items" template="sales/order/items.phtml">
90
+ <action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>sales/order/items/renderer/default.phtml</template></action>
91
+ <action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>sales/order/items/renderer/default.phtml</template></action>
92
+ <block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
93
+ <action method="setLabelProperties"><value>colspan="4" class="a-right"</value></action>
94
+ <action method="setValueProperties"><value>class="last a-right"</value></action>
95
+ <block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml" />
96
+ </block>
97
+ </block>
98
+ </block>
99
+ </reference>
100
+ <reference name="sales.order.info">
101
+ <action method="addLink" translate="label" module="sales"><name>view</name><path></path><label>Order Information</label></action>
102
+ <action method="addLink" translate="label" module="sales"><name>invoice</name><path>*/*/invoice</path><label>Invoices</label></action>
103
+ <action method="addLink" translate="label" module="sales"><name>shipment</name><path>*/*/shipment</path><label>Shipments</label></action>
104
+ <action method="addLink" translate="label" module="sales"><name>creditmemo</name><path>*/*/creditmemo</path><label>Refunds</label></action>
105
+ </reference>
106
+ <block type="core/text_list" name="additional.product.info" translate="label">
107
+ <label>Additional Product Info</label>
108
+ </block>
109
+ </sales_order_view>
110
+
111
+ </layout>
app/design/frontend/base/default/template/myidshipping/myidpopup.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ ?>
21
+ <script type="text/javascript">
22
+ parent.document.getElementById("use_mapmyid").value=1;
23
+ parent.document.getElementById("skip_shipping").value=1;
24
+ parent.document.getElementById("is_ship2myid_order_flag").value=1;
25
+ parent.myLightWindow.deactivate();
26
+ </script>
app/design/frontend/base/default/template/myidshipping/myidshipping.phtml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+
21
+ $base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
22
+ ?>
23
+
24
+ <li class="control">
25
+ <!-- class="required" -->
26
+ <input class="radio use_mapmyid_label" type="radio" name="billing[use_for_shipping]" id="billing:use_myid" value="1" title="<?php echo $this->__('Use Ship2MyID if you don\'t have receivers physical address.') ?>" /><label id="use_mapmyid_label" style="cursor: pointer" for="billing:use_myid"><?php echo $this->__('Use Ship2MyID if you don\'t have receivers physical address.') ?><!--<em>*</em>--></label>&nbsp;
27
+ <a class="myid-moreinfo-link lightwindow page-options" params="lightwindow_width=<?php echo Mage::getStoreConfig('clm24core/shippings/clm24popwidth') ?>,lightwindow_height=<?php echo Mage::getStoreConfig('clm24core/shippings/clm24popheight') ?>,lightwindow_loading_animation=true" href="<?php echo Mage::helper('myidshipping')->getYtVideoUrl(); ?>" >What is Ship2MyID?</a>
28
+ <input type="hidden" class="validate-ship2myid-option" name="billing[use_mapmyid]" id="use_mapmyid" value="0" />
29
+ <input type="hidden" name="skip_shipping" id="skip_shipping" value="0" />
30
+ <input type="hidden" name="is_ship2myid_order_flag" id="is_ship2myid_order_flag" value="0" />
31
+ <?php if (Mage::helper('myidshipping')->showPayPalNotice()): ?>
32
+ <br class="clear"/>
33
+ <span class="paypal-notice">(<?php echo $this->__('Ship2MyId does not support International Shipping and PayPal Express Checkout'); ?>)</span>
34
+ <?php endif; ?>
35
+ </li>
36
+
37
+ <a title="MapMyID Address Book" style="display:none;" id="mapmyidbutton" params="lightwindow_width=<?php echo Mage::getStoreConfig('clm24core/shippings/clm24popwidth') ?>,lightwindow_height=<?php echo Mage::getStoreConfig('clm24core/shippings/clm24popheight') ?>,lightwindow_loading_animation=true" class="lightwindow page-options lightwindow_mapmyid" href="<?php echo Mage::getStoreConfig('clm24core/shippings/clm24popurl') ?>&callback=<?php echo $this->getUrl('myidshipping/index/postback'); ?>">MapMyID Address Book</a>
38
+ <script type="text/javascript">
39
+ $$('.use_mapmyid_label').invoke('observe', 'click', function() {
40
+ document.getElementById("billing:use_myid").checked = true;
41
+ document.getElementById("skip_shipping").value = 0;
42
+ //document.getElementById("use_mapmyid").value=1;
43
+ $$('#mapmyidbutton')[0].click();
44
+ });
45
+ $$('.radio').invoke('observe', 'click', function() {
46
+ if (this.id == 'billing:use_for_shipping_yes' || this.id == 'billing:use_for_shipping_no' || this.id == 'billing:use_myid') {
47
+ if (this.id == 'billing:use_for_shipping_yes' || this.id == 'billing:use_for_shipping_no') {
48
+ document.getElementById("use_mapmyid").value = 1;
49
+ document.getElementById("skip_shipping").value = 0;
50
+ document.getElementById("is_ship2myid_order_flag").value=0;
51
+ } else {
52
+ document.getElementById("use_mapmyid").value = 0;
53
+ if (Validation) { // 1.
54
+ Validation.addAllThese([// 2.
55
+ ['validate-ship2myid-option', 'Please enter receivers details. Click on radio button to open Popup.', function(v) {
56
+ return v == 1;
57
+ }]
58
+ ])
59
+ }
60
+
61
+ }
62
+ }
63
+ });
64
+ function getBaseUrl() { return '<?php echo $base_url; ?>'; }
65
+ </script>
app/design/frontend/base/default/template/myidshipping/progress/progress.phtml ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ ?>
21
+ <div class="block block-progress opc-block-progress">
22
+ <div class="block-title">
23
+ <strong><span><?php echo $this->__('Your Checkout Progress') ?></span></strong>
24
+ </div>
25
+
26
+ <?php if (version_compare(Mage::getVersion(), '1.7.0.0') >= 0) { ?>
27
+
28
+ <div class="block-content">
29
+ <dl>
30
+ <?php
31
+ if ($this->getCheckout()->getStepData('billing', 'is_show')):
32
+ ?>
33
+ <?php if ($this->isStepComplete('billing')): ?>
34
+ <dt class="complete">
35
+ <?php echo $this->__('Billing Address') ?> <span class="separator">|</span>
36
+ <a href="#billing" onclick="checkout.gotoSection('billing');
37
+ return false;"><?php echo $this->__('Change') ?></a>
38
+ </dt>
39
+ <dd class="complete">
40
+ <address><?php echo $this->getBilling()->format('html') ?></address>
41
+ </dd>
42
+ <?php else: ?>
43
+ <dt>
44
+ <?php echo $this->__('Billing Address') ?>
45
+ </dt>
46
+ <?php endif; ?>
47
+ <?php endif; ?>
48
+
49
+ <?php if ($this->getCheckout()->getStepData('shipping', 'is_show')): ?>
50
+ <?php if ($this->isStepComplete('shipping')): ?>
51
+ <?php
52
+ $session = Mage::getSingleton('checkout/session');
53
+ $use_mapmyid = $session->getData('use_mapmyid');
54
+ $recemail = $session->getData('ship2myid');
55
+ ?>
56
+
57
+ <dt class="complete">
58
+ <?php echo $this->__('Shipping Address') ?>
59
+ <?php if ($use_mapmyid != 1) { ?>
60
+ <span class="separator">|</span>
61
+ <a href="#payment" onclick="checkout.gotoSection('shipping');
62
+ return false;"><?php echo $this->__('Change') ?></a>
63
+ <?php } ?>
64
+ </dt>
65
+ <dd class="complete">
66
+ <address>
67
+ <?php
68
+ if ($use_mapmyid == 1) {
69
+ echo $recemail["email"] . "</br>";
70
+ echo $recemail["firstname"] . " " . $recemail["lastname"] . "</br>";
71
+ echo "T : " . $recemail["telephone"] . "</br>";
72
+ } else {
73
+ echo $this->getShipping()->format('html');
74
+ }
75
+ ?>
76
+ </address>
77
+ </dd>
78
+ <?php else: ?>
79
+ <dt>
80
+ <?php echo $this->__('Shipping Address') ?>
81
+ </dt>
82
+ <?php endif; ?>
83
+ <?php endif; ?>
84
+
85
+ <?php if ($this->getCheckout()->getStepData('shipping_method', 'is_show')): ?>
86
+ <?php if ($this->isStepComplete('shipping_method')): ?>
87
+ <dt class="complete">
88
+ <?php echo $this->__('Shipping Method') ?> <span class="separator">|</span>
89
+ <a href="#shipping_method" onclick="checkout.gotoSection('shipping_method');
90
+ return false;"><?php echo $this->__('Change') ?></a>
91
+ </dt>
92
+ <dd class="complete">
93
+ <?php if ($this->getShippingMethod()): ?>
94
+ <?php echo $this->escapeHtml($this->getShippingDescription()) ?>
95
+
96
+ <?php $_excl = $this->getShippingPriceExclTax(); ?>
97
+ <?php $_incl = $this->getShippingPriceInclTax(); ?>
98
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
99
+ <?php echo $_incl; ?>
100
+ <?php else: ?>
101
+ <?php echo $_excl; ?>
102
+ <?php endif; ?>
103
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
104
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
105
+ <?php endif; ?>
106
+
107
+ <?php else: ?>
108
+ <?php echo $this->__('Shipping method has not been selected yet') ?>
109
+ <?php endif; ?>
110
+ </dd>
111
+ <?php else: ?>
112
+ <dt>
113
+ <?php echo $this->__('Shipping Method') ?>
114
+ </dt>
115
+ <?php endif; ?>
116
+ <?php endif; ?>
117
+
118
+ <?php if ($this->getCheckout()->getStepData('payment', 'is_show')): ?>
119
+ <?php if ($this->isStepComplete('payment')): ?>
120
+ <dt class="complete">
121
+ <?php echo $this->__('Payment Method') ?> <span class="separator">|</span>
122
+ <a href="#payment" onclick="checkout.gotoSection('payment');
123
+ return false;"><?php echo $this->__('Change') ?></a>
124
+ </dt>
125
+ <dd class="complete">
126
+ <?php echo $this->getPaymentHtml() ?>
127
+ </dd>
128
+ <?php else: ?>
129
+ <dt>
130
+ <?php echo $this->__('Payment Method') ?>
131
+ </dt>
132
+ <?php endif; ?>
133
+ <?php endif; ?>
134
+ </dl>
135
+ </div>
136
+
137
+ <?php } elseif (version_compare(Mage::getVersion(), '1.7.0.0', "<")) { ?>
138
+
139
+
140
+ <div class="block-content">
141
+ <dl>
142
+ <?php if ($this->getCheckout()->getStepData('billing', 'is_show')): ?>
143
+ <?php if ($this->getCheckout()->getStepData('billing', 'complete')): ?>
144
+ <dt class="complete">
145
+ <?php echo $this->__('Billing Address') ?> <span class="separator">|</span> <a href="#billing" onclick="checkout.accordion.openSection('opc-billing');
146
+ return false;"><?php echo $this->__('Change') ?></a>
147
+ </dt>
148
+ <dd class="complete">
149
+ <address><?php echo $this->getBilling()->format('html') ?></address>
150
+ </dd>
151
+ <?php else: ?>
152
+ <dt>
153
+ <?php echo $this->__('Billing Address') ?>
154
+ </dt>
155
+ <?php endif; ?>
156
+ <?php endif; ?>
157
+
158
+ <?php if ($this->getCheckout()->getStepData('shipping', 'is_show')): ?>
159
+ <?php if ($this->getCheckout()->getStepData('shipping', 'complete')): ?>
160
+ <?php
161
+ $session = Mage::getSingleton('checkout/session');
162
+ $use_mapmyid = $session->getData('use_mapmyid');
163
+ $recemail = $session->getData('ship2myid');
164
+ ?>
165
+ <dt class="complete">
166
+ <?php echo $this->__('Shipping Address') ?> <span class="separator">
167
+ <?php if ($use_mapmyid != 1) { ?>
168
+ |</span> <a href="#payment" onclick="checkout.accordion.openSection('opc-shipping');
169
+ return false;"><?php echo $this->__('Change') ?></a>
170
+ <?php } ?>
171
+ </dt>
172
+ <dd class="complete">
173
+ <address>
174
+ <?php
175
+ if ($use_mapmyid == 1) {
176
+ echo $recemail["email"] . "</br>";
177
+ echo $recemail["firstname"] . " " . $recemail["lastname"] . "</br>";
178
+ echo "T : " . $recemail["telephone"] . "</br>";
179
+ } else {
180
+ echo $this->getShipping()->format('html');
181
+ }
182
+ ?>
183
+
184
+
185
+ <?php //echo $this->getShipping()->format('html') ?></address>
186
+ </dd>
187
+ <?php else: ?>
188
+ <dt>
189
+ <?php echo $this->__('Shipping Address') ?>
190
+ </dt>
191
+ <?php endif; ?>
192
+ <?php endif; ?>
193
+
194
+ <?php if ($this->getCheckout()->getStepData('shipping_method', 'is_show')): ?>
195
+ <?php if ($this->getCheckout()->getStepData('shipping_method', 'complete')): ?>
196
+ <dt class="complete">
197
+ <?php echo $this->__('Shipping Method') ?> <span class="separator">|</span> <a href="#shipping_method" onclick="checkout.accordion.openSection('opc-shipping_method');
198
+ return false;"><?php echo $this->__('Change') ?></a>
199
+ </dt>
200
+ <dd class="complete">
201
+ <?php if ($this->getShippingMethod()): ?>
202
+ <?php echo $this->getShippingDescription() ?>
203
+
204
+ <?php $_excl = $this->getShippingPriceExclTax(); ?>
205
+ <?php $_incl = $this->getShippingPriceInclTax(); ?>
206
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
207
+ <?php echo $_incl; ?>
208
+ <?php else: ?>
209
+ <?php echo $_excl; ?>
210
+ <?php endif; ?>
211
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
212
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
213
+ <?php endif; ?>
214
+
215
+ <?php else: ?>
216
+ <?php echo $this->__('Shipping method has not been selected yet') ?>
217
+ <?php endif; ?>
218
+ </dd>
219
+ <?php else: ?>
220
+ <dt>
221
+ <?php echo $this->__('Shipping Method') ?>
222
+ </dt>
223
+ <?php endif; ?>
224
+ <?php endif; ?>
225
+
226
+ <?php if ($this->getCheckout()->getStepData('payment', 'is_show')): ?>
227
+ <?php if ($this->getCheckout()->getStepData('payment', 'complete')): ?>
228
+ <dt class="complete">
229
+ <?php echo $this->__('Payment Method') ?> <span class="separator">|</span> <a href="#payment" onclick="checkout.accordion.openSection('opc-payment');
230
+ return false;"><?php echo $this->__('Change') ?></a>
231
+ </dt>
232
+ <dd class="complete">
233
+ <?php echo $this->getPaymentHtml() ?>
234
+ </dd>
235
+ <?php else: ?>
236
+ <dt>
237
+ <?php echo $this->__('Payment Method') ?>
238
+ </dt>
239
+ <?php endif; ?>
240
+ <?php endif; ?>
241
+ </dl>
242
+ </div>
243
+ <?php } ?>
244
+ </div>
app/design/frontend/base/default/template/myidshipping/progress/shipping.phtml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ ?>
21
+
22
+ <?php if ($this->getCheckout()->getStepData('shipping', 'complete')): ?>
23
+ <?php $completeClass = $this->getCheckout()->getStepData('shipping', 'complete') ? 'complete' : ''; ?>
24
+ <dt class="<?php echo $completeClass ?>">
25
+ <?php
26
+ $session = Mage::getSingleton('checkout/session');
27
+ $use_mapmyid = $session->getData('use_mapmyid');
28
+ $recemail = $session->getData('ship2myid');
29
+ //Zend_Debug::dump($use_mapmyid);
30
+
31
+ echo $this->__('Shipping Address') ?> <?php if ($use_mapmyid != 1) { ?><span class="changelink"><span class="separator">|</span> <a
32
+ href="#payment"
33
+ onclick="checkout.changeSection('opc-shipping');return false;"><?php echo $this->__('Change') ?></a></span><?php } ?>
34
+ </dt>
35
+ <dd class="<?php echo $completeClass ?>">
36
+ <?php if ($this->getCheckout()->getStepData('shipping', 'complete')): ?>
37
+ <address>
38
+ <?php
39
+ if ($use_mapmyid == 1) {
40
+ echo $recemail["email"] . "</br>";
41
+ echo $recemail["firstname"] . " " . $recemail["lastname"] . "</br>";
42
+
43
+ //echo "City : ".$recemail["city"]."</br>";
44
+ //echo "State : ".$recemail["region"]."</br>";
45
+ //echo "Zip : ".$recemail["postcode"]."</br>";
46
+ echo "T : " . $recemail["telephone"] . "</br>";
47
+ } else {
48
+ ?>
49
+ <?php echo $this->getShipping()->format('html') ?></address>
50
+ <?php } ?>
51
+ <?php endif; ?>
52
+ </dd>
53
+ <?php else: ?>
54
+ <dt>
55
+ <?php echo $this->__('Shipping Address') ?>
56
+ </dt>
57
+ <?php endif; ?>
app/design/frontend/base/default/template/myidshipping/sales/order/info.phtml ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * MapMyId Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
13
+ *
14
+ * @category MapMyId Inc.
15
+ * @package Xclm24_Myidshipping
16
+ * @version 1.3.0
17
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
18
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
19
+ */
20
+ /** @var $this Mage_Sales_Block_Order_Info */
21
+ ?>
22
+
23
+ <?php $_order = $this->getOrder() ?>
24
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
25
+ <div class="page-title title-buttons">
26
+ <h1><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
27
+ <?php echo $this->getChildHtml('buttons') ?>
28
+ </div>
29
+ <?php echo $this->getStatusHistoryRssUrl($_order) ?>
30
+ <dl class="order-info">
31
+ <dt><?php echo $this->__('About This Order:') ?></dt>
32
+ <dd>
33
+ <?php $_links = $this->getLinks(); ?>
34
+ <ul id="order-info-tabs">
35
+ <?php foreach ($_links as $_link): ?>
36
+ <?php if($_link->getUrl()): ?>
37
+ <li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
38
+ <?php else: ?>
39
+ <li class="current"><?php echo $_link->getLabel() ?></li>
40
+ <?php endif; ?>
41
+ <?php endforeach; ?>
42
+ </ul>
43
+ <script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'),['first','last']);</script>
44
+ </dd>
45
+ </dl>
46
+ <p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
47
+ <?php if (!$_order->getIsVirtual()): ?>
48
+ <div class="col2-set order-info-box">
49
+ <div class="col-1">
50
+ <div class="box">
51
+ <div class="box-title">
52
+ <h2><?php echo $this->__('Shipping Address') ?></h2>
53
+ </div>
54
+ <div class="box-content">
55
+ <?php
56
+ $clm24_model = Mage::getModel("myidshipping/ordergrid")->getCollection()
57
+ ->addFieldToFilter('main_table.order_id', array('eq' => $_order->getIncrementId()))->getFirstItem();
58
+ $orderData = $clm24_model->getEntityId();
59
+ if($orderData){
60
+ $resource = Mage::getSingleton('core/resource');
61
+ $readConnection = $resource->getConnection('core_read');
62
+ $writeConnection = $resource->getConnection('core_write');
63
+ $table = $resource->getTableName('myidshipping/shipping');
64
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='firstname'";
65
+ $firstname = $readConnection->fetchOne($query);
66
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='lastname'";
67
+ $lastname = $readConnection->fetchOne($query);
68
+ $query = "select value from ".$table." where order_grid_id ='".$orderData."' and attribute ='email'";
69
+ $email = $readConnection->fetchOne($query);
70
+ $name = $firstname . '<br/>' .$email;
71
+ ?>
72
+ <address>
73
+ <?php echo $name ?></br>
74
+ <?php echo Mage::getStoreConfig('clm24core/shippings/ship2myid_label');?></br>
75
+ <?php echo Mage::getStoreConfig('clm24core/shippings/street_line1');?></br>
76
+ <?php echo Mage::getStoreConfig('clm24core/shippings/street_line2');?></br>
77
+ <?php echo Mage::getStoreConfig('clm24core/shippings/city');?></br>
78
+ <?php echo "XXXXX"?></br>
79
+ <?php echo "XX"?></br>
80
+ </address>
81
+ <?php }else{
82
+ ?>
83
+ <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
84
+ <?php } ?>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ <div class="col-2">
89
+ <div class="box">
90
+ <div class="box-title">
91
+ <h2><?php echo $this->__('Shipping Method') ?></h2>
92
+ </div>
93
+ <div class="box-content">
94
+ <?php if ($_order->getShippingDescription()): ?>
95
+ <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
96
+ <?php else: ?>
97
+ <p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
98
+ <?php endif; ?>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ <?php endif; ?>
104
+ <div class="col2-set order-info-box">
105
+ <div class="col-1">
106
+ <div class="box">
107
+ <div class="box-title">
108
+ <h2><?php echo $this->__('Billing Address') ?></h2>
109
+ </div>
110
+ <div class="box-content">
111
+ <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ <div class="col-2">
116
+ <div class="box box-payment">
117
+ <div class="box-title">
118
+ <h2><?php echo $this->__('Payment Method') ?></h2>
119
+ </div>
120
+ <div class="box-content">
121
+ <?php echo $this->getPaymentInfoHtml() ?>
122
+ </div>
123
+ </div>
124
+ </div>
125
+ </div>
app/etc/modules/Xclm24_Checkout.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Xclm24_Checkout>
25
+ <active>true</active>
26
+ <codePool>local</codePool>
27
+ <depends>
28
+ <Mage_Checkout/>
29
+ </depends>
30
+ </Xclm24_Checkout>
31
+ </modules>
32
+ </config>
app/etc/modules/Xclm24_Myidshipping.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * MapMyId Inc.
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
14
+ *
15
+ * @category MapMyId Inc.
16
+ * @package Xclm24_Myidshipping
17
+ * @version 1.3.0
18
+ * @author MapMyId Inc. Team <developer@ship2myid.com>
19
+ * @copyright Copyright (C) 2013 MapMyId Inc. (http://www.mapmyid.com/)
20
+ */
21
+ -->
22
+ <config>
23
+ <modules>
24
+ <Xclm24_Myidshipping>
25
+ <active>true</active>
26
+ <codePool>local</codePool>
27
+ </Xclm24_Myidshipping>
28
+ </modules>
29
+ </config>
app/locale/en_US/template/email/sales/clm24/creditmemo_new.html ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$order.getCustomerName()":"Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "store url=\"customer/account/\"":"Customer Account Url",
9
+ "var creditmemo.increment_id":"Credit Memo Id",
10
+ "var order.increment_id":"Order Id",
11
+ "var order.billing_address.format('html')":"Billing Address",
12
+ "payment_html":"Payment Details",
13
+ "var order.shipping_address.format('html')":"Shipping Address",
14
+ "var order.shipping_description":"Shipping Description",
15
+ "layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid",
16
+ "var comment":"Credit Memo Comment"}
17
+ @-->
18
+ <!--@styles
19
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
20
+ @-->
21
+
22
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
24
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
25
+ <tr>
26
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
27
+ <!-- [ header starts here] -->
28
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
29
+ <tr>
30
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
31
+ </tr>
32
+ <!-- [ middle starts here] -->
33
+ <tr>
34
+ <td valign="top">
35
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$order.getCustomerName()}}</h1>
36
+ <p>
37
+ Thank you for your order from {{var store.getFrontendName()}}.
38
+ You can check the status of your order by <a href="{{store url='customer/account/'}}" style="color:#1E7EC8;">logging into your account</a>.
39
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
40
+ </p>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td>
45
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #{{var creditmemo.increment_id}} for Order #{{var order.increment_id}}</h2>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <td>
50
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
51
+ <thead>
52
+ <tr>
53
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
54
+ <th width="10"></th>
55
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <tr>
60
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
61
+ {{var order.billing_address.format('html')}}
62
+ </td>
63
+ <td>&nbsp;</td>
64
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
65
+ {{var payment_html}}
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+ <br/>
71
+ {{depend order.getIsNotVirtual()}}
72
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
73
+ <thead>
74
+ <tr>
75
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
76
+ <th width="10"></th>
77
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <tr>
82
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
83
+ {{if order.isShip2myid()}}
84
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
85
+ {{var order.get_ship2myid_order_email()}}<br>
86
+ {{config path='clm24core/shippings/ship2myid_label'}}<br>
87
+ {{config path='clm24core/shippings/street_line1'}}<br>
88
+ {{config path='clm24core/shippings/street_line2'}}<br>
89
+ {{config path='clm24core/shippings/city'}}<br>
90
+ {{var order.get_ship2myid_order_postcode()}}<br>
91
+ {{var order.get_ship2myid_order_country()}}<br>
92
+ {{else}}
93
+ {{var order.get_original_shipping_address()}}
94
+ {{/if}}
95
+ &nbsp;
96
+ </td>
97
+ <td>&nbsp;</td>
98
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
99
+ {{var order.shipping_description}}
100
+ &nbsp;
101
+ </td>
102
+ </tr>
103
+ </tbody>
104
+ </table>
105
+ <br/>
106
+ {{/depend}}
107
+ {{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}}
108
+ <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p>
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
113
+ </tr>
114
+ </table>
115
+ </td>
116
+ </tr>
117
+ </table>
118
+ </div>
119
+ </body>
app/locale/en_US/template/email/sales/clm24/creditmemo_new_guest.html ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Credit Memo # {{var creditmemo.increment_id}} for Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$billing.getName()":"Guest Customer Name (Billing)",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "var creditmemo.increment_id":"Credit Memo Id",
9
+ "var order.increment_id":"Order Id",
10
+ "var order.billing_address.format('html')":"Billing Address",
11
+ "var payment_html":"Payment Details",
12
+ "var order.shipping_address.format('html')":"Shipping Address",
13
+ "var order.shipping_description":"Shipping Description",
14
+ "layout handle=\"sales_email_order_creditmemo_items\" creditmemo=$creditmemo order=$order":"Credit Memo Items Grid",
15
+ "var comment":"Credit Memo Comment"}
16
+ @-->
17
+ <!--@styles
18
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
19
+ @-->
20
+
21
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
22
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
24
+ <tr>
25
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
26
+ <!-- [ header starts here] -->
27
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
28
+ <tr>
29
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
30
+ </tr>
31
+ <!-- [ middle starts here] -->
32
+ <tr>
33
+ <td valign="top">
34
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$billing.getName()}}</h1>
35
+ <p>
36
+ Thank you for your order from {{var store.getFrontendName()}}.
37
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
38
+ </p>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td>
43
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Credit Memo #{{var creditmemo.increment_id}} for Order #{{var order.increment_id}}</h2>
44
+ </td>
45
+ </tr>
46
+ <tr>
47
+ <td>
48
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
49
+ <thead>
50
+ <tr>
51
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
52
+ <th width="10"></th>
53
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr>
58
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
59
+ {{var order.billing_address.format('html')}}
60
+ </td>
61
+ <td>&nbsp;</td>
62
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
63
+ {{var payment_html}}
64
+ </td>
65
+ </tr>
66
+ </tbody>
67
+ </table>
68
+ <br/>
69
+ {{depend order.getIsNotVirtual()}}
70
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
71
+ <thead>
72
+ <tr>
73
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
74
+ <th width="10"></th>
75
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
76
+ </tr>
77
+ </thead>
78
+ <tbody>
79
+ <tr>
80
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
81
+ {{if order.isShip2myid()}}
82
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
83
+ {{var order.get_ship2myid_order_email()}}<br>
84
+ {{config path='clm24core/shippings/ship2myid_label'}}<br>
85
+ {{config path='clm24core/shippings/street_line1'}}<br>
86
+ {{config path='clm24core/shippings/street_line2'}}<br>
87
+ {{config path='clm24core/shippings/city'}}<br>
88
+ {{var order.get_ship2myid_order_postcode()}}<br>
89
+ {{var order.get_ship2myid_order_country()}}<br>
90
+ {{else}}
91
+ {{var order.get_original_shipping_address()}}
92
+ {{/if}}
93
+ &nbsp;
94
+ </td>
95
+ <td>&nbsp;</td>
96
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
97
+ {{var order.shipping_description}}
98
+ &nbsp;
99
+ </td>
100
+ </tr>
101
+ </tbody>
102
+ </table>
103
+ <br/>
104
+ {{/depend}}
105
+ {{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}}
106
+ <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
111
+ </tr>
112
+ </table>
113
+ </td>
114
+ </tr>
115
+ </table>
116
+ </div>
117
+ </body>
app/locale/en_US/template/email/sales/clm24/invoice_new.html ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$order.getCustomerName()":"Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "store url=\"customer/account/\"":"Customer Account Url",
9
+ "var invoice.increment_id":"Invoice Id",
10
+ "var order.increment_id":"Order Id",
11
+ "var order.billing_address.format('html')":"Billing Address",
12
+ "var payment_html":"Payment Details",
13
+ "var order.shipping_address.format('html')":"Shipping Address",
14
+ "var order.shipping_description":"Shipping Description",
15
+ "layout area=\"frontend\" handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid",
16
+ "var comment":"Invoice Comment"}
17
+ @-->
18
+ <!--@styles
19
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
20
+ @-->
21
+
22
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
24
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
25
+ <tr>
26
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
27
+ <!-- [ header starts here] -->
28
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
29
+ <tr>
30
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
31
+ </tr>
32
+ <!-- [ middle starts here] -->
33
+ <tr>
34
+ <td valign="top">
35
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$order.getCustomerName()}}</h1>
36
+ <p style="font-size:12px; line-height:16px; margin:0;">
37
+ Thank you for your order from {{var store.getFrontendName()}}.
38
+ You can check the status of your order by <a href="{{store url='customer/account/'}}" style="color:#1E7EC8;">logging into your account</a>.
39
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
40
+ </p>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td>
45
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #{{var invoice.increment_id}} for Order #{{var order.increment_id}}</h2>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <td>
50
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
51
+ <thead>
52
+ <tr>
53
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
54
+ <th width="10"></th>
55
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <tr>
60
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
61
+ {{var order.billing_address.format('html')}}
62
+ </td>
63
+ <td>&nbsp;</td>
64
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
65
+ {{var payment_html}}
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+ <br/>
71
+ {{depend order.getIsNotVirtual()}}
72
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
73
+ <thead>
74
+ <tr>
75
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
76
+ <th width="10"></th>
77
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <tr>
82
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
83
+ {{if order.isShip2myid()}}
84
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
85
+ {{var order.get_ship2myid_order_email()}}<br>
86
+ {{config path='clm24core/shippings/ship2myid_label'}}<br>
87
+ {{config path='clm24core/shippings/street_line1'}}<br>
88
+ {{config path='clm24core/shippings/street_line2'}}<br>
89
+ {{config path='clm24core/shippings/city'}}<br>
90
+ {{var order.get_ship2myid_order_postcode()}}<br>
91
+ {{var order.get_ship2myid_order_country()}}<br>
92
+ {{else}}
93
+ {{var order.get_original_shipping_address()}}
94
+ {{/if}}
95
+ &nbsp;
96
+ </td>
97
+ <td>&nbsp;</td>
98
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
99
+ {{var order.shipping_description}}&nbsp;
100
+ </td>
101
+ </tr>
102
+ </tbody>
103
+ </table>
104
+ <br/>
105
+ {{/depend}}
106
+ {{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}}
107
+ <p style="font-size:12px; margin:0 10px 10px 0;">{{var comment}}</p>
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></strong></p></center></td>
112
+ </tr>
113
+ </table>
114
+ </td>
115
+ </tr>
116
+ </table>
117
+ </div>
118
+ </body>
app/locale/en_US/template/email/sales/clm24/invoice_new_guest.html ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Invoice # {{var invoice.increment_id}} for Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$billing.getName()":"Guest Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "var invoice.increment_id":"Invoice Id",
9
+ "var order.increment_id":"Order Id",
10
+ "var order.billing_address.format('html')":"Billing Address",
11
+ "var payment_html":"Payment Details",
12
+ "var order.shipping_address.format('html')":"Shipping Address",
13
+ "var order.shipping_description":"Shipping Description",
14
+ "layout handle=\"sales_email_order_invoice_items\" invoice=$invoice order=$order":"Invoice Items Grid",
15
+ "var comment":"Invoice Comment"}
16
+ @-->
17
+ <!--@styles
18
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
19
+ @-->
20
+
21
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
22
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
24
+ <tr>
25
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
26
+ <!-- [ header starts here] -->
27
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
28
+ <tr>
29
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
30
+ </tr>
31
+ <!-- [ middle starts here] -->
32
+ <tr>
33
+ <td valign="top">
34
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$billing.getName()}}</h1>
35
+ <p style="font-size:12px; line-height:16px; margin:0;">
36
+ Thank you for your order from {{var store.getFrontendName()}}.
37
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
38
+ </p>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td>
43
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Invoice #{{var invoice.increment_id}} for Order #{{var order.increment_id}}</h2>
44
+ </td>
45
+ </tr>
46
+ <tr>
47
+ <td>
48
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
49
+ <thead>
50
+ <tr>
51
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
52
+ <th width="10"></th>
53
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr>
58
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
59
+ {{var order.billing_address.format('html')}}
60
+ </td>
61
+ <td>&nbsp;</td>
62
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
63
+ {{var payment_html}}
64
+ </td>
65
+ </tr>
66
+ </tbody>
67
+ </table>
68
+ <br/>
69
+ {{depend order.getIsNotVirtual()}}
70
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
71
+ <thead>
72
+ <tr>
73
+ <th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
74
+ <th width="10"></th>
75
+ <th align="left" width="650" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
76
+ </tr>
77
+ </thead>
78
+ <tbody>
79
+ <tr>
80
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
81
+ {{if order.isShip2myid()}}
82
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
83
+ {{var order.get_ship2myid_order_email()}}<br>
84
+ {{config path='clm24core/shippings/ship2myid_label'}}<br>
85
+ {{config path='clm24core/shippings/street_line1'}}<br>
86
+ {{config path='clm24core/shippings/street_line2'}}<br>
87
+ {{config path='clm24core/shippings/city'}}<br>
88
+ {{var order.get_ship2myid_order_postcode()}}<br>
89
+ {{var order.get_ship2myid_order_country()}}<br>
90
+ {{else}}
91
+ {{var order.get_original_shipping_address()}}
92
+ {{/if}}
93
+ &nbsp;
94
+ </td>
95
+ <td>&nbsp;</td>
96
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
97
+ {{var order.shipping_description}}
98
+ &nbsp;
99
+ </td>
100
+ </tr>
101
+ </tbody>
102
+ </table>
103
+ <br/>
104
+ {{/depend}}
105
+ {{layout handle="sales_email_order_invoice_items" invoice=$invoice order=$order}}
106
+ <p style="font-size:12px; margin:0 0 10px 0">{{var comment}}</p>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></strong></p></center></td>
111
+ </tr>
112
+ </table>
113
+ </td>
114
+ </tr>
115
+ </table>
116
+ </div>
117
+ </body>
app/locale/en_US/template/email/sales/clm24/order_new.html ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$order.getCustomerName()":"Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "store url=\"customer/account/\"":"Customer Account Url",
9
+ "var order.increment_id":"Order Id",
10
+ "var order.getCreatedAtFormated('long')":"Order Created At (datetime)",
11
+ "var order.getBillingAddress().format('html')":"Billing Address",
12
+ "var payment_html":"Payment Details",
13
+ "var order.getShippingAddress().format('html')":"Shipping Address",
14
+ "var order.getShippingDescription()":"Shipping Description",
15
+ "layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid",
16
+ "var order.getEmailCustomerNote()":"Email Order Note"}
17
+ @-->
18
+ <!--@styles
19
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
20
+ @-->
21
+
22
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
24
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
25
+ <tr>
26
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
27
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
28
+ <!-- [ header starts here] -->
29
+ <tr>
30
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
31
+ </tr>
32
+ <!-- [ middle starts here] -->
33
+ <tr>
34
+ <td valign="top">
35
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$order.getCustomerName()}}</h1>
36
+ <p style="font-size:12px; line-height:16px; margin:0;">
37
+ Thank you for your order from {{var store.getFrontendName()}}.
38
+ Once your package ships we will send an email with a link to track your order.
39
+ You can check the status of your order by <a href="{{store url='customer/account/'}}" style="color:#1E7EC8;">logging into your account</a>.
40
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
41
+ </p>
42
+ <p style="font-size:12px; line-height:16px; margin:0;">Your order confirmation is below. Thank you again for your business.</p>
43
+ </tr>
44
+ <tr>
45
+ <td>
46
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #{{var order.increment_id}} <small>(placed on {{var order.getCreatedAtFormated('long')}})</small></h2>
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td>
51
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
52
+ <thead>
53
+ <tr>
54
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
55
+ <th width="10"></th>
56
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
57
+ </tr>
58
+ </thead>
59
+ <tbody>
60
+ <tr>
61
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
62
+ {{var order.getBillingAddress().format('html')}}
63
+ </td>
64
+ <td>&nbsp;</td>
65
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
66
+ {{var payment_html}}
67
+ </td>
68
+ </tr>
69
+ </tbody>
70
+ </table>
71
+ <br/>
72
+ {{depend order.getIsNotVirtual()}}
73
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
74
+ <thead>
75
+ <tr>
76
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
77
+ <th width="10"></th>
78
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <tr>
83
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
84
+ {{if order.isShip2myid()}}
85
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
86
+ {{var order.get_ship2myid_order_email()}}<br>
87
+ {{var shipping}}
88
+ {{else}}
89
+ {{var shipping}}
90
+ {{/if}}
91
+ &nbsp;
92
+ </td>
93
+ <td>&nbsp;</td>
94
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
95
+ {{var order.getShippingDescription()}}
96
+ &nbsp;
97
+ </td>
98
+ </tr>
99
+ </tbody>
100
+ </table>
101
+ <br/>
102
+ {{/depend}}
103
+ {{layout handle="sales_email_order_items" order=$order}}
104
+ <p style="font-size:12px; margin:0 0 10px 0">{{var order.getEmailCustomerNote()}}</p>
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
109
+ </tr>
110
+ </table>
111
+ </td>
112
+ </tr>
113
+ </table>
114
+ </div>
115
+ </body>
app/locale/en_US/template/email/sales/clm24/order_new_guest.html ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: New Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$order.getBillingAddress().getName()":"Guest Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "var order.increment_id":"Order Id",
9
+ "var order.getCreatedAtFormated('long')":"Order Created At (datetime)",
10
+ "var order.getBillingAddress().format('html')":"Billing Address",
11
+ "var payment_html":"Payment Details",
12
+ "var order.getShippingAddress().format('html')":"Shipping Address",
13
+ "var order.getShippingDescription()":"Shipping Description",
14
+ "layout handle=\"sales_email_order_items\" order=$order":"Order Items Grid",
15
+ "var order.getEmailCustomerNote()":"Email Order Note"}
16
+ @-->
17
+ <!--@styles
18
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
19
+ @-->
20
+
21
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
22
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
24
+ <tr>
25
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
26
+ <!-- [ header starts here] -->
27
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
28
+ <tr>
29
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
30
+ </tr>
31
+ <!-- [ middle starts here] -->
32
+ <tr>
33
+ <td valign="top">
34
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$order.getBillingAddress().getName()}}</h1>
35
+ <p style="font-size:12px; line-height:16px; margin:0 0 10px 0;">
36
+ Thank you for your order from {{var store.getFrontendName()}}.
37
+ Once your package ships we will send an email with a link to track your order.
38
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
39
+ </p>
40
+ <p style="font-size:12px; line-height:16px; margin:0;">Your order confirmation is below. Thank you again for your business.</p>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td>
45
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Order #{{var order.increment_id}} <small>(placed on {{var order.getCreatedAtFormated('long')}})</small></h2>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <td>
50
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
51
+ <thead>
52
+ <tr>
53
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
54
+ <th width="10"></th>
55
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <tr>
60
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
61
+ {{var order.getBillingAddress().format('html')}}
62
+ </td>
63
+ <td>&nbsp;</td>
64
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
65
+ {{var payment_html}}
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+ <br/>
71
+ {{depend order.getIsNotVirtual()}}
72
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
73
+ <thead>
74
+ <tr>
75
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
76
+ <th width="10"></th>
77
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <tr>
82
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
83
+ {{if order.isShip2myid()}}
84
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
85
+ {{var order.get_ship2myid_order_email()}}<br>
86
+ {{var shipping}}
87
+ {{else}}
88
+ {{var shipping}}
89
+ {{/if}}
90
+
91
+ &nbsp;
92
+ </td>
93
+ <td>&nbsp;</td>
94
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
95
+ {{var order.getShippingDescription()}}
96
+ &nbsp;
97
+ </td>
98
+ </tr>
99
+ </tbody>
100
+ </table>
101
+ <br/>
102
+ {{/depend}}
103
+ {{layout handle="sales_email_order_items" order=$order}}
104
+ <p style="font-size:12px; margin:0 10px 10px 0">{{var order.getEmailCustomerNote()}}</p>
105
+ </td>
106
+ </tr>
107
+ <tr>
108
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
109
+ </tr>
110
+ </table>
111
+ </td>
112
+ </tr>
113
+ </table>
114
+ </div>
115
+ </body>
app/locale/en_US/template/email/sales/clm24/shipment_new.html ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$order.getCustomerName()":"Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "store url=\"customer/account/\"":"Customer Account Url",
9
+ "var shipment.increment_id":"Shipment Id",
10
+ "var order.increment_id":"Order Id",
11
+ "var order.billing_address.format('html')":"Billing Address",
12
+ "var payment_html":"Payment Details",
13
+ "var order.shipping_address.format('html')":"Shipping Address",
14
+ "var order.shipping_description":"Shipping Description",
15
+ "layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid",
16
+ "block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order":"Shipment Track Details",
17
+ "var comment":"Shipment Comment"}
18
+ @-->
19
+ <!--@styles
20
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
21
+ @-->
22
+
23
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
24
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
25
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
26
+ <tr>
27
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
28
+ <!-- [ header starts here] -->
29
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
30
+ <tr>
31
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
32
+ </tr>
33
+ <!-- [ middle starts here] -->
34
+ <tr>
35
+ <td valign="top">
36
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$order.getCustomerName()}}</h1>
37
+ <p style="font-size:12px; line-height:16px; margin:0;">
38
+ Thank you for your order from {{var store.getFrontendName()}}.
39
+ You can check the status of your order by <a href="{{store url='customer/account/'}}" style="color:#1E7EC8;">logging into your account</a>.
40
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
41
+ </p>
42
+ <p style="font-size:12px; line-height:16px; margin:0;">
43
+ Your shipping confirmation is below. Thank you again for your business.
44
+ </p>
45
+ </td>
46
+ </tr>
47
+ <tr>
48
+ <td>
49
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #{{var shipment.increment_id}} for Order #{{var order.increment_id}}</h2>
50
+ </td>
51
+ </tr>
52
+ <tr>
53
+ <td>
54
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
55
+ <thead>
56
+ <tr>
57
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
58
+ <th width="10"></th>
59
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ <tr>
64
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
65
+ {{var order.billing_address.format('html')}}
66
+ </td>
67
+ <td>&nbsp;</td>
68
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
69
+ {{var payment_html}}
70
+ </td>
71
+ </tr>
72
+ </tbody>
73
+ </table>
74
+ <br/>
75
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
76
+ <thead>
77
+ <tr>
78
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
79
+ <th width="10"></th>
80
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
81
+ </tr>
82
+ </thead>
83
+ <tbody>
84
+ <tr>
85
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
86
+ {{if order.isShip2myid()}}
87
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
88
+ {{var order.get_ship2myid_order_email()}}<br>
89
+ {{config path='clm24core/shippings/ship2myid_label'}}<br>
90
+ {{config path='clm24core/shippings/street_line1'}}<br>
91
+ {{config path='clm24core/shippings/street_line2'}}<br>
92
+ {{config path='clm24core/shippings/city'}}<br>
93
+ {{var order.get_ship2myid_order_postcode()}}<br>
94
+ {{var order.get_ship2myid_order_country()}}<br>
95
+ {{else}}
96
+ {{var order.get_original_shipping_address()}}
97
+ {{/if}}
98
+ &nbsp;
99
+ </td>
100
+ <td>&nbsp;</td>
101
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
102
+ {{var order.shipping_description}}
103
+ &nbsp;
104
+ </td>
105
+ </tr>
106
+ </tbody>
107
+ </table>
108
+ <br/>
109
+ {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}
110
+ {{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}
111
+ <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p>
112
+ </td>
113
+ </tr>
114
+ <tr>
115
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
116
+ </tr>
117
+ </table>
118
+ </td>
119
+ </tr>
120
+ </table>
121
+ </div>
122
+ </body>
app/locale/en_US/template/email/sales/clm24/shipment_new_guest.html ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject {{var store.getFrontendName()}}: Shipment # {{var shipment.increment_id}} for Order # {{var order.increment_id}} @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "var logo_alt":"Email Logo Image Alt",
6
+ "htmlescape var=$billing.getName()":"Guest Customer Name",
7
+ "var store.getFrontendName()":"Store Name",
8
+ "var shipment.increment_id":"Shipment Id",
9
+ "var order.increment_id":"Order Id",
10
+ "var order.billing_address.format('html')":"Billing Address",
11
+ "var payment_html":"Payment Details",
12
+ "var order.shipping_address.format('html')":"Shipping Address",
13
+ "var order.shipping_description":"Shipping Description",
14
+ "layout handle=\"sales_email_order_shipment_items\" shipment=$shipment order=$order":"Shipment Items Grid",
15
+ "block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order":"Shipment Track Details",
16
+ "var comment":"Shipment Comment"}
17
+ @-->
18
+ <!--@styles
19
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
20
+ @-->
21
+
22
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
23
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
24
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
25
+ <tr>
26
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
27
+ <!-- [ header starts here] -->
28
+ <table bgcolor="#FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
29
+ <tr>
30
+ <td valign="top"><a href="{{store url=''}}"><img src="{{skin url='images/logo_email.gif' _area='frontend'}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
31
+ </tr>
32
+ <!-- [ middle starts here] -->
33
+ <tr>
34
+ <td valign="top">
35
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Hello, {{htmlescape var=$billing.getName()}}</h1>
36
+ <p style="font-size:12px; line-height:16px; margin:0;">
37
+ Thank you for your order from {{var store.getFrontendName()}}.
38
+ If you have any questions about your order please contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or call us at <span class="nobr">{{config path='general/store_information/phone'}}</span> Monday - Friday, 8am - 5pm PST.
39
+ </p>
40
+ <p style="font-size:12px; line-height:16px; margin:0;">
41
+ Your shipping confirmation is below. Thank you again for your business.
42
+ </p>
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td>
47
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Your Shipment #{{var shipment.increment_id}} for Order #{{var order.increment_id}}</h2>
48
+ </td>
49
+ </tr>
50
+ <tr>
51
+ <td>
52
+ <table cellspacing="0" cellpadding="0" border="0" width="650">
53
+ <thead>
54
+ <tr>
55
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Billing Information:</th>
56
+ <th width="10"></th>
57
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Payment Method:</th>
58
+ </tr>
59
+ </thead>
60
+ <tbody>
61
+ <tr>
62
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
63
+ {{var order.billing_address.format('html')}}
64
+ </td>
65
+ <td>&nbsp;</td>
66
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
67
+ {{var payment_html}}
68
+ </td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+ <br/>
73
+ <table cellspacing="0" cellpadding="0" border="0" width="100%">
74
+ <thead>
75
+ <tr>
76
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Information:</th>
77
+ <th width="10"></th>
78
+ <th align="left" width="325" bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Shipping Method:</th>
79
+ </tr>
80
+ </thead>
81
+ <tbody>
82
+ <tr>
83
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
84
+ {{if order.isShip2myid()}}
85
+ {{var order.get_ship2myid_order_firstname()}} {{var order.get_ship2myid_order_lastname()}} <br>
86
+ {{var order.get_ship2myid_order_email()}}<br>
87
+ {{config path='clm24core/shippings/ship2myid_label'}}<br>
88
+ {{config path='clm24core/shippings/street_line1'}}<br>
89
+ {{config path='clm24core/shippings/street_line2'}}<br>
90
+ {{config path='clm24core/shippings/city'}}<br>
91
+ {{var order.get_ship2myid_order_postcode()}}<br>
92
+ {{var order.get_ship2myid_order_country()}}<br>
93
+ {{else}}
94
+ {{var order.get_original_shipping_address()}}
95
+ {{/if}}
96
+ &nbsp;
97
+ </td>
98
+ <td>&nbsp;</td>
99
+ <td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
100
+ {{var order.shipping_description}}
101
+ &nbsp;
102
+ </td>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+ <br/>
107
+ {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}
108
+ {{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}
109
+ <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p>
110
+ </td>
111
+ </tr>
112
+ <tr>
113
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
114
+ </tr>
115
+ </table>
116
+ </td>
117
+ </tr>
118
+ </table>
119
+ </div>
120
+ </body>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ship2MyID</name>
4
+ <version>1.3.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Generate new orders not possible before. Users can now ship to any cell, email or social ID. NO address needed. Ship to anyone without needing the receiver&#x2019;s address. </summary>
10
+ <description>Ship to anyone without needing the receiver&#x2019;s address. Generate NEW transactions which were not possible before. Buyer can send products to any cell#, email or facebook ID of the receiver. Perfect options to increase gifting transactions. Increases buyers reach by 50X. Checkout is 75X faster. Join the fastest growing gifting community and register NOW to get ONE month Free Trial and be part of our Holiday 2015 campaign.&#xD;
11
+ Register here to enable REAL social commerce in your store!</description>
12
+ <notes>Ship2MyId Magento Extension Stable Module. </notes>
13
+ <authors><author><name>MapMyId Inc.</name><user>mapmyid</user><email>developer@ship2myid.com</email></author></authors>
14
+ <date>2015-06-18</date>
15
+ <time>07:47:55</time>
16
+ <contents><target name="magelocal"><dir name="Xclm24"><dir name="Checkout"><dir name="controllers"><file name="OnepageController.php" hash="efc22613a981261e85f96834066fdf05"/></dir><dir name="etc"><file name="config.xml" hash="ebb0a27be9039dbb586562db543cf038"/></dir></dir><dir name="Myidshipping"><dir name="Block"><dir name="Adminhtml"><dir name="Promo"><dir name="Quote"><dir name="Edit"><dir name="Tab"><file name="Main.php" hash="d81c26cff7907299df6f41d6008c4f4b"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="fef2db22eed506980faea5eeb135fafb"/></dir></dir></dir></dir><dir name="GiftMessage"><dir name="Message"><file name="Inline.php" hash="33b3682eaa2c0fd59ae94369a0218dd7"/></dir></dir><file name="Myidpopup.php" hash="61eaa1dea2b2505feed44681995953fd"/></dir><dir name="Helper"><file name="Data.php" hash="a04b37a435d678c382f636e10ae1278c"/></dir><file name="LICENSE.txt" hash="59563e7be45096d0833dade102989042"/><dir name="Model"><dir name="Api"><file name="Nvp.php" hash="0ac25c34c98391870ed2e7f45c797639"/><file name="Standard.php" hash="35e6cfcee7606110691d7e7e07f1b10b"/></dir><file name="Coupon.php" hash="1dff0475ea05f05aa86e5f63d99224ea"/><file name="Cron.php" hash="955ed7f2250da19738a384235fa573f2"/><dir name="Mysql4"><dir name="Coupon"><file name="Collection.php" hash="84559f99e67f3913caa91d74729d5104"/></dir><file name="Coupon.php" hash="acc94953a52808c545794e2d5752248c"/><dir name="Ordergrid"><file name="Collection.php" hash="a31f1eb9bcbe03a9aa15a30e822ee073"/></dir><file name="Ordergrid.php" hash="5b950a238ba37ff4aee133083431423b"/><dir name="Shipping"><file name="Collection.php" hash="efe8417de77ef666b629ab6a446b5cae"/></dir><file name="Shipping.php" hash="c479f47b3119165301b84a9eea5f1992"/></dir><file name="Observer.php" hash="23fb110f703510136bf740f7ecc57fb5"/><dir name="Order"><file name="Creditmemo.php" hash="65cd9109bf90479db25a39acdd5de4f8"/><file name="Invoice.php" hash="b8946860ca48a755355cd20cab70e78b"/><file name="Shipment.php" hash="a5be17ffd46f7a6202fd96fb22545a6e"/></dir><file name="Order.php" hash="5a1822cdc3aad131787a7dccda6a0536"/><file name="Ordergrid.php" hash="e006c1a3daa90a3f84dcfddea6979dae"/><dir name="Resource"><dir name="Coupon"><file name="Collection.php" hash="518b705cfacfefd02db01bec52999972"/></dir><file name="Coupon.php" hash="ea9fee0dd1a14be1ea7f0936bee82035"/><dir name="Eav"><dir name="Mysql4"><file name="Setup.php" hash="0b13f7d0133e561e4bf3f448bf44f44c"/></dir></dir><dir name="Ordergrid"><file name="Collection.php" hash="7671ca6dfa5a62cf8037d4acacd598c9"/></dir><file name="Ordergrid.php" hash="570a985955c24d506dda7a33151d8414"/><dir name="Shipping"><file name="Collection.php" hash="f553b04dbf63ac941268b386cb333b61"/></dir><file name="Shipping.php" hash="1767bc02fd55ba51f6745b9a62a1a121"/></dir><file name="Shipping.php" hash="9c5c756ed365206990c3f77f01bcf1d4"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Order"><dir name="Status"><file name="New.php" hash="542285a4fa3a77ed8fb0eb7dcc6e369a"/><file name="Rejected.php" hash="fbe4674a1471683f3a4b01c4d4361991"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><file name="CronController.php" hash="352837a38d04f59497a43be3a951289a"/><file name="IndexController.php" hash="d970373d86729a46af454b375365b7a3"/></dir><dir name="etc"><file name="adminhtml.xml" hash="dec0f9034356963e260ab4532d631bc3"/><file name="config.xml" hash="2bd09bcc7c96660949b89f36d675dc06"/><file name="system.xml" hash="0395792804348346b892a153c7160d84"/></dir><dir name="sql"><dir name="myidshipping_setup"><file name="install-1.0.php" hash="9e0deead946b0a95e6b4c776bf648347"/><file name="upgrade-1.0-1.1.php" hash="b91538bbe460fc3f976ea68a6cb4f46b"/><file name="upgrade-1.1-1.2.php" hash="b77a0fa06d18ccd398e67fbc5035dac7"/><file name="upgrade-1.2-1.3.php" hash="ec83d385a25010ec73eaeaf2086e7301"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="myidshipping.xml" hash="7d048f5c1b1959115419cb2c58990a8e"/></dir><dir name="template"><dir name="myidshipping"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="f40d501324c83aa8c597b58ae8d0b909"/></dir></dir></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="4fb0e5b17f7c5b26285967592c066caf"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="myidshipping.xml" hash="992ccb073f766d243a0b825c31d8cc79"/></dir><dir name="template"><dir name="myidshipping"><file name="myidpopup.phtml" hash="ea0ab75a33179bdf3e1c2d45ea1288f5"/><file name="myidshipping.phtml" hash="049355ea15432af5aed7cddd24fc2dfb"/><dir name="progress"><file name="progress.phtml" hash="e66ad55efe086847054ce34471330865"/><file name="shipping.phtml" hash="f6a97b28ddbeeca7c1d04e199c92e7fd"/></dir><dir name="sales"><dir name="order"><file name="info.phtml" hash="6a98ebee7f2885d727800aa42a753eea"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Xclm24_Myidshipping.xml" hash="2aaef5e2e38924097f2d487e821a1d26"/><file name="Xclm24_Checkout.xml" hash="504077779b6e8a153fbdc6c3c3bbaa14"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="myshipping"><file name="lightwindow.css" hash="abc1b91dd29e68fcf7e5c16a32399c09"/></dir></dir><dir name="images"><dir name="mapmyid"><file name="ajax-loading.gif" hash="b6f30f316d3c10432a336a9450a2308d"/><file name="arrow-down.gif" hash="26948110b136eff06423e1acc3b911e8"/><file name="arrow-up.gif" hash="020ae96cf8ca950ed90cd3f180ab96ad"/><file name="backgroundlight.jpg" hash="f44fd699b18ff9a67a920e3e4cd3a28c"/><file name="backgroundlight.png" hash="e4fc8cd0afcac5d3fea984104e1ed048"/><file name="black-70.png" hash="703c659e4bf563a05c6338a1727e006c"/><file name="black.png" hash="1cf6a7fbea37bc350912f2d2094c2813"/><file name="nextlabel.gif" hash="485d89b62f7af7f0ce9427bb9a636e7e"/><file name="pattern_148-70.png" hash="e04ddfd5cacaa73a6b8edf5fbafe8b82"/><file name="pattern_148.gif" hash="4d56d8d3360beee6f8219ea394e0ead0"/><file name="prevlabel.gif" hash="d935f4acf56e0b83218bbdb5835e4e23"/></dir><file name="ship2myidlogo.png" hash="64a9f196c16dda35e04a26d9f2c9958c"/></dir><dir name="js"><dir name="myshipping"><file name="inline.js" hash="077f4d1c83424212581f48643dbcf8d6"/><file name="lightwindow.js" hash="d4ab0eb3f82984aa62bdf75aa43e0fbb"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="en_US"><dir name="template"><dir name="email"><dir name="sales"><dir name="clm24"><file name="creditmemo_new.html" hash="1960e2b870bebf13c9958d7646db6839"/><file name="creditmemo_new_guest.html" hash="e6a713107c626f866458334fe55bb88e"/><file name="invoice_new.html" hash="9f434f2a0dda28458d10f417b7ddf092"/><file name="invoice_new_guest.html" hash="c52197c352d6ad1edf3c19e7a1cb3c78"/><file name="order_new.html" hash="883d051a7ebd14dcf3fa19c1e19223f1"/><file name="order_new_guest.html" hash="f49b5c28657c191659bdf1c31b1746df"/><file name="shipment_new.html" hash="91ea18c2c1c94a138f144ba4e808be30"/><file name="shipment_new_guest.html" hash="fdf66327005c9b4b6fef16e6c8faf285"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Checkout</name><channel>core</channel><min></min><max></max></package></required></dependencies>
19
+ </package>
skin/frontend/base/default/css/myshipping/lightwindow.css ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #lightwindow_overlay {
2
+ /* REQUIRED */
3
+ display: none;
4
+ visibility: hidden;
5
+ position: fixed;
6
+ top: 0;
7
+ left: 0;
8
+ width: 100%;
9
+ height: 100px;
10
+ z-index: 2100;
11
+ background-image: url("../../images/mapmyid/black-70.png") !important; background-repeat: repeat !important;
12
+ /* REQUIRED */
13
+ }
14
+
15
+ #lightwindow_iframe{
16
+ /*background-color: #285ea0; */
17
+ background:url("../../images/mapmyid/backgroundlight.png");
18
+ padding-top: 5px;
19
+ vertical-align: middle;
20
+ }
21
+
22
+ #lightwindow {
23
+ /* REQUIRED */
24
+ /* Of Note - The height and width of this element are set to 0px */
25
+ display: none;
26
+ visibility: hidden;
27
+ position: absolute;
28
+ z-index: 2199;
29
+ line-height: 0px;
30
+ /* REQUIRED */
31
+ }
32
+
33
+ #lightwindow_container {
34
+ /* REQUIRED */
35
+ display: none;
36
+ visibility: hidden;
37
+ position: absolute;
38
+ /* REQUIRED */
39
+ padding: 0 0 0 0;
40
+ margin: 0 0 0 0;
41
+ }
42
+
43
+ @media only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
44
+ #lightwindow_contents {
45
+ -webkit-overflow-scrolling: touch !important;
46
+ overflow-y: scroll !important;
47
+ }
48
+ }
49
+
50
+
51
+ /* IE6 needs this or it messes with our positioning */
52
+ * html #lightwindow_container {
53
+ overflow: hidden;
54
+ }
55
+
56
+ #lightwindow_contents {
57
+ overflow: hidden;
58
+ z-index: 0;
59
+ position: relative;
60
+ border: 10px solid #ffffff;
61
+ /*background-color: #285ea0;*/
62
+ background:url("../../images/mapmyid/backgroundlight.png");
63
+ padding: 0px !important;
64
+ }
65
+
66
+ #lightwindow_loading {
67
+ /* REQUIRED */
68
+ height: 100%;
69
+ width: 100%;
70
+ top: 0px;
71
+ left: 0px;
72
+ z-index: 9999;
73
+ position: absolute;
74
+ /* REQUIRED */
75
+ background-color: #f0f0f0;
76
+ padding: 10px;
77
+ }
78
+
79
+ #lightwindow_loading_shim {
80
+ display: none;
81
+ left: 0px;
82
+ position: absolute;
83
+ top: 0px;
84
+ width: 100%;
85
+ height: 100%;
86
+ }
87
+
88
+ #lightwindow_loading span {
89
+ font-size: 12px;
90
+ line-height: 32px;
91
+ color: #444444;
92
+ float: left;
93
+ padding: 0 10px 0 0;
94
+ }
95
+
96
+ #lightwindow_loading span a,
97
+ #lightwindow_loading span a:link,
98
+ #lightwindow_loading span a:visited {
99
+ color: #09F;
100
+ text-decoration: none;
101
+ cursor: pointer;
102
+ }
103
+
104
+ #lightwindow_loading span a:hover,
105
+ #lightwindow_loading span a:active {
106
+ text-decoration: underline;
107
+ }
108
+
109
+
110
+ #lightwindow_loading img {
111
+ float: left;
112
+ margin: 0 10px 0 0;
113
+ }
114
+
115
+
116
+ /*-----------------------------------------------------------------------------------------------
117
+ I liked the Navigation so much from http://www.huddletogether.com/projects/lightbox2/
118
+ I mean let's face it, it works really well and is very easy to figure out.
119
+ -----------------------------------------------------------------------------------------------*/
120
+
121
+ #lightwindow_navigation {
122
+ /* REQUIRED */
123
+ position: absolute;
124
+ top: 0px;
125
+ left: 0px;
126
+ display: none;
127
+ /* REQUIRED */
128
+ }
129
+ /* We need to shim the navigation for IE, though its more of a sub-floor */
130
+ #lightwindow_navigation_shim {
131
+ /* REQUIRED */
132
+ display: none;
133
+ left: 0px;
134
+ position: absolute;
135
+ top: 0px;
136
+ width: 100%;
137
+ height: 100%;
138
+ /* REQUIRED */
139
+ }
140
+
141
+ #lightwindow_navigation a,
142
+ #lightwindow_navigation a:link,
143
+ #lightwindow_navigation a:visited,
144
+ #lightwindow_navigation a:hover,
145
+ #lightwindow_navigation a:active {
146
+ /* REQUIRED */
147
+ outline: none;
148
+ /* REQUIRED */
149
+ }
150
+
151
+ #lightwindow_previous,
152
+ #lightwindow_next {
153
+ width: 49%;
154
+ height: 100%;
155
+ background: transparent url(../images/mapmyid/blank.gif) no-repeat; /* Trick IE into showing hover */
156
+ display: block;
157
+ }
158
+
159
+ #lightwindow_previous {
160
+ float: left;
161
+ left: 0px;
162
+ }
163
+
164
+ #lightwindow_next {
165
+ float: right;
166
+ right: 0px;
167
+ }
168
+
169
+ #lightwindow_previous:hover,
170
+ #lightwindow_previous:active {
171
+ background: url(../images/mapmyid/prevlabel.gif) left 15% no-repeat;
172
+ }
173
+
174
+ #lightwindow_next:hover,
175
+ #lightwindow_next:active {
176
+ background: url(../images/mapmyid/nextlabel.gif) right 15% no-repeat;
177
+ }
178
+
179
+ #lightwindow_previous_title,
180
+ #lightwindow_next_title {
181
+ display: none;
182
+ }
183
+
184
+ #lightwindow_galleries {
185
+ width: 100%;
186
+ position: absolute;
187
+ z-index: 50;
188
+ display: none;
189
+ overflow: hidden;
190
+ margin: 0 0 0 10px;
191
+ bottom: 0px;
192
+ left: 0px;
193
+ }
194
+
195
+ #lightwindow_galleries_tab_container {
196
+ width: 100%;
197
+ height: 0px;
198
+ overflow: hidden;
199
+ }
200
+
201
+ a#lightwindow_galleries_tab,
202
+ a:link#lightwindow_galleries_tab,
203
+ a:visited#lightwindow_galleries_tab {
204
+ display: block;
205
+ height: 20px;
206
+ width: 77px;
207
+ float: right;
208
+ line-height: 22px;
209
+ color: #ffffff;
210
+ text-decoration: none;
211
+ font-weight: bold;
212
+ cursor: pointer;
213
+ font-size: 11px;
214
+ color: #ffffbe;
215
+ background: url(../images/mapmyid/black-70.png) repeat 0 0 transparent;
216
+ }
217
+
218
+ * html a#lightwindow_galleries_tab,
219
+ * html a:link#lightwindow_galleries_tab,
220
+ * html a:visited#lightwindow_galleries_tab {
221
+ background: none;
222
+ background-color: #000000;
223
+ opacity: .70;
224
+ filter: alpha(opacity=70);
225
+ }
226
+
227
+ a:hover#lightwindow_galleries_tab,
228
+ a:active#lightwindow_galleries_tab {
229
+ color: #ffffbe;
230
+
231
+ }
232
+
233
+ #lightwindow_galleries_tab_span {
234
+ display: block;
235
+ height: 20px;
236
+ width: 63px;
237
+ padding: 0 7px 0 7px;
238
+ }
239
+
240
+ #lightwindow_galleries_tab .up {
241
+ background: url(../images/mapmyid/arrow-up.gif) no-repeat 60px 5px transparent;
242
+ }
243
+
244
+ #lightwindow_galleries_tab .down {
245
+ background: url(../images/mapmyid/arrow-down.gif) no-repeat 60px 6px transparent;
246
+ }
247
+
248
+ #lightwindow_galleries_list {
249
+ background: url(../images/mapmyid/black-70.png) repeat 0 0 transparent;
250
+ overflow: hidden;
251
+ height: 0px;
252
+ }
253
+
254
+ * html #lightwindow_galleries_list {
255
+ background: none;
256
+ background-color: #000000;
257
+ opacity: .70;
258
+ filter: alpha(opacity=70);
259
+ }
260
+
261
+ .lightwindow_galleries_list {
262
+ width: 200px;
263
+ float: left;
264
+ margin: 0 0 10px 0;
265
+ padding: 10px;
266
+ }
267
+
268
+ .lightwindow_galleries_list h1 {
269
+ color: #09F;
270
+ text-decoration: none;
271
+ font-weight: bold;
272
+ cursor: pointer;
273
+ padding: 10px 0 5px 0;
274
+ font-size: 16px;
275
+ }
276
+
277
+ .lightwindow_galleries_list li {
278
+ margin: 5px 0 5px 0;
279
+ list-style-type: none;
280
+ }
281
+
282
+ .lightwindow_galleries_list a,
283
+ .lightwindow_galleries_list a:link,
284
+ .lightwindow_galleries_list a:visited {
285
+ display: block;
286
+ line-height: 22px;
287
+ color: #ffffff;
288
+ text-decoration: none;
289
+ font-weight: bold;
290
+ cursor: pointer;
291
+ padding: 0 0 0 10px;
292
+ font-size: 11px;
293
+ }
294
+
295
+ .lightwindow_galleries_list a:hover,
296
+ .lightwindow_galleries_list a:active {
297
+ background: #000000;
298
+ color: #ffffbe;
299
+ border-left: 3px solid #ffffbe;
300
+ padding: 0 0 0 7px;
301
+ }
302
+
303
+ #lightwindow_data {
304
+ /* REQUIRED */
305
+ position: absolute;
306
+ /* REQUIRED */
307
+ }
308
+
309
+ #lightwindow_data_slide {
310
+ /* REQUIRED */
311
+ position: relative;
312
+ /* REQUIRED */
313
+ }
314
+
315
+ #lightwindow_data_slide_inner {
316
+ background-color: #ffffff;
317
+ padding: 0 10px 10px 10px;
318
+ }
319
+
320
+ #lightwindow_data_caption {
321
+ padding: 10px 0 0 0;
322
+ color: #666666;
323
+ line-height: 25px;
324
+ background-color: #ffffff;
325
+ clear: both;
326
+ }
327
+
328
+ #lightwindow_data_details {
329
+ background-color: #f0f0f0;
330
+ padding: 0 10px 0 10px;
331
+ height: 20px;
332
+ }
333
+
334
+ #lightwindow_data_author_container {
335
+ width: 40%;
336
+ text-align: right;
337
+ color: #666666;
338
+ font-style: italic;
339
+ font-size: 10px;
340
+ line-height: 20px;
341
+ float: right;
342
+ overflow: hidden;
343
+ }
344
+
345
+ #lightwindow_data_gallery_container {
346
+ font-size: 10px;
347
+ width: 40%;
348
+ text-align: left;
349
+ color: #666666;
350
+ line-height: 20px;
351
+ float: left;
352
+ overflow: hidden;
353
+ }
354
+
355
+ #lightwindow_title_bar {
356
+ height: 32px;
357
+ padding-right:16px;
358
+ overflow: hidden;
359
+ }
360
+
361
+ #lightwindow_title_bar_title {
362
+ color: #ffffbe;
363
+ font-size: 14px;
364
+ line-height: 25px;
365
+ text-align: left;
366
+ float: left;
367
+ }
368
+
369
+ a#lightwindow_title_bar_close_link,
370
+ a:link#lightwindow_title_bar_close_link,
371
+ a:visited#lightwindow_title_bar_close_link {
372
+ float: right;
373
+ text-align: right;
374
+ cursor: pointer;
375
+ color: #ffffbe;
376
+ padding: 0;
377
+ margin: 0;
378
+ z-index:9999999;
379
+ visibility:visible;display:block;background: url('http://build.mapmyid.com/rwd/assets/images/close.png') no-repeat center center;width:32px;height:32px;
380
+ }
381
+
382
+ a:hover#lightwindow_title_bar_close_link,
383
+ a:active#lightwindow_title_bar_close_link {
384
+ color: #ffffff;
385
+ }
386
+
387
+ /*-----------------------------------------------------------------------------------------------
388
+ Theme styling stuff
389
+ -----------------------------------------------------------------------------------------------*/
390
+
391
+ #lightwindow p {
392
+ color: #000000;
393
+ padding-right: 10px;
394
+ }
395
+
396
+
397
+
398
+ .shipping-progress-opcheckout-shipmyid dt span {
399
+ display:none;
400
+ }
skin/frontend/base/default/images/mapmyid/ajax-loading.gif ADDED
Binary file
skin/frontend/base/default/images/mapmyid/arrow-down.gif ADDED
Binary file
skin/frontend/base/default/images/mapmyid/arrow-up.gif ADDED
Binary file
skin/frontend/base/default/images/mapmyid/backgroundlight.jpg ADDED
Binary file
skin/frontend/base/default/images/mapmyid/backgroundlight.png ADDED
Binary file
skin/frontend/base/default/images/mapmyid/black-70.png ADDED
Binary file
skin/frontend/base/default/images/mapmyid/black.png ADDED
Binary file
skin/frontend/base/default/images/mapmyid/nextlabel.gif ADDED
Binary file
skin/frontend/base/default/images/mapmyid/pattern_148-70.png ADDED
Binary file
skin/frontend/base/default/images/mapmyid/pattern_148.gif ADDED
Binary file
skin/frontend/base/default/images/mapmyid/prevlabel.gif ADDED
Binary file
skin/frontend/base/default/images/ship2myidlogo.png ADDED
Binary file
skin/frontend/base/default/js/myshipping/inline.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ window.onmessage=function(msg) {
2
+ var fra=document.getElementById("lightwindow_iframe");
3
+ var containerdiv = document.getElementById("lightwindow_container");
4
+ var lightwindow_title_bar_close_link_obj = document.getElementById("lightwindow_title_bar_close_link");
5
+ if(msg.data && msg.data.name=="Close" && msg.source==fra.contentWindow) {
6
+ $$('#lightwindow_title_bar_close_link')[0].click();
7
+ }
8
+ };
skin/frontend/base/default/js/myshipping/lightwindow.js ADDED
@@ -0,0 +1,1922 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // lightwindow.js v2.0
2
+ //
3
+ // Copyright (c) 2007 stickmanlabs
4
+ // Author: Kevin P Miller | http://www.stickmanlabs.com
5
+ //
6
+ // LightWindow is freely distributable under the terms of an MIT-style license.
7
+ //
8
+ // I don't care what you think about the file size...
9
+ // Be a pro:
10
+ // http://www.thinkvitamin.com/features/webapps/serving-javascript-fast
11
+ // http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files
12
+ //
13
+
14
+ /*-----------------------------------------------------------------------------------------------*/
15
+
16
+ if(typeof Effect == 'undefined')
17
+ throw("lightwindow.js requires including script.aculo.us' effects.js library!");
18
+
19
+ // This will stop image flickering in IE6 when elements with images are moved
20
+ try {
21
+ document.execCommand("BackgroundImageCache", false, true);
22
+ } catch(e) {}
23
+
24
+ var lightwindow = Class.create();
25
+ lightwindow.prototype = {
26
+ //
27
+ // Setup Variables
28
+ //
29
+ element : null,
30
+ contentToFetch : null,
31
+ windowActive : false,
32
+ dataEffects : [],
33
+ dimensions : {
34
+ cruft : null,
35
+ container : null,
36
+ viewport : {
37
+ height : null,
38
+ width : null,
39
+ offsetTop : null,
40
+ offsetLeft : null
41
+ }
42
+ },
43
+ pagePosition : {
44
+ x : 0,
45
+ y : 0
46
+ },
47
+ pageDimensions : {
48
+ width : null,
49
+ height : null
50
+ },
51
+ preloadImage : [],
52
+ preloadedImage : [],
53
+ galleries : [],
54
+ resizeTo : {
55
+ height : null,
56
+ heightPercent : null,
57
+ width : null,
58
+ widthPercent : null,
59
+ fixedTop : null,
60
+ fixedLeft : null
61
+ },
62
+ scrollbarOffset : 18,
63
+ navigationObservers : {
64
+ previous : null,
65
+ next : null
66
+ },
67
+ containerChange : {
68
+ height : 0,
69
+ width : 0
70
+ },
71
+ activeGallery : false,
72
+ galleryLocation : {
73
+ current : 0,
74
+ total : 0
75
+ },
76
+ //
77
+ // Initialize the lightwindow.
78
+ //
79
+ initialize : function(options) {
80
+ this.options = Object.extend({
81
+ resizeSpeed : 8,
82
+ contentOffset : {
83
+ height : 20,
84
+ width : 20
85
+ },
86
+ dimensions : {
87
+ image : {height : 250, width : 250},
88
+ page : {height : 250, width : 250},
89
+ inline : {height : 250, width : 250},
90
+ media : {height : 250, width : 250},
91
+ external : {height : 250, width : 250},
92
+ titleHeight : 25
93
+ },
94
+ classNames : {
95
+ standard : 'lightwindow',
96
+ action : 'lightwindow_action'
97
+ },
98
+ fileTypes : {
99
+ page : ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'pl', 'php4', 'php3', 'php', 'php5', 'phtml', 'rhtml', 'shtml', 'txt', 'vbs', 'rb'],
100
+ media : ['aif', 'aiff', 'asf', 'avi', 'divx', 'm1v', 'm2a', 'm2v', 'm3u', 'mid', 'midi', 'mov', 'moov', 'movie', 'mp2', 'mp3', 'mpa', 'mpa', 'mpe', 'mpeg', 'mpg', 'mpg', 'mpga', 'pps', 'qt', 'rm', 'ram', 'swf', 'viv', 'vivo', 'wav'],
101
+ image : ['bmp', 'gif', 'jpg', 'png', 'tiff']
102
+ },
103
+ mimeTypes : {
104
+ avi : 'video/avi',
105
+ aif : 'audio/aiff',
106
+ aiff : 'audio/aiff',
107
+ gif : 'image/gif',
108
+ bmp : 'image/bmp',
109
+ jpeg : 'image/jpeg',
110
+ m1v : 'video/mpeg',
111
+ m2a : 'audio/mpeg',
112
+ m2v : 'video/mpeg',
113
+ m3u : 'audio/x-mpequrl',
114
+ mid : 'audio/x-midi',
115
+ midi : 'audio/x-midi',
116
+ mjpg : 'video/x-motion-jpeg',
117
+ moov : 'video/quicktime',
118
+ mov : 'video/quicktime',
119
+ movie : 'video/x-sgi-movie',
120
+ mp2 : 'audio/mpeg',
121
+ mp3 : 'audio/mpeg3',
122
+ mpa : 'audio/mpeg',
123
+ mpa : 'video/mpeg',
124
+ mpe : 'video/mpeg',
125
+ mpeg : 'video/mpeg',
126
+ mpg : 'audio/mpeg',
127
+ mpg : 'video/mpeg',
128
+ mpga : 'audio/mpeg',
129
+ pdf : 'application/pdf',
130
+ png : 'image/png',
131
+ pps : 'application/mspowerpoint',
132
+ qt : 'video/quicktime',
133
+ ram : 'audio/x-pn-realaudio-plugin',
134
+ rm : 'application/vnd.rn-realmedia',
135
+ swf : 'application/x-shockwave-flash',
136
+ tiff : 'image/tiff',
137
+ viv : 'video/vivo',
138
+ vivo : 'video/vivo',
139
+ wav : 'audio/wav',
140
+ wmv : 'application/x-mplayer2'
141
+ },
142
+ classids : {
143
+ mov : 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
144
+ swf : 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
145
+ wmv : 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6'
146
+ },
147
+ codebases : {
148
+ mov : 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
149
+ swf : 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0',
150
+ wmv : 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715'
151
+ },
152
+ viewportPadding : 10,
153
+ EOLASFix : 'swf,wmv,fla,flv',
154
+ overlay : {
155
+ opacity : 0.7,
156
+ image : 'images/mapmyid/black.png',
157
+ presetImage : 'images/mapmyid/black-70.png'
158
+ },
159
+ skin : {
160
+ main : '<div id="lightwindow_container" >'+
161
+ '<div id="lightwindow_title_bar" >'+
162
+ '<div id="lightwindow_title_bar_inner" >'+
163
+ '<span id="lightwindow_title_bar_title" style="display:none"></span>'+
164
+ '<a id="lightwindow_title_bar_close_link" ></a>'+
165
+ '</div>'+
166
+ '</div>'+
167
+ '<div id="lightwindow_stage" >'+
168
+ '<div id="lightwindow_contents" style="border:2px solid #111111;padding:9px 4px 0px 4px;">'+
169
+ '</div>'+
170
+ '<div id="lightwindow_navigation" >'+
171
+ '<a href="#" id="lightwindow_previous" >'+
172
+ '<span id="lightwindow_previous_title"></span>'+
173
+ '</a>'+
174
+ '<a href="#" id="lightwindow_next" >'+
175
+ '<span id="lightwindow_next_title"></span>'+
176
+ '</a>'+
177
+ '<iframe name="lightwindow_navigation_shim" id="lightwindow_navigation_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>'+
178
+ '</div>'+
179
+ '<div id="lightwindow_galleries">'+
180
+ '<div id="lightwindow_galleries_tab_container" >'+
181
+ '<a href="#" id="lightwindow_galleries_tab" >'+
182
+ '<span id="lightwindow_galleries_tab_span" class="up" >Galleries</span>'+
183
+ '</a>'+
184
+ '</div>'+
185
+ '<div id="lightwindow_galleries_list" >'+
186
+ '</div>'+
187
+ '</div>'+
188
+ '</div>'+
189
+ '<div id="lightwindow_data_slide" >'+
190
+ '<div id="lightwindow_data_slide_inner" >'+
191
+ '<div id="lightwindow_data_details" >'+
192
+ '<div id="lightwindow_data_gallery_container" >'+
193
+ '<span id="lightwindow_data_gallery_current"></span>'+
194
+ ' of '+
195
+ '<span id="lightwindow_data_gallery_total"></span>'+
196
+ '</div>'+
197
+ '<div id="lightwindow_data_author_container" >'+
198
+ 'by <span id="lightwindow_data_author"></span>'+
199
+ '</div>'+
200
+ '</div>'+
201
+ '<div id="lightwindow_data_caption" >'+
202
+ '</div>'+
203
+ '</div>'+
204
+ '</div>'+
205
+ '</div>',
206
+ loading : '<div id="lightwindow_loading" >'+
207
+ '<img src="'+getBaseUrl()+'/frontend/base/default/images/mapmyid/ajax-loading.gif" id="lodingimage" alt="loading" />'+
208
+ '<span>Loading or <a href="javascript: myLightWindow.deactivate();">Cancel</a></span>'+
209
+ '<iframe name="lightwindow_loading_shim" id="lightwindow_loading_shim" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>'+
210
+ '</div>',
211
+ iframe : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'+
212
+ '<html xmlns="http://www.w3.org/1999/xhtml">'+
213
+ '<body>'+
214
+ '{body_replace}'+
215
+ '</body>'+
216
+ '</html>',
217
+ gallery : {
218
+ top : '<div class="lightwindow_galleries_list">'+
219
+ '<h1>{gallery_title_replace}</h1>'+
220
+ '<ul>',
221
+ middle : '<li>'+
222
+ '{gallery_link_replace}'+
223
+ '</li>',
224
+ bottom : '</ul>'+
225
+ '</div>'
226
+ }
227
+ },
228
+ formMethod : 'get',
229
+ hideFlash : false,
230
+ hideGalleryTab : false,
231
+ showTitleBar : true,
232
+ animationHandler : false,
233
+ navigationHandler : false,
234
+ transitionHandler : false,
235
+ finalAnimationHandler : false,
236
+ formHandler : false,
237
+ galleryAnimationHandler : false,
238
+ showGalleryCount : true
239
+ }, options || {});
240
+ this.duration = ((11-this.options.resizeSpeed)*0.15);
241
+ this._setupLinks();
242
+ this._getScroll();
243
+ this._getPageDimensions();
244
+ this._browserDimensions();
245
+ this._addLightWindowMarkup(false);
246
+ this._setupDimensions();
247
+ this.buildGalleryList();
248
+ },
249
+ //
250
+ // Activate the lightwindow.
251
+ //
252
+ activate : function(e, link){
253
+ // Clear out the window Contents
254
+ this._clearWindowContents(true);
255
+
256
+ // Add back in out loading panel
257
+ this._addLoadingWindowMarkup();
258
+
259
+ // Setup the element properties
260
+ this._setupWindowElements(link);
261
+
262
+ // Setup everything
263
+ this._getScroll();
264
+ this._browserDimensions();
265
+ this._setupDimensions();
266
+ this._toggleTroubleElements('hidden', false);
267
+ this._displayLightWindow('block', 'hidden');
268
+ this._setStatus(true);
269
+ this._monitorKeyboard(true);
270
+ this._prepareIE(true);
271
+ this._loadWindow();
272
+ },
273
+ //
274
+ // Turn off the window
275
+ //
276
+ deactivate : function(){
277
+ // The window is not active
278
+ this.windowActive = false;
279
+
280
+ // There is no longer a gallery active
281
+ this.activeGallery = false;
282
+ if (!this.options.hideGalleryTab) {
283
+ this._handleGalleryAnimation(false);
284
+ }
285
+
286
+ // Kill the animation
287
+ this.animating = false;
288
+
289
+ // Clear our element
290
+ this.element = null;
291
+
292
+ // hide the window.
293
+ this._displayLightWindow('none', 'visible');
294
+
295
+ // Clear out the window Contents
296
+ this._clearWindowContents(false);
297
+
298
+ // Stop all animation
299
+ var queue = Effect.Queues.get('lightwindowAnimation').each(function(e){e.cancel();});
300
+
301
+ // Undo the setup
302
+ this._prepareIE(false);
303
+ this._setupDimensions();
304
+ this._toggleTroubleElements('visible', false);
305
+ this._monitorKeyboard(false);
306
+ },
307
+ //
308
+ // Initialize specific window
309
+ //
310
+ createWindow : function(element, attributes) {
311
+ this._processLink($(element));
312
+ },
313
+ //
314
+ // Open a Window from a hash of attributes
315
+ //
316
+ activateWindow : function(options) {
317
+ this.element = Object.extend({
318
+ href : null,
319
+ title : null,
320
+ author : null,
321
+ caption : null,
322
+ rel : null,
323
+ top : null,
324
+ left : null,
325
+ type : null,
326
+ showImages : null,
327
+ height : null,
328
+ width : null,
329
+ loadingAnimation : null,
330
+ iframeEmbed : null,
331
+ form : null
332
+ }, options || {});
333
+
334
+ // Set the window type
335
+ this.contentToFetch = this.element.href;
336
+ this.windowType = this.element.type ? this.element.type : this._fileType(this.element.href);
337
+
338
+ // Clear out the window Contents
339
+ this._clearWindowContents(true);
340
+
341
+ // Add back in out loading panel
342
+ this._addLoadingWindowMarkup();
343
+
344
+ // Setup everything
345
+ this._getScroll();
346
+ this._browserDimensions();
347
+ this._setupDimensions();
348
+ this._toggleTroubleElements('hidden', false);
349
+ this._displayLightWindow('block', 'hidden');
350
+ this._setStatus(true);
351
+ this._monitorKeyboard(true);
352
+ this._prepareIE(true);
353
+ this._loadWindow();
354
+ },
355
+ //
356
+ // Fire off our Form handler
357
+ //
358
+ submitForm : function(e) {
359
+ if (this.options.formHandler) {
360
+ this.options.formHandler(e);
361
+ } else {
362
+ this._defaultFormHandler(e);
363
+ }
364
+ },
365
+ //
366
+ // Reload the window with another location
367
+ //
368
+ openWindow : function(element) {
369
+ var element = $(element);
370
+
371
+ // The window is active
372
+ this.windowActive = true;
373
+
374
+ // Clear out the window Contents
375
+ this._clearWindowContents(true);
376
+
377
+ // Add back in out loading panel
378
+ this._addLoadingWindowMarkup();
379
+
380
+ // Setup the element properties
381
+ this._setupWindowElements(element);
382
+
383
+ this._setStatus(true);
384
+ this._handleTransition();
385
+ },
386
+ //
387
+ // Navigate the window
388
+ //
389
+ navigateWindow : function(direction) {
390
+ this._handleNavigation(false);
391
+ if (direction == 'previous') {
392
+ this.openWindow(this.navigationObservers.previous);
393
+ } else if (direction == 'next'){
394
+ this.openWindow(this.navigationObservers.next);
395
+ }
396
+ },
397
+ //
398
+ // Build the Gallery List and Load it
399
+ //
400
+ buildGalleryList : function() {
401
+ var output = '';
402
+ var galleryLink;
403
+ for (i in this.galleries) {
404
+ if (typeof this.galleries[i] == 'object') {
405
+ output += (this.options.skin.gallery.top).replace('{gallery_title_replace}', unescape(i));
406
+ for (j in this.galleries[i]) {
407
+ if (typeof this.galleries[i][j] == 'object') {
408
+ galleryLink = '<a href="#" id="lightwindow_gallery_'+i+'_'+j+'" >'+unescape(j)+'</a>';
409
+ output += (this.options.skin.gallery.middle).replace('{gallery_link_replace}', galleryLink);
410
+ }
411
+ }
412
+ output += this.options.skin.gallery.bottom;
413
+ }
414
+ }
415
+ new Insertion.Top('lightwindow_galleries_list', output);
416
+
417
+ // Attach Events
418
+ for (i in this.galleries) {
419
+ if (typeof this.galleries[i] == 'object') {
420
+ for (j in this.galleries[i]) {
421
+ if (typeof this.galleries[i][j] == 'object') {
422
+ Event.observe($('lightwindow_gallery_'+i+'_'+j), 'click', this.openWindow.bind(this, this.galleries[i][j][0]), false);
423
+ $('lightwindow_gallery_'+i+'_'+j).onclick = function() {return false;};
424
+ }
425
+ }
426
+ }
427
+ }
428
+ },
429
+ //
430
+ // Set Links Up
431
+ //
432
+ _setupLinks : function() {
433
+ var links = $$('.'+this.options.classNames.standard);
434
+ links.each(function(link) {
435
+ this._processLink(link);
436
+ }.bind(this));
437
+ },
438
+ //
439
+ // Process a Link
440
+ //
441
+ _processLink : function(link) {
442
+ if ((this._fileType(link.getAttribute('href')) == 'image' || this._fileType(link.getAttribute('href')) == 'media')) {
443
+ if (gallery = this._getGalleryInfo(link.rel)) {
444
+ if (!this.galleries[gallery[0]]) {
445
+ this.galleries[gallery[0]] = new Array();
446
+ }
447
+ if (!this.galleries[gallery[0]][gallery[1]]) {
448
+ this.galleries[gallery[0]][gallery[1]] = new Array();
449
+ }
450
+ this.galleries[gallery[0]][gallery[1]].push(link);
451
+ }
452
+ }
453
+
454
+ // Take care of our inline content
455
+ var url = link.getAttribute('href');
456
+ if (url.indexOf('?') > -1) {
457
+ url = url.substring(0, url.indexOf('?'));
458
+ }
459
+
460
+ var container = url.substring(url.indexOf('#')+1);
461
+ if($(container)) {
462
+ $(container).setStyle({
463
+ display : 'none'
464
+ });
465
+ }
466
+
467
+ Event.observe(link, 'click', this.activate.bindAsEventListener(this, link), false);
468
+ link.onclick = function() {return false;};
469
+ },
470
+ //
471
+ // Setup our actions
472
+ //
473
+ _setupActions : function() {
474
+ var links = $$('#lightwindow_container .'+this.options.classNames.action);
475
+ links.each(function(link) {
476
+ Event.observe(link, 'click', this[link.getAttribute('rel')].bindAsEventListener(this, link), false);
477
+ link.onclick = function() {return false;};
478
+ }.bind(this));
479
+ },
480
+ //
481
+ // Add the markup to the page.
482
+ //
483
+ _addLightWindowMarkup : function(rebuild) {
484
+ var overlay = Element.extend(document.createElement('div'));
485
+ overlay.setAttribute('id', 'lightwindow_overlay');
486
+ // FF Mac has a problem with putting Flash above a layer without a 100% opacity background, so we need to use a pre-made
487
+ if (Prototype.Browser.Gecko) {
488
+ overlay.setStyle({
489
+ backgroundImage: 'url('+this.options.overlay.presetImage+')',
490
+ backgroundRepeat: 'repeat',
491
+ height: this.pageDimensions.height+'px'
492
+ });
493
+ } else {
494
+ overlay.setStyle({
495
+ opacity: this.options.overlay.opacity,
496
+ backgroundImage: 'url('+this.options.overlay.image+')',
497
+ backgroundRepeat: 'repeat',
498
+ height: this.pageDimensions.height+'px'
499
+ });
500
+ }
501
+
502
+ var lw = document.createElement('div');
503
+ lw.setAttribute('id', 'lightwindow');
504
+ lw.innerHTML = this.options.skin.main;
505
+
506
+ var body = document.getElementsByTagName('body')[0];
507
+ body.appendChild(overlay);
508
+ body.appendChild(lw);
509
+
510
+ if ($('lightwindow_title_bar_close_link')) {
511
+ Event.observe('lightwindow_title_bar_close_link', 'click', this.deactivate.bindAsEventListener(this));
512
+ $('lightwindow_title_bar_close_link').onclick = function() {return false;};
513
+ }
514
+
515
+ Event.observe($('lightwindow_previous'), 'click', this.navigateWindow.bind(this, 'previous'), false);
516
+ $('lightwindow_previous').onclick = function() {return false;};
517
+ Event.observe($('lightwindow_next'), 'click', this.navigateWindow.bind(this, 'next'), false);
518
+ $('lightwindow_next').onclick = function() {return false;};
519
+
520
+ if (!this.options.hideGalleryTab) {
521
+ Event.observe($('lightwindow_galleries_tab'), 'click', this._handleGalleryAnimation.bind(this, true), false);
522
+ $('lightwindow_galleries_tab').onclick = function() {return false;};
523
+ }
524
+
525
+ // Because we use position absolute, kill the scroll Wheel on animations
526
+ if (Prototype.Browser.IE) {
527
+ Event.observe(document, 'mousewheel', this._stopScrolling.bindAsEventListener(this), false);
528
+ } else {
529
+ Event.observe(window, 'DOMMouseScroll', this._stopScrolling.bindAsEventListener(this), false);
530
+ }
531
+
532
+ Event.observe(overlay, 'click', this.deactivate.bindAsEventListener(this), false);
533
+ overlay.onclick = function() {return false;};
534
+ },
535
+ //
536
+ // Add loading window markup
537
+ //
538
+ _addLoadingWindowMarkup : function() {
539
+ $('lightwindow_contents').innerHTML += this.options.skin.loading;
540
+ },
541
+ //
542
+ // Setup the window elements
543
+ //
544
+ _setupWindowElements : function(link) {
545
+ this.element = link;
546
+ this.element.title = null ? '' : link.getAttribute('title');
547
+ this.element.author = null ? '' : link.getAttribute('author');
548
+ this.element.caption = null ? '' : link.getAttribute('caption');
549
+ this.element.rel = null ? '' : link.getAttribute('rel');
550
+ this.element.params = null ? '' : link.getAttribute('params');
551
+
552
+ // Set the window type
553
+ this.contentToFetch = this.element.href;
554
+ this.windowType = this._getParameter('lightwindow_type') ? this._getParameter('lightwindow_type') : this._fileType(this.contentToFetch);
555
+ },
556
+ //
557
+ // Clear the window contents out
558
+ //
559
+ _clearWindowContents : function(contents) {
560
+ // If there is an iframe, its got to go
561
+ if ($('lightwindow_iframe')) {
562
+ Element.remove($('lightwindow_iframe'));
563
+ }
564
+
565
+ // Stop playing an object if its still around
566
+ if ($('lightwindow_media_primary')) {
567
+ try {
568
+ $('lightwindow_media_primary').Stop();
569
+ } catch(e) {}
570
+ Element.remove($('lightwindow_media_primary'));
571
+ }
572
+
573
+ // Stop playing an object if its still around
574
+ if ($('lightwindow_media_secondary')) {
575
+ try {
576
+ $('lightwindow_media_secondary').Stop();
577
+ } catch(e) {}
578
+ Element.remove($('lightwindow_media_secondary'));
579
+ }
580
+
581
+ this.activeGallery = false;
582
+ this._handleNavigation(this.activeGallery);
583
+
584
+ if (contents) {
585
+ // Empty the contents
586
+ $('lightwindow_contents').innerHTML = '';
587
+
588
+ // Reset the scroll bars
589
+ $('lightwindow_contents').setStyle({
590
+ overflow: 'hidden'
591
+ });
592
+
593
+ if (!this.windowActive) {
594
+ $('lightwindow_data_slide_inner').setStyle({
595
+ display: 'none'
596
+ });
597
+
598
+ $('lightwindow_title_bar_title').innerHTML = '';
599
+ }
600
+
601
+ // Because of browser differences and to maintain flexible captions we need to reset this height at close
602
+ $('lightwindow_data_slide').setStyle({
603
+ height: 'auto'
604
+ });
605
+ }
606
+
607
+ this.resizeTo.height = null;
608
+ this.resizeTo.width = null;
609
+ },
610
+ //
611
+ // Set the status of our animation to keep things from getting clunky
612
+ //
613
+ _setStatus : function(status) {
614
+ this.animating = status;
615
+ if (status) {
616
+ Element.show('lightwindow_loading');
617
+ }
618
+ if (!(/MSIE 6./i.test(navigator.userAgent))) {
619
+ this._fixedWindow(status);
620
+ }
621
+ },
622
+ //
623
+ // Make this window Fixed
624
+ //
625
+ _fixedWindow : function(status) {
626
+ if (status) {
627
+ if (this.windowActive) {
628
+ this._getScroll();
629
+ $('lightwindow').setStyle({
630
+ position: 'absolute',
631
+ top: parseFloat($('lightwindow').getStyle('top'))+this.pagePosition.y+'px',
632
+ left: parseFloat($('lightwindow').getStyle('left'))+this.pagePosition.x+'px'
633
+ });
634
+ } else {
635
+ $('lightwindow').setStyle({
636
+ position: 'absolute'
637
+ });
638
+ }
639
+ } else {
640
+ if (this.windowActive) {
641
+ this._getScroll();
642
+ $('lightwindow').setStyle({
643
+ position: 'fixed',
644
+ top: parseFloat($('lightwindow').getStyle('top'))-this.pagePosition.y+'px',
645
+ left: parseFloat($('lightwindow').getStyle('left'))-this.pagePosition.x+'px'
646
+ });
647
+ } else {
648
+ if ($('lightwindow_iframe')) {
649
+ // Ideally here we would set a 50% value for top and left, but Safari rears it ugly head again and we need to do it by pixels
650
+ this._browserDimensions();
651
+ }
652
+ $('lightwindow').setStyle({
653
+ position: 'fixed',
654
+ top: (parseFloat(this._getParameter('lightwindow_top')) ? parseFloat(this._getParameter('lightwindow_top'))+'px' : this.dimensions.viewport.height/2+'px'),
655
+ left: (parseFloat(this._getParameter('lightwindow_left')) ? parseFloat(this._getParameter('lightwindow_left'))+'px' : this.dimensions.viewport.width/2+'px')
656
+ });
657
+ }
658
+ }
659
+ },
660
+ //
661
+ // Prepare the window for IE.
662
+ //
663
+ _prepareIE : function(setup) {
664
+ if (Prototype.Browser.IE) {
665
+ var height, overflowX, overflowY;
666
+ if (setup) {
667
+ var height = '100%';
668
+ } else {
669
+ var height = 'auto';
670
+ }
671
+ var body = document.getElementsByTagName('body')[0];
672
+ var html = document.getElementsByTagName('html')[0];
673
+ html.style.height = body.style.height = height;
674
+ }
675
+ },
676
+ _stopScrolling : function(e) {
677
+ if (this.animating) {
678
+ if (e.preventDefault) {
679
+ e.preventDefault();
680
+ }
681
+ e.returnValue = false;
682
+ }
683
+ },
684
+ //
685
+ // Get the scroll for the page.
686
+ //
687
+ _getScroll : function(){
688
+ if(typeof(window.pageYOffset) == 'number') {
689
+ this.pagePosition.x = window.pageXOffset;
690
+ this.pagePosition.y = window.pageYOffset;
691
+ } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
692
+ this.pagePosition.x = document.body.scrollLeft;
693
+ this.pagePosition.y = document.body.scrollTop;
694
+ } else if(document.documentElement) {
695
+ this.pagePosition.x = document.documentElement.scrollLeft;
696
+ this.pagePosition.y = document.documentElement.scrollTop;
697
+ }
698
+ },
699
+ //
700
+ // Reset the scroll.
701
+ //
702
+ _setScroll : function(x, y) {
703
+ document.documentElement.scrollLeft = x;
704
+ document.documentElement.scrollTop = y;
705
+ },
706
+ //
707
+ // Hide Selects from the page because of IE.
708
+ // We could use iframe shims instead here but why add all the extra markup for one browser when this is much easier and cleaner
709
+ //
710
+ _toggleTroubleElements : function(visibility, content){
711
+
712
+ if (content) {
713
+ var selects = $('lightwindow_contents').getElementsByTagName('select');
714
+ } else {
715
+ var selects = document.getElementsByTagName('select');
716
+ }
717
+
718
+ for(var i = 0; i < selects.length; i++) {
719
+ selects[i].style.visibility = visibility;
720
+ }
721
+
722
+ if (!content) {
723
+ if (this.options.hideFlash){
724
+ var objects = document.getElementsByTagName('object');
725
+ for (i = 0; i != objects.length; i++) {
726
+ objects[i].style.visibility = visibility;
727
+ }
728
+ var embeds = document.getElementsByTagName('embed');
729
+ for (i = 0; i != embeds.length; i++) {
730
+ embeds[i].style.visibility = visibility;
731
+ }
732
+ }
733
+ var iframes = document.getElementsByTagName('iframe');
734
+ for (i = 0; i != iframes.length; i++) {
735
+ iframes[i].style.visibility = visibility;
736
+ }
737
+ }
738
+ },
739
+ //
740
+ // Get the actual page size
741
+ //
742
+ _getPageDimensions : function() {
743
+ var xScroll, yScroll;
744
+ if (window.innerHeight && window.scrollMaxY) {
745
+ xScroll = document.body.scrollWidth;
746
+ yScroll = window.innerHeight + window.scrollMaxY;
747
+ } else if (document.body.scrollHeight > document.body.offsetHeight){
748
+ xScroll = document.body.scrollWidth;
749
+ yScroll = document.body.scrollHeight;
750
+ } else {
751
+ xScroll = document.body.offsetWidth;
752
+ yScroll = document.body.offsetHeight;
753
+ }
754
+
755
+ var windowWidth, windowHeight;
756
+ if (self.innerHeight) {
757
+ windowWidth = self.innerWidth;
758
+ windowHeight = self.innerHeight;
759
+ } else if (document.documentElement && document.documentElement.clientHeight) {
760
+ windowWidth = document.documentElement.clientWidth;
761
+ windowHeight = document.documentElement.clientHeight;
762
+ } else if (document.body) {
763
+ windowWidth = document.body.clientWidth;
764
+ windowHeight = document.body.clientHeight;
765
+ }
766
+
767
+ if(yScroll < windowHeight){
768
+ this.pageDimensions.height = windowHeight;
769
+ } else {
770
+ this.pageDimensions.height = yScroll;
771
+ }
772
+
773
+ if(xScroll < windowWidth){
774
+ this.pageDimensions.width = windowWidth;
775
+ } else {
776
+ this.pageDimensions.width = xScroll;
777
+ }
778
+ },
779
+ //
780
+ // Display the lightWindow.
781
+ //
782
+ _displayLightWindow : function(display, visibility) {
783
+ $('lightwindow_overlay').style.display = $('lightwindow').style.display = $('lightwindow_container').style.display = display;
784
+ $('lightwindow_overlay').style.visibility = $('lightwindow').style.visibility = $('lightwindow_container').style.visibility = visibility;
785
+ },
786
+ //
787
+ // Setup Dimensions of lightwindow.
788
+
789
+ //
790
+ _setupDimensions : function() {
791
+
792
+ var originalHeight, originalWidth;
793
+ switch (this.windowType) {
794
+ case 'page' :
795
+ originalHeight = this.options.dimensions.page.height;
796
+ originalWidth = this.options.dimensions.page.width;
797
+ break;
798
+
799
+ case 'image' :
800
+ originalHeight = this.options.dimensions.image.height;
801
+ originalWidth = this.options.dimensions.image.width;
802
+ break;
803
+
804
+ case 'media' :
805
+ originalHeight = this.options.dimensions.media.height;
806
+ originalWidth = this.options.dimensions.media.width;
807
+ break;
808
+
809
+ case 'external' :
810
+ originalHeight = this.options.dimensions.external.height;
811
+ originalWidth = this.options.dimensions.external.width;
812
+ break;
813
+
814
+ case 'inline' :
815
+ originalHeight = this.options.dimensions.inline.height;
816
+ originalWidth = this.options.dimensions.inline.width;
817
+ break;
818
+
819
+ default :
820
+ originalHeight = this.options.dimensions.page.height;
821
+ originalWidth = this.options.dimensions.page.width;
822
+ break;
823
+
824
+ }
825
+
826
+ var offsetHeight = this._getParameter('lightwindow_top') ? parseFloat(this._getParameter('lightwindow_top'))+this.pagePosition.y : this.dimensions.viewport.height/2+this.pagePosition.y;
827
+ var offsetWidth = this._getParameter('lightwindow_left') ? parseFloat(this._getParameter('lightwindow_left'))+this.pagePosition.x : this.dimensions.viewport.width/2+this.pagePosition.x;
828
+
829
+ // So if a theme has say shadowed edges, they should be consistant and take care of in the contentOffset
830
+ $('lightwindow').setStyle({
831
+ top: offsetHeight+'px',
832
+ left: offsetWidth+'px'
833
+ });
834
+
835
+ $('lightwindow_container').setStyle({
836
+ height: originalHeight+'px',
837
+ width: originalWidth+'px',
838
+ left: -(originalWidth/2)+'px',
839
+ top: -(originalHeight/2)+'px'
840
+ });
841
+
842
+ $('lightwindow_contents').setStyle({
843
+ height: originalHeight+'px',
844
+ width: originalWidth+'px'
845
+ });
846
+ },
847
+ //
848
+ // Get the type of file.
849
+ //
850
+ _fileType : function(url) {
851
+ var image = new RegExp("[^\.]\.("+this.options.fileTypes.image.join('|')+")\s*$", "i");
852
+ if (image.test(url)) return 'image';
853
+ if (url.indexOf('#') > -1 && (document.domain == this._getDomain(url))) return 'inline';
854
+ if (url.indexOf('?') > -1) url = url.substring(0, url.indexOf('?'));
855
+ var type = 'unknown';
856
+ var page = new RegExp("[^\.]\.("+this.options.fileTypes.page.join('|')+")\s*$", "i");
857
+ var media = new RegExp("[^\.]\.("+this.options.fileTypes.media.join('|')+")\s*$", "i");
858
+ if (document.domain != this._getDomain(url)) type = 'external';
859
+ if (media.test(url)) type = 'media';
860
+ if (type == 'external' || type == 'media') return type;
861
+ if (page.test(url) || url.substr((url.length-1), url.length) == '/') type = 'page';
862
+ return type;
863
+ },
864
+ //
865
+ // Get file Extension
866
+ //
867
+ _fileExtension : function(url) {
868
+ if (url.indexOf('?') > -1) {
869
+ url = url.substring(0, url.indexOf('?'));
870
+ }
871
+ var extenstion = '';
872
+ for (var x = (url.length-1); x > -1; x--) {
873
+ if (url.charAt(x) == '.') {
874
+ return extenstion;
875
+ }
876
+ extenstion = url.charAt(x)+extenstion;
877
+ }
878
+ },
879
+ //
880
+ // Monitor the keyboard while this lightwindow is up
881
+ //
882
+ _monitorKeyboard : function(status) {
883
+ if (status) document.onkeydown = this._eventKeypress.bind(this);
884
+ else document.onkeydown = '';
885
+ },
886
+ //
887
+ // Perform keyboard actions
888
+ //
889
+ _eventKeypress : function(e) {
890
+ if (e == null) {
891
+ var keycode = event.keyCode;
892
+ } else {
893
+ var keycode = e.which;
894
+ }
895
+
896
+ switch (keycode) {
897
+ case 27:
898
+ this.deactivate();
899
+ break;
900
+
901
+ case 13:
902
+ return;
903
+
904
+ default:
905
+ break;
906
+ }
907
+
908
+ // Gotta stop those quick fingers
909
+ if (this.animating) {
910
+ return false;
911
+ }
912
+
913
+ switch (String.fromCharCode(keycode).toLowerCase()) {
914
+ case 'p':
915
+ if (this.navigationObservers.previous) {
916
+ this.navigateWindow('previous');
917
+ }
918
+ break;
919
+
920
+ case 'n':
921
+ if (this.navigationObservers.next) {
922
+ this.navigateWindow('next');
923
+ }
924
+ break;
925
+
926
+ default:
927
+ break;
928
+ }
929
+ },
930
+ //
931
+ // Get Gallery Information
932
+ //
933
+ _getGalleryInfo : function(rel) {
934
+ if (!rel) return false;
935
+ if (rel.indexOf('[') > -1) {
936
+ return new Array(escape(rel.substring(0, rel.indexOf('['))), escape(rel.substring(rel.indexOf('[')+1, rel.indexOf(']'))));
937
+ } else {
938
+ return false;
939
+ }
940
+ },
941
+ //
942
+ // Get the domain from a string.
943
+ //
944
+ _getDomain : function(url) {
945
+ var leadSlashes = url.indexOf('//');
946
+ var domainStart = leadSlashes+2;
947
+ var withoutResource = url.substring(domainStart, url.length);
948
+ var nextSlash = withoutResource.indexOf('/');
949
+ var domain = withoutResource.substring(0, nextSlash);
950
+ if (domain.indexOf(':') > -1){
951
+ var portColon = domain.indexOf(':');
952
+ domain = domain.substring(0, portColon);
953
+ }
954
+ return domain;
955
+ },
956
+ //
957
+ // Get the value from the params attribute string.
958
+ //
959
+ _getParameter : function(parameter, parameters) {
960
+ if (!this.element) return false;
961
+ if (parameter == 'lightwindow_top' && this.element.top) {
962
+ return unescape(this.element.top);
963
+ } else if (parameter == 'lightwindow_left' && this.element.left) {
964
+ return unescape(this.element.left);
965
+ } else if (parameter == 'lightwindow_type' && this.element.type) {
966
+ return unescape(this.element.type);
967
+ } else if (parameter == 'lightwindow_show_images' && this.element.showImages) {
968
+ return unescape(this.element.showImages);
969
+ } else if (parameter == 'lightwindow_height' && this.element.height) {
970
+ return unescape(this.element.height);
971
+ } else if (parameter == 'lightwindow_width' && this.element.width) {
972
+ return unescape(this.element.width);
973
+ } else if (parameter == 'lightwindow_loading_animation' && this.element.loadingAnimation) {
974
+ return unescape(this.element.loadingAnimation);
975
+ } else if (parameter == 'lightwindow_iframe_embed' && this.element.iframeEmbed) {
976
+ return unescape(this.element.iframeEmbed);
977
+ } else if (parameter == 'lightwindow_form' && this.element.form) {
978
+ return unescape(this.element.form);
979
+ } else {
980
+ if (!parameters) {
981
+ if (this.element.params) parameters = this.element.params;
982
+ else return;
983
+ }
984
+ var value;
985
+ var parameterArray = parameters.split(',');
986
+ var compareString = parameter+'=';
987
+ var compareLength = compareString.length;
988
+ for (var i = 0; i < parameterArray.length; i++) {
989
+ if (parameterArray[i].substr(0, compareLength) == compareString) {
990
+ var currentParameter = parameterArray[i].split('=');
991
+ value = currentParameter[1];
992
+ break;
993
+ }
994
+ }
995
+ if (!value) return false;
996
+ else return unescape(value);
997
+ }
998
+ },
999
+ //
1000
+ // Get the Browser Viewport Dimensions
1001
+ //
1002
+ _browserDimensions : function() {
1003
+ if (Prototype.Browser.IE) {
1004
+ this.dimensions.viewport.height = document.documentElement.clientHeight;
1005
+ this.dimensions.viewport.width = document.documentElement.clientWidth;
1006
+ } else {
1007
+ this.dimensions.viewport.height = window.innerHeight;
1008
+ this.dimensions.viewport.width = document.width || document.body.offsetWidth;
1009
+ }
1010
+ },
1011
+ //
1012
+ // Get the scrollbar offset, I don't like this method but there is really no other way I can find.
1013
+ //
1014
+ _getScrollerWidth : function() {
1015
+ var scrollDiv = Element.extend(document.createElement('div'));
1016
+ scrollDiv.setAttribute('id', 'lightwindow_scroll_div');
1017
+ scrollDiv.setStyle({
1018
+ position: 'absolute',
1019
+ top: '-10000px',
1020
+ left: '-10000px',
1021
+ width: '100px',
1022
+ height: '100px',
1023
+ overflow: 'hidden'
1024
+ });
1025
+
1026
+
1027
+
1028
+ var contentDiv = Element.extend(document.createElement('div'));
1029
+ contentDiv.setAttribute('id', 'lightwindow_content_scroll_div');
1030
+ contentDiv.setStyle({
1031
+ width: '100%',
1032
+ height: '200px'
1033
+ });
1034
+
1035
+ scrollDiv.appendChild(contentDiv);
1036
+
1037
+ var body = document.getElementsByTagName('body')[0];
1038
+ body.appendChild(scrollDiv);
1039
+
1040
+ var noScroll = $('lightwindow_content_scroll_div').offsetWidth;
1041
+ scrollDiv.style.overflow = 'auto';
1042
+ var withScroll = $('lightwindow_content_scroll_div').offsetWidth;
1043
+
1044
+ Element.remove($('lightwindow_scroll_div'));
1045
+
1046
+ this.scrollbarOffset = noScroll-withScroll;
1047
+ },
1048
+
1049
+
1050
+ //
1051
+ // Add a param to an object dynamically created
1052
+ //
1053
+ _addParamToObject : function(name, value, object, id) {
1054
+ var param = document.createElement('param');
1055
+ param.setAttribute('value', value);
1056
+ param.setAttribute('name', name);
1057
+ if (id) {
1058
+ param.setAttribute('id', id);
1059
+ }
1060
+ object.appendChild(param);
1061
+ return object;
1062
+ },
1063
+ //
1064
+ // Get the outer HTML of an object CROSS BROWSER
1065
+ //
1066
+ _outerHTML : function(object) {
1067
+ if (Prototype.Browser.IE) {
1068
+ return object.outerHTML;
1069
+ } else {
1070
+ var clone = object.cloneNode(true);
1071
+ var cloneDiv = document.createElement('div');
1072
+ cloneDiv.appendChild(clone);
1073
+ return cloneDiv.innerHTML;
1074
+ }
1075
+ },
1076
+ //
1077
+ // Convert an object to markup
1078
+ //
1079
+ _convertToMarkup : function(object, closeTag) {
1080
+ var markup = this._outerHTML(object).replace('</'+closeTag+'>', '');
1081
+ if (Prototype.Browser.IE) {
1082
+ for (var i = 0; i < object.childNodes.length; i++){
1083
+ markup += this._outerHTML(object.childNodes[i]);
1084
+ }
1085
+ markup += '</'+closeTag+'>';
1086
+ }
1087
+ return markup;
1088
+ },
1089
+ //
1090
+ // Depending what type of browser it is we have to append the object differently... DAMN YOU IE!!
1091
+ //
1092
+ _appendObject : function(object, closeTag, appendTo) {
1093
+ if (Prototype.Browser.IE) {
1094
+ appendTo.innerHTML += this._convertToMarkup(object, closeTag);
1095
+
1096
+ // Fix the Eolas activate thing but only for specified media, for example doing this to a quicktime film breaks it.
1097
+ if (this.options.EOLASFix.indexOf(this._fileType(this.element.href)) > -1) {
1098
+ var objectElements = document.getElementsByTagName('object');
1099
+ for (var i = 0; i < objectElements.length; i++) {
1100
+ if (objectElements[i].getAttribute("data")) objectElements[i].removeAttribute('data');
1101
+ objectElements[i].outerHTML = objectElements[i].outerHTML;
1102
+ objectElements[i].style.visibility = "visible";
1103
+ }
1104
+ }
1105
+ } else {
1106
+ appendTo.appendChild(object);
1107
+ }
1108
+ },
1109
+ //
1110
+ // Add in iframe
1111
+ //
1112
+ _appendIframe : function(scroll) {
1113
+ var iframe = document.createElement('iframe');
1114
+ iframe.setAttribute('id', 'lightwindow_iframe');
1115
+ iframe.setAttribute('name', 'lightwindow_iframe');
1116
+ iframe.setAttribute('src', 'about:blank');
1117
+ iframe.setAttribute('height', '100%');
1118
+ iframe.setAttribute('width', '100%');
1119
+ iframe.setAttribute('frameborder', '0');
1120
+ iframe.setAttribute('marginwidth', '0');
1121
+ iframe.setAttribute('marginheight', '0');
1122
+ iframe.setAttribute('scrolling', scroll);
1123
+
1124
+ this._appendObject(iframe, 'iframe', $('lightwindow_contents'));
1125
+ },
1126
+ //
1127
+ // Write Content to the iframe using the skin
1128
+ //
1129
+ _writeToIframe : function(content) {
1130
+ var template = this.options.skin.iframe;
1131
+ template = template.replace('{body_replace}', content);
1132
+ if ($('lightwindow_iframe').contentWindow){
1133
+ $('lightwindow_iframe').contentWindow.document.open();
1134
+ $('lightwindow_iframe').contentWindow.document.write(template);
1135
+ $('lightwindow_iframe').contentWindow.document.close();
1136
+ } else {
1137
+ $('lightwindow_iframe').contentDocument.open();
1138
+ $('lightwindow_iframe').contentDocument.write(template);
1139
+ $('lightwindow_iframe').contentDocument.close();
1140
+ }
1141
+ },
1142
+ //
1143
+ // Load the window Information
1144
+ //
1145
+ _loadWindow : function() {
1146
+ switch (this.windowType) {
1147
+ case 'image' :
1148
+
1149
+ var current = 0;
1150
+ var images = [];
1151
+ this.checkImage = [];
1152
+ this.resizeTo.height = this.resizeTo.width = 0;
1153
+ this.imageCount = this._getParameter('lightwindow_show_images') ? parseInt(this._getParameter('lightwindow_show_images')) : 1;
1154
+
1155
+ // If there is a gallery get it
1156
+ if (gallery = this._getGalleryInfo(this.element.rel)) {
1157
+ for (current = 0; current < this.galleries[gallery[0]][gallery[1]].length; current++) {
1158
+ if (this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][current].href) > -1) {
1159
+ break;
1160
+ }
1161
+ }
1162
+ if (this.galleries[gallery[0]][gallery[1]][current-this.imageCount]) {
1163
+ this.navigationObservers.previous = this.galleries[gallery[0]][gallery[1]][current-this.imageCount];
1164
+ } else {
1165
+ this.navigationObservers.previous = false;
1166
+ }
1167
+ if (this.galleries[gallery[0]][gallery[1]][current+this.imageCount]) {
1168
+ this.navigationObservers.next = this.galleries[gallery[0]][gallery[1]][current+this.imageCount];
1169
+ } else {
1170
+ this.navigationObservers.next = false;
1171
+ }
1172
+
1173
+ this.activeGallery = true;
1174
+ } else {
1175
+ this.navigationObservers.previous = false;
1176
+ this.navigationObservers.next = false;
1177
+
1178
+ this.activeGallery = false;
1179
+ }
1180
+
1181
+ for (var i = current; i < (current+this.imageCount); i++) {
1182
+
1183
+ if (gallery && this.galleries[gallery[0]][gallery[1]][i]) {
1184
+ this.contentToFetch = this.galleries[gallery[0]][gallery[1]][i].href;
1185
+
1186
+ this.galleryLocation = {current: (i+1)/this.imageCount, total: (this.galleries[gallery[0]][gallery[1]].length)/this.imageCount};
1187
+
1188
+ if (!this.galleries[gallery[0]][gallery[1]][i+this.imageCount]) {
1189
+ $('lightwindow_next').setStyle({
1190
+ display: 'none'
1191
+ });
1192
+ } else {
1193
+ $('lightwindow_next').setStyle({
1194
+ display: 'block'
1195
+ });
1196
+ $('lightwindow_next_title').innerHTML = this.galleries[gallery[0]][gallery[1]][i+this.imageCount].title;
1197
+ }
1198
+
1199
+ if (!this.galleries[gallery[0]][gallery[1]][i-this.imageCount]) {
1200
+ $('lightwindow_previous').setStyle({
1201
+ display: 'none'
1202
+ });
1203
+ } else {
1204
+ $('lightwindow_previous').setStyle({
1205
+ display: 'block'
1206
+ });
1207
+ $('lightwindow_previous_title').innerHTML = this.galleries[gallery[0]][gallery[1]][i-this.imageCount].title;
1208
+ }
1209
+ }
1210
+
1211
+ images[i] = document.createElement('img');
1212
+ images[i].setAttribute('id', 'lightwindow_image_'+i);
1213
+ images[i].setAttribute('border', '0');
1214
+ images[i].setAttribute('src', this.contentToFetch);
1215
+ $('lightwindow_contents').appendChild(images[i]);
1216
+
1217
+ // We have to do this instead of .onload
1218
+ this.checkImage[i] = new PeriodicalExecuter(function(i) {
1219
+ if (!(typeof $('lightwindow_image_'+i).naturalWidth != "undefined" && $('lightwindow_image_'+i).naturalWidth == 0)) {
1220
+
1221
+ this.checkImage[i].stop();
1222
+
1223
+ var imageHeight = $('lightwindow_image_'+i).getHeight();
1224
+ if (imageHeight > this.resizeTo.height) {
1225
+ this.resizeTo.height = imageHeight;
1226
+ }
1227
+ this.resizeTo.width += $('lightwindow_image_'+i).getWidth();
1228
+ this.imageCount--;
1229
+
1230
+ $('lightwindow_image_'+i).setStyle({
1231
+ height: '100%'
1232
+ });
1233
+
1234
+ if (this.imageCount == 0) {
1235
+ this._processWindow();
1236
+ }
1237
+ }
1238
+
1239
+ }.bind(this, i), 1);
1240
+ }
1241
+
1242
+
1243
+ break;
1244
+
1245
+ case 'media' :
1246
+
1247
+ var current = 0;
1248
+ this.resizeTo.height = this.resizeTo.width = 0;
1249
+
1250
+ // If there is a gallery get it
1251
+ if (gallery = this._getGalleryInfo(this.element.rel)) {
1252
+ for (current = 0; current < this.galleries[gallery[0]][gallery[1]].length; current++) {
1253
+ if (this.contentToFetch.indexOf(this.galleries[gallery[0]][gallery[1]][current].href) > -1) {
1254
+ break;
1255
+ }
1256
+ }
1257
+
1258
+ if (this.galleries[gallery[0]][gallery[1]][current-1]) {
1259
+ this.navigationObservers.previous = this.galleries[gallery[0]][gallery[1]][current-1];
1260
+ } else {
1261
+ this.navigationObservers.previous = false;
1262
+ }
1263
+ if (this.galleries[gallery[0]][gallery[1]][current+1]) {
1264
+ this.navigationObservers.next = this.galleries[gallery[0]][gallery[1]][current+1];
1265
+ } else {
1266
+ this.navigationObservers.next = false;
1267
+ }
1268
+
1269
+ this.activeGallery = true;
1270
+ } else {
1271
+ this.navigationObservers.previous = false;
1272
+ this.navigationObservers.next = false;
1273
+
1274
+ this.activeGallery = false;
1275
+ }
1276
+
1277
+
1278
+ if (gallery && this.galleries[gallery[0]][gallery[1]][current]) {
1279
+ this.contentToFetch = this.galleries[gallery[0]][gallery[1]][current].href;
1280
+
1281
+ this.galleryLocation = {current: current+1, total: this.galleries[gallery[0]][gallery[1]].length};
1282
+
1283
+ if (!this.galleries[gallery[0]][gallery[1]][current+1]) {
1284
+ $('lightwindow_next').setStyle({
1285
+ display: 'none'
1286
+ });
1287
+ } else {
1288
+ $('lightwindow_next').setStyle({
1289
+ display: 'block'
1290
+ });
1291
+ $('lightwindow_next_title').innerHTML = this.galleries[gallery[0]][gallery[1]][current+1].title;
1292
+ }
1293
+
1294
+ if (!this.galleries[gallery[0]][gallery[1]][current-1]) {
1295
+ $('lightwindow_previous').setStyle({
1296
+ display: 'none'
1297
+ });
1298
+ } else {
1299
+ $('lightwindow_previous').setStyle({
1300
+ display: 'block'
1301
+ });
1302
+ $('lightwindow_previous_title').innerHTML = this.galleries[gallery[0]][gallery[1]][current-1].title;
1303
+ }
1304
+ }
1305
+
1306
+ if (this._getParameter('lightwindow_iframe_embed')) {
1307
+ this.resizeTo.height = this.dimensions.viewport.height;
1308
+ this.resizeTo.width = this.dimensions.viewport.width;
1309
+ } else {
1310
+ this.resizeTo.height = this._getParameter('lightwindow_height');
1311
+ this.resizeTo.width = this._getParameter('lightwindow_width');
1312
+ }
1313
+
1314
+ this._processWindow();
1315
+
1316
+ break;
1317
+
1318
+ case 'external' :
1319
+
1320
+ this._appendIframe('auto');
1321
+
1322
+ this.resizeTo.height = this.dimensions.viewport.height;
1323
+ this.resizeTo.width = this.dimensions.viewport.width;
1324
+
1325
+ this._processWindow();
1326
+
1327
+ break;
1328
+
1329
+ case 'page' :
1330
+
1331
+ var newAJAX = new Ajax.Request(
1332
+ this.contentToFetch, {
1333
+ method: 'get',
1334
+ parameters: '',
1335
+ onComplete: function(response) {
1336
+ $('lightwindow_contents').innerHTML += response.responseText;
1337
+ this.resizeTo.height = $('lightwindow_contents').scrollHeight+(this.options.contentOffset.height);
1338
+ this.resizeTo.width = $('lightwindow_contents').scrollWidth+(this.options.contentOffset.width);
1339
+ this._processWindow();
1340
+ }.bind(this)
1341
+ }
1342
+ );
1343
+
1344
+ break;
1345
+
1346
+ case 'inline' :
1347
+
1348
+ var content = this.contentToFetch;
1349
+ if (content.indexOf('?') > -1) {
1350
+ content = content.substring(0, content.indexOf('?'));
1351
+ }
1352
+ content = content.substring(content.indexOf('#')+1);
1353
+
1354
+ new Insertion.Top($('lightwindow_contents'), $(content).innerHTML);
1355
+
1356
+ this.resizeTo.height = $('lightwindow_contents').scrollHeight+(this.options.contentOffset.height);
1357
+ this.resizeTo.width = $('lightwindow_contents').scrollWidth+(this.options.contentOffset.width);
1358
+
1359
+ this._toggleTroubleElements('hidden', true);
1360
+ this._processWindow();
1361
+
1362
+ break;
1363
+
1364
+ default :
1365
+ throw("Page Type could not be determined, please amend this lightwindow URL "+this.contentToFetch);
1366
+ break;
1367
+ }
1368
+ },
1369
+ //
1370
+ // Resize the Window to fit the viewport if necessary
1371
+ //
1372
+ _resizeWindowToFit : function() {
1373
+ if (this.resizeTo.height+this.dimensions.cruft.height > this.dimensions.viewport.height) {
1374
+ var heightRatio = this.resizeTo.height/this.resizeTo.width;
1375
+ this.resizeTo.height = this.dimensions.viewport.height-this.dimensions.cruft.height-(2*this.options.viewportPadding);
1376
+ this.resizeTo.height = 520;
1377
+ // We only care about ratio's with this window type
1378
+ if (this.windowType == 'image' || (this.windowType == 'media' && !this._getParameter('lightwindow_iframe_embed'))) {
1379
+ this.resizeTo.width = this.resizeTo.height/heightRatio;
1380
+ $('lightwindow_data_slide_inner').setStyle({
1381
+ width: this.resizeTo.width+'px'
1382
+ });
1383
+ }
1384
+ }
1385
+ if (this.resizeTo.width+this.dimensions.cruft.width > this.dimensions.viewport.width) {
1386
+ var widthRatio = this.resizeTo.width/this.resizeTo.height;
1387
+ this.resizeTo.width = this.dimensions.viewport.width-2*this.dimensions.cruft.width-(2*this.options.viewportPadding);
1388
+ // We only care about ratio's with this window type
1389
+ if (this.windowType == 'image' || (this.windowType == 'media' && !this._getParameter('lightwindow_iframe_embed'))) {
1390
+ this.resizeTo.height = this.resizeTo.width/widthRatio;
1391
+ $('lightwindow_data_slide_inner').setStyle({
1392
+ height: this.resizeTo.height+'px'
1393
+ });
1394
+ }
1395
+ }
1396
+
1397
+ },
1398
+ //
1399
+ // Set the Window to a preset size
1400
+ //
1401
+ _presetWindowSize : function() {
1402
+ if (this._getParameter('lightwindow_height')) {
1403
+ this.resizeTo.height = parseFloat(this._getParameter('lightwindow_height'));
1404
+ }
1405
+ if (this._getParameter('lightwindow_width')) {
1406
+ this.resizeTo.width = parseFloat(this._getParameter('lightwindow_width'));
1407
+ }
1408
+ },
1409
+ //
1410
+ // Process the Window
1411
+ //
1412
+ _processWindow : function() {
1413
+ // Clean out our effects
1414
+ this.dimensions.dataEffects = [];
1415
+
1416
+ // Set up the data-slide if we have caption information
1417
+ if (this.element.caption || this.element.author || (this.activeGallery && this.options.showGalleryCount)) {
1418
+ if (this.element.caption) {
1419
+ $('lightwindow_data_caption').innerHTML = this.element.caption;
1420
+ $('lightwindow_data_caption').setStyle({
1421
+ display: 'block'
1422
+ });
1423
+ } else {
1424
+ $('lightwindow_data_caption').setStyle({
1425
+ display: 'none'
1426
+ });
1427
+ }
1428
+ if (this.element.author) {
1429
+ $('lightwindow_data_author').innerHTML = this.element.author;
1430
+ $('lightwindow_data_author_container').setStyle({
1431
+ display: 'block'
1432
+ });
1433
+ } else {
1434
+ $('lightwindow_data_author_container').setStyle({
1435
+ display: 'none'
1436
+ });
1437
+ }
1438
+ if (this.activeGallery && this.options.showGalleryCount) {
1439
+ $('lightwindow_data_gallery_current').innerHTML = this.galleryLocation.current;
1440
+ $('lightwindow_data_gallery_total').innerHTML = this.galleryLocation.total;
1441
+ $('lightwindow_data_gallery_container').setStyle({
1442
+ display: 'block'
1443
+ });
1444
+ } else {
1445
+ $('lightwindow_data_gallery_container').setStyle({
1446
+ display: 'none'
1447
+ });
1448
+ }
1449
+
1450
+ $('lightwindow_data_slide_inner').setStyle({
1451
+ width: this.resizeTo.width+'px',
1452
+ height: 'auto',
1453
+ visibility: 'visible',
1454
+ display: 'block'
1455
+ });
1456
+ $('lightwindow_data_slide').setStyle({
1457
+ height: $('lightwindow_data_slide').getHeight()+'px',
1458
+ width: '1px',
1459
+ overflow: 'hidden',
1460
+ display: 'block'
1461
+ });
1462
+ } else {
1463
+ $('lightwindow_data_slide').setStyle({
1464
+ display: 'none',
1465
+ width: 'auto'
1466
+ });
1467
+ $('lightwindow_data_slide_inner').setStyle({
1468
+ display: 'none',
1469
+ visibility: 'hidden',
1470
+ width: this.resizeTo.width+'px',
1471
+ height: '0px'
1472
+ });
1473
+ }
1474
+
1475
+ if (this.element.title != 'null') {
1476
+ $('lightwindow_title_bar_title').innerHTML = this.element.title;
1477
+ } else {
1478
+ $('lightwindow_title_bar_title').innerHTML = '';
1479
+ }
1480
+
1481
+ var originalContainerDimensions = {height: $('lightwindow_container').getHeight(), width: $('lightwindow_container').getWidth()};
1482
+ // Position the window
1483
+ $('lightwindow_container').setStyle({
1484
+ height: 'auto',
1485
+ // We need to set the width to a px not auto as opera has problems with it
1486
+ width: $('lightwindow_container').getWidth()+this.options.contentOffset.width-(this.windowActive ? this.options.contentOffset.width : 0)+'px'
1487
+ });
1488
+ var newContainerDimensions = {height: $('lightwindow_container').getHeight(), width: $('lightwindow_container').getWidth()};
1489
+
1490
+ // We need to record the container dimension changes
1491
+ this.containerChange = {height: originalContainerDimensions.height-newContainerDimensions.height, width: originalContainerDimensions.width-newContainerDimensions.width};
1492
+
1493
+ // Get out general dimensions
1494
+ this.dimensions.container = {height: $('lightwindow_container').getHeight(), width: $('lightwindow_container').getWidth()};
1495
+ this.dimensions.cruft = {height: this.dimensions.container.height-$('lightwindow_contents').getHeight()+this.options.contentOffset.height, width: this.dimensions.container.width-$('lightwindow_contents').getWidth()+this.options.contentOffset.width};
1496
+
1497
+ // Set Sizes if we need too
1498
+ this._presetWindowSize();
1499
+ this._resizeWindowToFit(); // Even if the window is preset we still don't want it to go outside of the viewport
1500
+
1501
+ if (!this.windowActive) {
1502
+ // Position the window
1503
+ $('lightwindow_container').setStyle({
1504
+ left: -(this.dimensions.container.width/2)+'px',
1505
+ top: -(this.dimensions.container.height/2)+'px'
1506
+ });
1507
+ }
1508
+ $('lightwindow_container').setStyle({
1509
+ height: this.dimensions.container.height+'px',
1510
+ width: this.dimensions.container.width+'px'
1511
+ });
1512
+
1513
+ // We are ready, lets show this puppy off!
1514
+ this._displayLightWindow('block', 'visible');
1515
+ this._animateLightWindow();
1516
+ },
1517
+ //
1518
+ // Fire off our animation handler
1519
+ //
1520
+ _animateLightWindow : function() {
1521
+ if (this.options.animationHandler) {
1522
+ this.options.animationHandler().bind(this);
1523
+ } else {
1524
+ this._defaultAnimationHandler();
1525
+ }
1526
+ },
1527
+ //
1528
+ // Fire off our transition handler
1529
+ //
1530
+ _handleNavigation : function(display) {
1531
+ if (this.options.navigationHandler) {
1532
+ this.options.navigationHandler().bind(this, display);
1533
+ } else {
1534
+ this._defaultDisplayNavigation(display);
1535
+ }
1536
+ },
1537
+ //
1538
+ // Fire off our transition handler
1539
+ //
1540
+ _handleTransition : function() {
1541
+ if (this.options.transitionHandler) {
1542
+ this.options.transitionHandler().bind(this);
1543
+ } else {
1544
+ this._defaultTransitionHandler();
1545
+ }
1546
+ },
1547
+ //
1548
+ // Handle the finish of the window animation
1549
+ //
1550
+ _handleFinalWindowAnimation : function(delay) {
1551
+ if (this.options.finalAnimationHandler) {
1552
+ this.options.finalAnimationHandler().bind(this, delay);
1553
+ } else {
1554
+ this._defaultfinalWindowAnimationHandler(delay);
1555
+ }
1556
+ },
1557
+ //
1558
+ // Handle the gallery Animation
1559
+ //
1560
+ _handleGalleryAnimation : function(list) {
1561
+ if (this.options.galleryAnimationHandler) {
1562
+ this.options.galleryAnimationHandler().bind(this, list);
1563
+ } else {
1564
+ this._defaultGalleryAnimationHandler(list);
1565
+ }
1566
+ },
1567
+ //
1568
+ // Display the navigation
1569
+ //
1570
+ _defaultDisplayNavigation : function(display) {
1571
+ if (display) {
1572
+ $('lightwindow_navigation').setStyle({
1573
+ display: 'block',
1574
+ height: $('lightwindow_contents').getHeight()+'px',
1575
+ width: '100%',
1576
+ marginTop: this.options.dimensions.titleHeight+'px'
1577
+ });
1578
+ } else {
1579
+ $('lightwindow_navigation').setStyle({
1580
+ display: 'none',
1581
+ height: 'auto',
1582
+ width: 'auto'
1583
+ });
1584
+ }
1585
+ },
1586
+ //
1587
+ // This is the default animation handler for LightWindow
1588
+ //
1589
+ _defaultAnimationHandler : function() {
1590
+ // Now that we have figures out the cruft lets make the caption go away and add its effects
1591
+ if (this.element.caption || this.element.author || (this.activeGallery && this.options.showGalleryCount)) {
1592
+ $('lightwindow_data_slide').setStyle({
1593
+ display: 'none',
1594
+ width: 'auto'
1595
+ });
1596
+ this.dimensions.dataEffects.push(
1597
+ new Effect.SlideDown('lightwindow_data_slide', {sync: true}),
1598
+ new Effect.Appear('lightwindow_data_slide', {sync: true, from: 0.0, to: 1.0})
1599
+ );
1600
+ }
1601
+
1602
+ // Set up the Title if we have one
1603
+ $('lightwindow_title_bar_inner').setStyle({
1604
+ height: '0px',
1605
+ marginTop: this.options.dimensions.titleHeight+'px'
1606
+ });
1607
+
1608
+ // We always want the title bar as well
1609
+ this.dimensions.dataEffects.push(
1610
+ new Effect.Morph('lightwindow_title_bar_inner', {sync: true, style: {height: this.options.dimensions.titleHeight+'px', marginTop: '0px'}}),
1611
+ new Effect.Appear('lightwindow_title_bar_inner', {sync: true, from: 0.0, to: 1.0})
1612
+ );
1613
+
1614
+ if (!this.options.hideGalleryTab) {
1615
+ this._handleGalleryAnimation(false);
1616
+ if ($('lightwindow_galleries_tab_container').getHeight() == 0) {
1617
+ this.dimensions.dataEffects.push(
1618
+ new Effect.Morph('lightwindow_galleries_tab_container', {sync: true, style: {height: '20px', marginTop: '0px'}})
1619
+ );
1620
+ $('lightwindow_galleries').setStyle({
1621
+ width: '0px'
1622
+ });
1623
+ }
1624
+ }
1625
+
1626
+ var resized = false;
1627
+ var ratio = this.dimensions.container.width-$('lightwindow_contents').getWidth()+this.resizeTo.width+this.options.contentOffset.width;
1628
+ if (ratio != $('lightwindow_container').getWidth()) {
1629
+ new Effect.Parallel([
1630
+ new Effect.Scale('lightwindow_contents', 100*(this.resizeTo.width/$('lightwindow_contents').getWidth()), {scaleFrom: 100*($('lightwindow_contents').getWidth()/($('lightwindow_contents').getWidth()+(this.options.contentOffset.width))), sync: true, scaleY: false, scaleContent: false}),
1631
+ new Effect.Scale('lightwindow_container', 100*(ratio/(this.dimensions.container.width)), {sync: true, scaleY: false, scaleFromCenter: true, scaleContent: false})
1632
+ ], {
1633
+ duration: this.duration,
1634
+ delay: 0.25,
1635
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1636
+ }
1637
+ );
1638
+ }
1639
+
1640
+ ratio = this.dimensions.container.height-$('lightwindow_contents').getHeight()+this.resizeTo.height+this.options.contentOffset.height;
1641
+ if (ratio != $('lightwindow_container').getHeight()) {
1642
+ new Effect.Parallel([
1643
+ new Effect.Scale('lightwindow_contents', 100*(this.resizeTo.height/$('lightwindow_contents').getHeight()), {scaleFrom: 100*($('lightwindow_contents').getHeight()/($('lightwindow_contents').getHeight()+(this.options.contentOffset.height))), sync: true, scaleX: false, scaleContent: false}),
1644
+ new Effect.Scale('lightwindow_container', 100*(ratio/(this.dimensions.container.height)), {sync: true, scaleX: false, scaleFromCenter: true, scaleContent: false})
1645
+ ], {
1646
+ duration: this.duration,
1647
+ afterFinish: function() {
1648
+ if (this.dimensions.dataEffects.length > 0) {
1649
+ if (!this.options.hideGalleryTab) {
1650
+ $('lightwindow_galleries').setStyle({
1651
+ width: this.resizeTo.width+'px'
1652
+ });
1653
+ }
1654
+ new Effect.Parallel(this.dimensions.dataEffects, {
1655
+ duration: this.duration,
1656
+ afterFinish: function() {
1657
+ this._finishWindow();
1658
+ }.bind(this),
1659
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1660
+ }
1661
+ );
1662
+ }
1663
+ }.bind(this),
1664
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1665
+ }
1666
+ );
1667
+ resized = true;
1668
+ }
1669
+
1670
+ // We need to do our data effect since there was no resizing
1671
+ if (!resized && this.dimensions.dataEffects.length > 0) {
1672
+ new Effect.Parallel(this.dimensions.dataEffects, {
1673
+ duration: this.duration,
1674
+ beforeStart: function() {
1675
+ if (!this.options.hideGalleryTab) {
1676
+ $('lightwindow_galleries').setStyle({
1677
+ width: this.resizeTo.width+'px'
1678
+ });
1679
+ }
1680
+ if (this.containerChange.height != 0 || this.containerChange.width != 0) {
1681
+ new Effect.MoveBy('lightwindow_container', this.containerChange.height, this.containerChange.width, {transition: Effect.Transitions.sinoidal});
1682
+ }
1683
+ }.bind(this),
1684
+ afterFinish: function() {
1685
+ this._finishWindow();
1686
+ }.bind(this),
1687
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1688
+ }
1689
+ );
1690
+ }
1691
+
1692
+ },
1693
+ //
1694
+ // Finish up Window Animation
1695
+ //
1696
+ _defaultfinalWindowAnimationHandler : function(delay) {
1697
+ if (this.windowType == 'media' || this._getParameter('lightwindow_loading_animation')) {
1698
+ // Because of major flickering with the overlay we just hide it in this case
1699
+ Element.hide('lightwindow_loading');
1700
+ this._handleNavigation(this.activeGallery);
1701
+ this._setStatus(false);
1702
+ } else {
1703
+ Effect.Fade('lightwindow_loading', {
1704
+ duration: 0.75,
1705
+ delay: 1.0,
1706
+ afterFinish: function() {
1707
+ // Just in case we need some scroll goodness (this also avoids the swiss cheese effect)
1708
+ if (this.windowType != 'image' && this.windowType != 'media' && this.windowType != 'external') {
1709
+ $('lightwindow_contents').setStyle({
1710
+ overflow: 'auto'
1711
+ });
1712
+ }
1713
+ this._handleNavigation(this.activeGallery);
1714
+ this._defaultGalleryAnimationHandler();
1715
+ this._setStatus(false);
1716
+ }.bind(this),
1717
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1718
+ });
1719
+ }
1720
+ },
1721
+ //
1722
+ // Handle the gallery Animation
1723
+ //
1724
+ _defaultGalleryAnimationHandler : function(list) {
1725
+ if (this.activeGallery) {
1726
+ $('lightwindow_galleries').setStyle({
1727
+ display: 'block',
1728
+ marginBottom: $('lightwindow_data_slide').getHeight()+this.options.contentOffset.height/2+'px'
1729
+ });
1730
+ $('lightwindow_navigation').setStyle({
1731
+ height: $('lightwindow_contents').getHeight()-20+'px'
1732
+ });
1733
+ } else {
1734
+ $('lightwindow_galleries').setStyle({
1735
+ display: 'none'
1736
+ });
1737
+ $('lightwindow_galleries_tab_container').setStyle({
1738
+ height: '0px',
1739
+ marginTop: '20px'
1740
+ });
1741
+ $('lightwindow_galleries_list').setStyle({
1742
+ height: '0px'
1743
+ });
1744
+ return false;
1745
+ }
1746
+
1747
+ if (list) {
1748
+ if ($('lightwindow_galleries_list').getHeight() == 0) {
1749
+ var height = $('lightwindow_contents').getHeight()*0.80;
1750
+ $('lightwindow_galleries_tab_span').className = 'down';
1751
+ } else {
1752
+ var height = 0;
1753
+ $('lightwindow_galleries_tab_span').className = 'up';
1754
+ }
1755
+
1756
+ new Effect.Morph('lightwindow_galleries_list', {
1757
+ duration: this.duration,
1758
+ transition: Effect.Transitions.sinoidal,
1759
+ style: {height: height+'px'},
1760
+ beforeStart: function() {
1761
+ $('lightwindow_galleries_list').setStyle({
1762
+ overflow: 'hidden'
1763
+ });
1764
+ },
1765
+ afterFinish: function() {
1766
+ $('lightwindow_galleries_list').setStyle({
1767
+ overflow: 'auto'
1768
+ });
1769
+ },
1770
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1771
+ });
1772
+ }
1773
+
1774
+
1775
+ },
1776
+ //
1777
+ // Default Transition Handler
1778
+ //
1779
+ _defaultTransitionHandler : function() {
1780
+ // Clean out our effects
1781
+ this.dimensions.dataEffects = [];
1782
+
1783
+ // Now that we have figures out the cruft lets make the caption go away and add its effects
1784
+ if ($('lightwindow_data_slide').getStyle('display') != 'none') {
1785
+ this.dimensions.dataEffects.push(
1786
+ new Effect.SlideUp('lightwindow_data_slide', {sync: true}),
1787
+ new Effect.Fade('lightwindow_data_slide', {sync: true, from: 1.0, to: 0.0})
1788
+ );
1789
+ }
1790
+
1791
+ if (!this.options.hideGalleryTab) {
1792
+ if ($('lightwindow_galleries').getHeight() != 0 && !this.options.hideGalleryTab) {
1793
+ this.dimensions.dataEffects.push(
1794
+ new Effect.Morph('lightwindow_galleries_tab_container', {sync: true, style: {height: '0px', marginTop: '20px'}})
1795
+ );
1796
+ }
1797
+
1798
+ if ($('lightwindow_galleries_list').getHeight() != 0) {
1799
+ $('lightwindow_galleries_tab_span').className = 'up';
1800
+ this.dimensions.dataEffects.push(
1801
+ new Effect.Morph('lightwindow_galleries_list', {
1802
+ sync: true,
1803
+ style: {height: '0px'},
1804
+ transition: Effect.Transitions.sinoidal,
1805
+ beforeStart: function() {
1806
+ $('lightwindow_galleries_list').setStyle({
1807
+ overflow: 'hidden'
1808
+ });
1809
+ },
1810
+ afterFinish: function() {
1811
+ $('lightwindow_galleries_list').setStyle({
1812
+ overflow: 'auto'
1813
+ });
1814
+ }
1815
+ })
1816
+ );
1817
+ }
1818
+ }
1819
+
1820
+ // We always want the title bar as well
1821
+ this.dimensions.dataEffects.push(
1822
+ new Effect.Morph('lightwindow_title_bar_inner', {sync: true, style: {height: '0px', marginTop: this.options.dimensions.titleHeight+'px'}}),
1823
+ new Effect.Fade('lightwindow_title_bar_inner', {sync: true, from: 1.0, to: 0.0})
1824
+ );
1825
+
1826
+ new Effect.Parallel(this.dimensions.dataEffects, {
1827
+ duration: this.duration,
1828
+ afterFinish: function() {
1829
+ this._loadWindow();
1830
+ }.bind(this),
1831
+ queue: {position: 'end', scope: 'lightwindowAnimation'}
1832
+ }
1833
+ );
1834
+ },
1835
+ //
1836
+ // Default Form handler for LightWindow
1837
+ //
1838
+ _defaultFormHandler : function(e) {
1839
+ var element = Event.element(e).parentNode;
1840
+ var parameterString = Form.serialize(this._getParameter('lightwindow_form', element.getAttribute('params')));
1841
+ if (this.options.formMethod == 'post') {
1842
+ var newAJAX = new Ajax.Request(element.href, {
1843
+ method: 'post',
1844
+ postBody: parameterString,
1845
+ onComplete: this.openWindow.bind(this, element)
1846
+ });
1847
+ } else if (this.options.formMethod == 'get') {
1848
+ var newAJAX = new Ajax.Request(element.href, {
1849
+ method: 'get',
1850
+ parameters: parameterString,
1851
+ onComplete: this.openWindow.bind(this, element)
1852
+ });
1853
+ }
1854
+ },
1855
+ //
1856
+ // Wrap everything up
1857
+ //
1858
+ _finishWindow : function() {
1859
+ if (this.windowType == 'external') {
1860
+ // We set the externals source here because it allows for a much smoother animation
1861
+ $('lightwindow_iframe').setAttribute('src', this.element.href);
1862
+ this._handleFinalWindowAnimation(1);
1863
+ } else if (this.windowType == 'media') {
1864
+
1865
+ var outerObject = document.createElement('object');
1866
+ outerObject.setAttribute('classid', this.options.classids[this._fileExtension(this.contentToFetch)]);
1867
+ outerObject.setAttribute('codebase', this.options.codebases[this._fileExtension(this.contentToFetch)]);
1868
+ outerObject.setAttribute('id', 'lightwindow_media_primary');
1869
+ outerObject.setAttribute('name', 'lightwindow_media_primary');
1870
+ outerObject.setAttribute('width', this.resizeTo.width);
1871
+ outerObject.setAttribute('height', this.resizeTo.height);
1872
+ outerObject = this._addParamToObject('movie', this.contentToFetch, outerObject);
1873
+ outerObject = this._addParamToObject('src', this.contentToFetch, outerObject);
1874
+ outerObject = this._addParamToObject('controller', 'true', outerObject);
1875
+ outerObject = this._addParamToObject('wmode', 'transparent', outerObject);
1876
+ outerObject = this._addParamToObject('cache', 'false', outerObject);
1877
+ outerObject = this._addParamToObject('quality', 'high', outerObject);
1878
+
1879
+ if (!Prototype.Browser.IE) {
1880
+ var innerObject = document.createElement('object');
1881
+ innerObject.setAttribute('type', this.options.mimeTypes[this._fileExtension(this.contentToFetch)]);
1882
+ innerObject.setAttribute('data', this.contentToFetch);
1883
+ innerObject.setAttribute('id', 'lightwindow_media_secondary');
1884
+ innerObject.setAttribute('name', 'lightwindow_media_secondary');
1885
+ innerObject.setAttribute('width', this.resizeTo.width);
1886
+ innerObject.setAttribute('height', this.resizeTo.height);
1887
+ innerObject = this._addParamToObject('controller', 'true', innerObject);
1888
+ innerObject = this._addParamToObject('wmode', 'transparent', innerObject);
1889
+ innerObject = this._addParamToObject('cache', 'false', innerObject);
1890
+ innerObject = this._addParamToObject('quality', 'high', innerObject);
1891
+
1892
+ outerObject.appendChild(innerObject);
1893
+ }
1894
+
1895
+ if (this._getParameter('lightwindow_iframe_embed')) {
1896
+ this._appendIframe('no');
1897
+ this._writeToIframe(this._convertToMarkup(outerObject, 'object'));
1898
+ } else {
1899
+ this._appendObject(outerObject, 'object', $('lightwindow_contents'));
1900
+ }
1901
+
1902
+ this._handleFinalWindowAnimation(0);
1903
+ } else {
1904
+ this._handleFinalWindowAnimation(0);
1905
+ }
1906
+
1907
+ // Initialize any actions
1908
+ this._setupActions();
1909
+ }
1910
+ }
1911
+
1912
+ /*-----------------------------------------------------------------------------------------------*/
1913
+
1914
+ Event.observe(window, 'load', lightwindowInit, false);
1915
+
1916
+ //
1917
+ // Set up all of our links
1918
+ //
1919
+ var myLightWindow = null;
1920
+ function lightwindowInit() {
1921
+ myLightWindow = new lightwindow();
1922
+ }